[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Co-ordinates in a 2d plane in 3d



Hi.

While working on my latest program (which will remain a secret for now :) 
I've come to another problem with the current 3d model that I think needs 
sorting somehow.  Tommaso Russo mentioned it in his previous discussion of 
3d with George a couple of weeks ago, but it wasn't clear to me until now.

While most 2d code still works when taken into 3d, the towards, heading, 
seth, pos and setpos commands don't do what you might expect or want.  They 
currently work relative to the "absolute" x and y axes (the first two 
values returned by posxyz).  I think they should all work relative to the 
turtle's current plane, something which wouldn't be too hard to implement I 
think.

What it would require would be to be able to map every plane onto the 
original xy plane.  The difficult part is choosing suitable axes.  Tommaso 
suggested the position and heading of the turtle when it last entered the 
plane as the origin and y axis direction.  This sounds like a reasonable 
solution, but if you do "up 90 down 90" your origin has suddenly moved.

I think the things which you would want from an origin are:

1. Fixed (and unique!) for every plane.
2. Has two associated axes which are perpendicular within the plane.
3. At same position as the absolute origin for planes which pass through
   the absolute origin.
4. At the position where the axis crosses the plane if there is only one
   such point.

3 and 4 are optional, but would seem to make sense.  Actually, the axes 
being perpendicular is optional too, but if they aren't, you'll get 
rhombuses instead of squares...

My suggestion is this: for every plane, the origin is the point whose 
position vector (posxyz) is the normal to the plane, that is, the point 
which a line perpendicular to the plane must be fired through in order to 
hit the absolute origin ([0 0 0]).  For the associated axes, I suggest 
taking the projection of the absolute y axis onto the plane as the y axis 
(where you would see the y axis if you were looking through the plane at 
the origin) and taking the x axis to be 90 degrees to the right of this.

This succeeds at points 1,2 and 3 on my list, and 4 for "flat" planes.  I'm 
calling a plane "flat" if it is parallel to one of the absolute axis 
planes.

It's possible that this scheme will have consequences which I haven't 
thought of yet, but at 1:15am (now) it seems like a good idea :)

Tom
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home