How to effectively rotate and translate a plane in 3D

I have a plane defined by the normal (n) and distance (d) (from the origin). I would like to convert it to a new system. Long way: 1) multiply the distance (d) with the normal (n), as a result of which the vector (p) 2) turn (R) and translate (v) the vector (p) to get (p ') 3) normalize (p ') to get normal 4) use a different algorithm to find the smallest distance (d') between the new plane and the origin

I have not tried this, but I think it should work. Question: Isn't there a faster way to get n 'and d'? If the translation (v) is 0, I can skip 4). But if it is not 0? Is there an easier way to get a new d ??

+3
source share
2 answers

You have to be careful because the normals do not necessarily transform like points, and the distance is the perpendicular distance to the origin, so you need to calculate d'= d + n.v. If all you do is translate and rotate, you can rotate normal and calculate a new perpendicular distance. But, if you scale your axes differently or do a general projective transformation, you need to relate to other things.

The way that works for everything is to use uniform coordinates, so all your transformations are 4x4 matrices, and your points and your planes are 4-vectors:

point p=(x,y,z)        -> homogeneous (x,y,z,1), equiv. to (x*W, y*W, z*W, W)
plane q=[n=(a,b,c), d] -> homogeneous [a,b,c,d], equiv. to [a*K, b*K, c*K, d*K)

  -> point p is on plane q iff:  p.q=0   (using homogeneous coords, as above) 

, 4x4 T , . , . , :

point p' = T p
plane q' = (T^-1)^t q

  -> point p' is on plane q' when:  p'.q'=0

  then, note:  p'.q' = p^t T^t (T^-1)^t q = p^t q = p.q
  so:  p'.q'=0  whenever p.q=0
+5
n' = n*R^T
d' = d - n*R^T*trans
0

Source: https://habr.com/ru/post/1733771/


All Articles