# Convert 3D to 2D Points

This topic is 4447 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Can someone give me the formulas to convert 3D points to 2D points in the simplist way possible please?

##### Share on other sites
Unless I don't understand what your asking the formula is point*view*projection where view and projection are matrixes that can be found here: view matrix, projection matrix

edit: note that point is x,y,z,w where w is typically 1.

##### Share on other sites
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 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 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 on other sites
Quote:
 Original post by StormArmageddonview matrix, projection matrix

If you look around on these pages I supplied you can find how to do it without api using linear algebra. Here is a link on the view transform page LookAtLH.

##### Share on other sites
Quote:
 Original post by brwarnerCan 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 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 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.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 23
• 9
• 49
• ### Forum Statistics

• Total Topics
632639
• Total Posts
3007588
• ### Who's Online (See full list)

There are no registered users currently online

×