Skip to content
Snippets Groups Projects
Commit d0f80ec6 authored by Rene Brun's avatar Rene Brun
Browse files

Protection added in TGLMesh::GetNormal.

see: http://savannah.cern.ch/bugs/?25845


git-svn-id: http://root.cern.ch/svn/root/trunk@18578 27541ba8-7e3a-0410-8455-c3a389f83636
parent 14108944
No related branches found
No related tags found
No related merge requests found
// @(#)root/gl:$Name: $:$Id: TGLCylinder.cxx,v 1.2 2006/05/31 07:48:56 brun Exp $
// @(#)root/gl:$Name: $:$Id: TGLCylinder.cxx,v 1.3 2007/01/15 11:30:47 brun Exp $
// Author: Timur Pocheptsov 03/08/2004
// NOTE: This code moved from obsoleted TGLSceneObject.h / .cxx - see these
// attic files for previous CVS history
......@@ -124,9 +124,22 @@ void TGLMesh::GetNormal(const TGLVertex3 &v, TGLVector3 &n)const
Double_t z = (fRmax1 - fRmax2) / (2 * fDz);
Double_t mag = TMath::Sqrt(v[0] * v[0] + v[1] * v[1] + z * z);
n[0] = v[0] / mag;
n[1] = v[1] / mag;
n[2] = z / mag;
if( fDz < 1.e-10 ) {
n[0] = 0.;
n[1] = 0.;
n[2] = 1.;
}
Double_t z = (fRmax1 - fRmax2) / (2 * fDz);
Double_t mag = TMath::Sqrt(v[0] * v[0] + v[1] * v[1] + z * z);
if( mag > 1.e-10 ) {
n[0] = v[0] / mag;
n[1] = v[1] / mag;
n[2] = z / mag;
} else {
n[0] = v[0];
n[1] = v[1];
n[2] = z;
}
}
//______________________________________________________________________________
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment