[etoys-dev] x-y plane issue

Scott Wallace scott.wallace at squeakland.org
Wed Mar 14 03:18:08 EDT 2012

On Mar 13, 2012, at 8:38 PM, Steve Thomas wrote:

> Scott,
> I would think ideally when setting the grid size on a x-y plane, the major gridlines would line up with the x-y axis by default.  But it seems when drawing the graph paper you start from the top left to draw your grid lines.  In doing so the grid lines do not align with the x-y axis (see picture below):

Hi, Steve, and thanks.

I don't disagree that it would be plausible to provide a feature-ful "cartesian plane" as a built-in kind of object which had built-in axes and built-in gridding and maintained reasonable correlations among grid parameters and the various parameters of the axes; and perhaps built-in plot-point objects and vector-line objects, and more.  (Perhaps an early version that Richo produced 2 years ago was actually like this?)

But what we have available in etoys-5.0 is not that.

Instead we have the ability to design grid-like "wallpaper", which, among other things, can be used as the "color" of a playfield; and, quite separately, the ability to obtain "number lines", place them on that playfield, and configure them, with the intention of using them as axes that define a kind of "metric" for that playfield; and the ability for individual objects placed on that playfield to report xOnGraph and yOnGraph coordinates with respect to the metrics of those number lines.

The specification of the "graph paper" is independent from the presence and (if present) locations and parameters of any number lines in the playfield.

This may require too much construction from bare parts for some.  But for those thinking it worth the effort, I think it's important to understand that the grid specification is independent of anything about any number lines, and vice-versa.  Any of them can be changed at any time.  If the ways the number lines and the grid-lines line up are not satisfactory, then either move the number lines or change the offset of the grid or both.

The style of use that I think would be effective is:

Get a playfield and give it the prospective grid by using the graph-paper tool.

Obtain horizontal and vertical number lines, give them parameters that correlate well with your chosen grid parameters, drop them into the playfield, and position them so that they intersect at their zero points and precisely at a suitable grid point on the wallpaper background.

Fine-tuning of the positioning of the axes can be done by adjusting their x and y coordinates in the viewer, or simply being careful manual positioning with the brown halo handle.

If there is any further problem of registry between nominally compatible grid and axis-parameters that can't be solved by adjusting the parameters of the grid, the parameters of the axes, or the locations of the axes, I suppose it likely might be due to intractable round-off artifacts.

> While starting at the top left to draw grid lines makes sense for graph paper, perhaps for x-y plane, it would be better to align with the default position of the x-y axis.

But the positions of the x and y axes are wherever you put them, so I'm not sure what the "default position" would mean.  In any case, it's (theoretically anyway) the job of the "offset" in the graph-paper panel to allow for just this kind of fine-tuning if for some reason having the grid pattern start at the top-left of the playfield is not satisfactory.

> This becomes more of a problem when placing objects in the x-y plane as evidenced by the picture below, where I place a transparent circle at 8,4, but as the magnifier shows it does not align at the intersection of the grid.  This is because the grid is not aligned with the number lines.

The number lines are wherever you place them on the playfield.  So once you've got the grid looking the way you want, and once you've established compatible parameters for your number lines, you can fine-tune the alignment by adjusting the x and y coordinates of the axes (*not* their own xOnGraph and yOnGraph.)  The example x-y plane provided in the Objects tool, if that's what your final paragraph is using, perhaps needs a little more tweaking, but I don't think it's ever going to be possible (given our pixel-based graphics system and floating-point coordinates) to avoid every off-by-one-pixel round-off artifact.

Finally -- Steve, you'd probably the best person on the planet to specify how many, and which, pre-built x-y planes we should offer in the Graphing category of the Objects Tool.  In the beta images thus far we have just that one provided as an example (which perhaps still needs some tweaking.)  But perhaps others (e.g. first-quadrant, or a graph with dramatically a different scale) should also be provided?  Or perhaps we should have *no* pre-built structures of this sort at all?

I can see that I've given mostly the same answer three times in the above -- none of them likely to give satisfaction -- sorry :)

  -- Scott

More information about the etoys-dev mailing list