use linked nodes to get an upward direction when defining orientation

This commit is contained in:
eap 2010-09-07 06:35:44 +00:00
parent ea6aa32f23
commit b5eb9a6a03

View File

@ -518,8 +518,10 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
// define volume orientation // define volume orientation
XYZ botNormal; XYZ botNormal;
GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z ); GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ]; const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
int topNodeIndex = myVolume->NbCornerNodes() - 1;
while ( !IsLinked( 0, topNodeIndex )) --topNodeIndex;
const SMDS_MeshNode* topNode = myVolumeNodes[ topNodeIndex ];
XYZ upDir (topNode->X() - botNode->X(), XYZ upDir (topNode->X() - botNode->X(),
topNode->Y() - botNode->Y(), topNode->Y() - botNode->Y(),
topNode->Z() - botNode->Z() ); topNode->Z() - botNode->Z() );