Given a plane and a 3D point, transform the 3D point to a 2D coordinate along the plane.

Blitz3D Forums/Blitz3D Programming/Given a plane and a 3D point, transform the 3D point to a 2D coordinate along the plane.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What you ask is impossible. You cannot define a point by a UV coordinate on a plane by merely specifying a point in space and a plane normal.

You must define an origin point on that plane for said coordinates to be relative to, and define one other point 90 degrees to that point to define the directions of the axis of the coordinate system.

Once you have done that though, the problem becomes simple.

Take the normal of the plane and apply this to your point in space to create a ray, and determine where that ray intersects the plane. Then determine where that point is relative to your coordinate system defined by your two points on the plane.

There's code in the code archives to dtermine where a ray intersects a triangle. And a triangle is exactly what you need to define your plane with. I said you only need two points to define your coordinate system, but that presumes a coordinate system with no scaling on either axis and with axis which are 90 degrees to one another. Create a 90 dgree triangle with the code in the code archies I posted so that the 90 degree corder is your plane's origin and the other two points are relative to it, and then do the ray intersect with it using that plane normal combined with the point in space to create the ray. The result is a UV coordinate of the collision point.