Turning 3d points on a plane to 2d co-ords?
-
I got a set of 3d points, and I would like to compare their relative position to each other on the plane. Any ideas?
-
If the plane is z=0 flat them simply make the point.z=0 for each point.
If it's an arbitrary plane then project the point to the plane using the plane's normal - or normal.reverse depending which way it's facing - as the 'line's' vector.
http://code.google.com/apis/sketchup/docs/ourdoc/geom.html#intersect_line_plane
intersecting the line with the plane returns a point where the vector hits the plane... nil if not - so you can use that if you are unsure on the vector's direction - simply do one test for an intersecting point if no point then use the reversed vector it must then intersect the plane... -
@tig said:
If it's an arbitrary plane then project the point to the plane using the plane's normal
?
the points are already on the plane. -
I'll try to spesify:
I have an arbitrary plane.
I have a set of 3d point that all lie on that planeI would like to work with them in their relative 2D co-ordinates on that plane. (I have a point that acts as origin.)
-
if you have x and y vectors:
model2plane = Geom::Transformation.axes(point,x,y,normal).inverse(untested)otherwise you can either use
vector.crossif you have one vector, orvector.axesif you have neither. -
Ah1 I've overlooked that transformation method! Thanks, I'll see if I can make this work.
-
Thank you Chris! It worked like a charm! So glad you pointed that method out, as I was about to embark on a dreadful DIY reinvent the wheel journey.
-
Hopefully in some future version we'll have a Geom::Axes class that let's us instantiate as many UCS' as we need and GC them when they're no longer needed. (There would be a world WCS preset by SU of course.)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement