Salome HOME
PAL8596. Fix warping calculation
[modules/smesh.git] / src / Controls / SMESH_Controls.cxx
index 2bf885a7a29a0d1500bc03e04f0818c4e2eda230..084f07d9abe07eb78fbe66a787a92a085a7642f5 100644 (file)
@@ -45,6 +45,7 @@
 #include "SMDS_Iterator.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_VolumeTool.hxx"
 
 
 /*
@@ -637,8 +638,8 @@ double Warping::ComputeA( const gp_XYZ& thePnt1,
   if ( L < Precision::Confusion())
     return 0.;
 
-  gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
-  gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
+  gp_XYZ GI = ( thePnt2 + thePnt1 ) / 2. - theG;
+  gp_XYZ GJ = ( thePnt3 + thePnt2 ) / 2. - theG;
   gp_XYZ N  = GI.Crossed( GJ );
 
   if ( N.Modulus() < gp::Resolution() )
@@ -1165,6 +1166,37 @@ void MultiConnection2D::GetValues(MValues& theValues){
                             PREDICATES
 */
 
+/*
+  Class       : BadOrientedVolume
+  Description : Predicate bad oriented volumes
+*/
+
+BadOrientedVolume::BadOrientedVolume()
+{
+  myMesh = 0;
+}
+
+void BadOrientedVolume::SetMesh( SMDS_Mesh* theMesh )
+{
+  myMesh = theMesh;
+}
+
+bool BadOrientedVolume::IsSatisfy( long theId )
+{
+  if ( myMesh == 0 )
+    return false;
+
+  SMDS_VolumeTool vTool( myMesh->FindElement( theId ));
+  return !vTool.IsForward();
+}
+
+SMDSAbs_ElementType BadOrientedVolume::GetType() const
+{
+  return SMDSAbs_Volume;
+}
+
+
+
 /*
   Class       : FreeBorders
   Description : Predicate for free borders