Sign in to follow this  
brwarner

Convert 3D to 2D Points

Recommended Posts

There are accessory functions to determine the conversion in most 3D APIs. For example you can use gluProject() and gluUnproject() to convert between world and screen coordinates with GL and Direct3D has D3DXVec3Unproject() and D3DXVec3Project().

Share this post


Link to post
Share on other sites
The standard method is to manually apply the pipeline to the points in question, which involves applying the world, view, projection, and viewport transforms, and perhaps performing a perspective divide.

However, the 'easiest way possible' would probably be to use someone else's code. If you're using OpenGL and have glu available, use gluProject(); I assume there's an equivalent in DX as well.

Share this post


Link to post
Share on other sites
What I was looking for was a trigonametric way to convert 3d to 2d using no API. I can not use an api because I am writing the program in Flash, so no DirectX or OpenGL.

Share this post


Link to post
Share on other sites
Quote:
Original post by brwarner
Can someone give me the formulas to convert 3D points to 2D points in the simplist way possible please?

You probably left out something important as the simplest way without any constraints is obvious:
2dpoint.x=0
2dpoint.y=0
is the simplest formula to convert 3d-points to 2d-points, it converts every 3d-point to (0,0). A bonus: it works for 4d-points too ;)

Share this post


Link to post
Share on other sites
It's ok I found this which seems to be simple enough:
http://chattyfig.figleaf.com/pipermail/flashcoders/2001-September/009906.html

Share this post


Link to post
Share on other sites
The simplest way if you have (x,y,z) is to let u=x/z, v=y/z, then rescale and translate (u,v) so that it fits on your screen in a nice way. All the projection matrix math you may have seen basically boils down to that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this