开发者

3d orthogonal projection on a plane

I have a point in 3d P(x,y,z) and a plane of view Ax+By+Cz+d=0 . A point in plane is E.Now i want to project that 3d point to that plane and get 2d coordinates of the projected point relative to the point E.

P(x,y,z) = 3d point which i want to project on the plane.
Plane Ax + By + Cz  + d  = 0 , so normal n = (A,B,C)
E(ex,ey,ez) = A point in plane ( eye pos of camera )

What i am doing right now is to get nearest point in plane from point P.then i subtract that point to E.I suspect that this is right ???

please help me.Thanks.开发者_Go百科


The closest point is along the normal to the plane. So define a point Q that is offset from P along that normal.

Q = P - n*t

Then solve for t that puts Q in the plane:

dot(Q,n) + d = 0
dot(P-n*t,n) + d = 0
dot(P,n) - t*dot(n,n) = -d
t = (dot(P,n)+d)/dot(n,n)

Where dot((x1,y1,z1),(x2,y2,z2)) = x1*x2 + y1*y2 + z1*z2


You get a point on the plane as p0 = (0, 0, -d/C). I assume the normal has unit length.

The part of p in the same direction as n is dot(p-n0, n) * n + p0, so the projection is p - dot(p-p0,n)*n.

If you want some coordinates on the plane, you have to provide a basis/coordinate system. Eg two linear independent vectors which span the plane. The coordinates depend on these basis vectors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜