Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphics - equation to convert 3d point to 2d projection

Tags:

graphics

2d

3d

I am a graphics novice, but am playing with HTML5 Canvas, javascript and some shapes and images. If I have a camera at point C.x,C.y,C.z, and a point at P.x,P.y,P.z, what is the easiest way to convert the point to a 2d point so I can render an image at that point with the correct scaling so my perspective is correct? I'm after the equations, not a library.

Thanks!

like image 717
Journeyman Avatar asked Oct 11 '22 13:10

Journeyman


1 Answers

It is called the Perspective Projection and the formula you seek is just the matrix-multiplication found here:

http://en.wikipedia.org/wiki/3D_projection#Perspective_projection

like image 156
Bernd Elkemann Avatar answered Oct 16 '22 02:10

Bernd Elkemann