hi Hartwig,

"Hartwig Wiesmann" writes:

[...]

> osg::Plane::makeUnitLength(void) is not only normalizing the plane's normal 
> but also scaling the distance between the point of origin and the plane.
> Actually, osg::Plane::makeUnitLength(void) should be implemented like
>
> inline osg::Plane::makeUnitLength(void)
> {
>             value_type inv_length = 1.0 / sqrt(_fv[0]*_fv[0] + _fv[1]*_fv[1]+ 
> _fv[2]*_fv[2]);
>             _fv[0] *= inv_length;
>             _fv[1] *= inv_length;
>             _fv[2] *= inv_length;
> }
>
> if it should do only what the method's name suggests the method does.

This could be only an interpretation issue, but let me add some points :)

* The original function is not scaling the distance between the point of
  origin and the plane. Rather than that, it is preserving that
  distance. Think of the trivial case of a plane perpendicular to X with
  an offset of two units from the origin. We could write it as 2x-4=0,
  for example. If you normalize the vector but don't scale the fourth
  component, the resulting plane is different: x-4=0.

* When I read "osg::Plane::makeUnitLength" I think about "normalize the
  vector of the plane". What would be the purpose of having a different,
  only parallel plane after the use of that function?

--
Alberto
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to