Local (X, Y) Coordinates from 3D plane coordinates - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Local (X, Y) Coordinates from 3D plane coordinates (/thread-1819.html)
Local (X, Y) Coordinates from 3D plane coordinates - merrill541 - Feb 1, 2009 07:07 PM
I was wondering if anyone knew how to get an (X, Y) 2D coordinate, from a 3D coordinate based on the plane the 3D coordinate was located on.
Assuming the origin would be at the point where the plane's normal hits the plane.
Local (X, Y) Coordinates from 3D plane coordinates - ThemsAllTook - Feb 1, 2009 08:02 PM
If I'm understanding your question correctly, it sounds like you'd want to perform a transformation on the 3D point to put it into a coordinate system where the plane is perpendicular to the Z axis. In my current project, I do that something like this:
Supporting 3D math code:
Local (X, Y) Coordinates from 3D plane coordinates - Hog - Feb 2, 2009 03:46 AM
if you have a plane given 3 points a, b, c your plane space matrix would theoretically be something like: (b-a,c-a,(b-a)x(c-a),a). (if i haven't gotten the translation part all wrong). you basically need to invert that.
Local (X, Y) Coordinates from 3D plane coordinates - RhinosoRoss - Mar 10, 2009 06:57 AM
...So you have a point (the plane origin) and a vector (the plane normal), and another point which you imply is on the plane...
It seems to me that you're missing a vector on the plane to define it's rotation about its normal...
I'm guessing you've already projected the point to the plane, but just in case: that is:
PointOnPlane = Point - Normal * ((Point-Origin) dot Normal)
All coordinates there will be World Coordinates and it assumes the Normal is actually normalised.
To map to a plane's coordinate space, though you need to define an x and y direction on the plane as well as its normal. This is mostly done in a matrix which allows you to transform by multiplying the point with the matrix both ways.
A 4x3 matrix is all you need:
Set up the above array for the inverse, then call something like this:
and translate with something like this:
LOL - I wonder if that was what you wanted or not?!
Local (X, Y) Coordinates from 3D plane coordinates - ultramcuaiam - May 26, 2009 09:29 AM
I have problem with convert 2D-coordinate to 3D-coordinate.
I don't know dx, dy, dz and PV.P , what they means ?
Local (X, Y) Coordinates from 3D plane coordinates - RhinosoRoss - Jun 29, 2009 01:32 AM
ultramcuaiam Wrote:Hi RhinosoRoss
Sorry, I just clipped some code: they're the plane's vectors and point...
To fully specify a plane, you need a point on the plane that is going to be the origin (PV.P), and three vectors: the normal (dz) and two vectors orthogonal to dz which are going to make up the cartesian axes for the plane.
The code is from The Nugget Mines.
The PV page has a lot of methods for plane handling (a PV is a point and vector together, in this case the origin and normal of a plane).