Search code examples
game-enginecomputational-geometrygame-physicsraytracing

How to get a 3D point on a plane (which is represented as normal and offset from origin)?


I know how to get the intersection point between a ray and a plane, if I know the ray and a point on the plane, and the plane normal.

In the code I use the plane is represented as signed offset from origin, and normal, and I need to get some, any point on the plane. How to do this?

So, the plane equation: Ax + By + Cz + D = 0, and I know A,B and C, that is basically the normal of the plane and I know D, which is the signed distance from the origin. And my question is, given that how do I get some 3D point on the plane?

Thanks


Solution

  • You get one plane point by intersecting plane with a ray (line) :-)

    Choose some point P=(x,y,z), calculate w=Ax+By+Cz.

    If w=-D than P is on the plane.

    For w!=-D, choose some direction Q=(dx,dy,dz) for which l=Adx+Bdy+Cdz!=0, e.g. q=(A,0,0), if B!=0 or C!=0. Than point P+l*Q/w is on the plane.