namespace
{
- inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos2 )
+ inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos )
{
double dot = v1 * v2; // cos * |v1| * |v2|
double l1 = v1.SquareMagnitude();
double l2 = v2.SquareMagnitude();
- return ( dot * dot ) / l1 / l2 >= cos2;
+ return (( dot * cos >= 0 ) &&
+ ( dot * dot ) / l1 / l2 >= ( cos * cos ));
}
}
CoplanarFaces::CoplanarFaces()
if (!normOK)
return;
- const double cosTol2 = Cos( myToler ) * Cos( myToler );
+ const double cosTol = Cos( myToler * M_PI / 180. );
NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks;
std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue;
if ( f->GetNodeIndex( n2 ) > -1 )
{
gp_Vec norm = getNormale( static_cast<const SMDS_MeshFace*>(f), &normOK );
- if (!normOK || isLessAngle( myNorm, norm, cosTol2))
+ if (!normOK || isLessAngle( myNorm, norm, cosTol))
{
myCoplanarIDs.Add( f->GetID() );
faceQueue.push_back( make_pair( f, norm ));
const QFace* QLink::GetContinuesFace( const QFace* face ) const
{
- for ( size_t i = 0; i < _faces.size(); ++i ) {
- if ( _faces[i] == face ) {
- int iF = i < 2 ? 1-i : 5-i;
- return iF < (int)_faces.size() ? _faces[iF] : 0;
+ if ( _faces.size() <= 4 )
+ for ( size_t i = 0; i < _faces.size(); ++i ) {
+ if ( _faces[i] == face ) {
+ int iF = i < 2 ? 1-i : 5-i;
+ return iF < (int)_faces.size() ? _faces[iF] : 0;
+ }
}
- }
return 0;
}
//================================================================================
}
// check sub-meshes
- for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart < SMESH::Tag_LastSubMesh; ++aPart )
+ for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart <= SMESH::Tag_LastSubMesh; ++aPart )
{
if ( !theMesh->FindSubObject( aPart, aHypFolder ))
continue;
hyp.GetCopySourceMesh() == args[1], args[2] )
hyp = self.Hypothesis("ImportSource2D", [groups, toCopyMesh, toCopyGroups],
UseExisting=UseExisting, CompareMethod=compFun, toAdd=False)
+ if groups and isinstance( groups, SMESH._objref_SMESH_GroupBase ):
+ groups = [groups]
hyp.SetSourceFaces(groups)
hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups)
self.mesh.AddHypothesis(hyp, self.geom)
if self.mesh.HasShapeToMesh():
hyp_type = hyp.GetName()
lib_name = hyp.GetLibName()
- checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
- if checkAll and geom:
- checkAll = geom.GetType() == 37
+ # checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
+ # if checkAll and geom:
+ # checkAll = geom.GetType() == 37
+ checkAll = False
isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll)
if isApplicable:
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())