What John says is true at least for 3x3 orientation matrices, which I think is the case by reading the code. In that case, the transpose and the inverse of a transformation matrix are equal (they are orthogonal).
Both of you may get correct results because (R*p)t = pt*Rt, being "t" the transpose symbol and R, p the Rotation matrix and the Point vector respectively. I think John's way is simpler and possibly faster. Alberto El Martes, 3 de Octubre de 2006 10:27, Robert Osfield escribió: > Hi John, > > To transform planes and normals you mulitple by the transpose of the > inverse of a matrix, to transform vertices you multiple by the matrix > directly. The code you see does the trick of doing the transpose by doing > doing switching the post and pre multiple order. > > I also haven't see switching normal orientations before, this makes me > wonder if there isn't something else wrong that you usage is uncovering. > Could you provide a model that reproduces it? > > Robert. > > > On 10/3/06, John Aughey <[EMAIL PROTECTED]> wrote: > When the optimizer reduces static transforms, it multiplies the verticies > and normals by the current transformation matrix. It uses > TransformAttributeFunctor to do this. However, it's transforming the > normals backwards. The comment in the TransformAttributeFunctor.cpp line > 43 says to post mult by inverse for normals which makes no sense. The > normals should be transformed the same way the verticies are. If you > change the matrix from _im to _m on line 44, then the model optimizes > correctly with the normals pointing the correct way. > > If you want, I can submit a patch for just this. > > John _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
