Salome HOME
use linked nodes to get an upward direction when defining orientation
authoreap <eap@opencascade.com>
Tue, 7 Sep 2010 06:35:44 +0000 (06:35 +0000)
committereap <eap@opencascade.com>
Tue, 7 Sep 2010 06:35:44 +0000 (06:35 +0000)
src/SMDS/SMDS_VolumeTool.cxx

index 52633d6107bfa35f18162884796c627df7e3704e..2967928a14c4a8b2bffc14a3b7d6b2906ea74394 100644 (file)
@@ -518,8 +518,10 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
         // define volume orientation
         XYZ botNormal;
         GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
-        const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
         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(),
                    topNode->Y() - botNode->Y(),
                    topNode->Z() - botNode->Z() );