Reputation:
I have a planar element in 3D space that I've rotated on the x, y and z axis. I'm positioning a 3D camera in front of the planar but I need to find a way to calculate the x, y, z of the camera.
I'm trying to figure out how to place the camera at x distance from the planes face. There's obviously a bit of trig involved but for the life of me can't figure it out. Gah.
Dave
Upvotes: 3
Views: 2080
Reputation: 16007
The relation between distance of a point to a plane is
distance = (Aa + Bb + Cc + D) / sqrt(A^2+B^2+C^2)
for distance to plane Ax + By + Cz + D = 0 from point (a,b,c)
Might need to multiply by -1 to get distance positive.
The equations for the line through point (a,b,c) perpendicular to the same plane is
x = a + At; y = b + Bt; z = c + Ct
So if you have a point in the plane, you can find the equation of the line perpendicular to that plane. Then you can use the distance constraint to solve for two points a distance along that line - one above the plane, and one below.
Upvotes: 2
Reputation: 79003
If you have a plane then you also have its normal vector N and some point on it P.
If you calculate P'=P+x*N
you'll get the point P'
which is x units infront of point P in the direction of the normal.
Upvotes: 2