diff --git a/wrap/gui/view.h b/wrap/gui/view.h index c665142f..2d420fda 100644 --- a/wrap/gui/view.h +++ b/wrap/gui/view.h @@ -169,10 +169,14 @@ template Point3 View::ViewPoint() const { // Note that p it is assumed to be in model coordinate. template Plane3 View::ViewPlaneFromModel(const Point3 &p) { + //compute normal, pointing away from view. + Matrix44 imodel = model; + Invert(imodel); Point3 vp=ViewPoint(); - Plane3 pl; // plane perpedicular to view direction and passing through manip center - pl.n=(vp-p); - pl.d=pl.n*p; + vcg::Point3f n = imodel * vcg::Point3(0.0f, 0, -1.0f) - vp; + + Plane3 pl; + pl.Init(p, n); return pl; }