Re: [Algorithms] RE: Fast plane transform with a 4x4 matrix
Brought to you by:
vexxed72
|
From: Emilio C. <em...@st...> - 2001-03-28 08:07:30
|
----- Original Message ----- From: "Tomas Arce" <ta...@au...> ... >> The transformed plane is given by >> >> N^t X + D = 0 >> >> with >> N = A^-1^t n >> and >> D = -n^t (A^-1 T) + d = - T^t (A^-1^t n) + d >> >> In the case of a rotation matrix A=R plus a translation vector T you have >> R^-1^t = R and therefore >> >> N = R n >> D = - T^t ( R n) + d >> >> Emilio >> > > So what you are saying is to transform the Normal by the rotation part of > the 4x4 matrix, (3x3part). > I am not too sure it will survive a scale. I think it will survive, if you take the general formula. The plane equation is still valid, but you have to renormalize the plane equation in order to get a normalized N. In the case of an isotropic scaling (same diagonal elements in the 3x3 part of S), the normalization of the plane equation is simplified, you only need to scale the whole equation with the scaling factor to get a normalized plane normal. Sorry, my derivation of the formulas for plane transformation is probably not very transparent. >I think it will have the same > problem that what Martin was proposing. > > Here is some more info. This is for a building. The building has an SRT > matrix which allows to have an arbitrary scaling, > rotating, and translation. I have to take the planes of the camera to the > local space of the building so I can check > for rejections, portals, and some other stuff. Are the diagonal elements of the 3x3 part of S equal (isotropic scaling)? I will decompose your transformation and consider only the 3x3 part and the last 3-dimensional column (translation vector) of TRS. Let's say S is a 3x3 scaling matrix and R a 3x3 rotating matrix and T a 3-dimensional column vector describing the translation. The original plane equation is given by n^t x + d = 0 The new normal N of the transformed plane is given by N = (S^-1 R) n the transformed distance constant D is D = -T^t (R S^-1) n + d In the case of an isotropic scaling you can easily normalize the plane equation: N = R n D = -T^t (R n) + S d = -T^t N + S d So you don't have to perform any divisions or sqrt(). You only need to compute one matrix-vector multiplication N=R n, one dot-product T^t N, one simple addition and one simple multiplication S d. Emilio > > The code I send you creates 3 points in the plane and transform them by the > 4x4 matrix. Then using those 3 points > to recompute the plane equation. This will survive the hold S,R,T matrix > thing. But I think it is not the fastest way of doing this. > > Sorry guys to not give all the info at front. Any additional help will be > most welcome. > > Tomas Arce > www.zen-x.net |