-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <BRepBndLib.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B3d.hxx>
+#include <Bnd_Box.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_Curve.hxx>
vector< int > _elementIDs;
};
//================================================================================
- /*!
- * \brief BRepMesh_IncrementalMesh with access to its protected Bnd_Box
- */
- struct IncrementalMesh : public BRepMesh_IncrementalMesh
- {
- IncrementalMesh(const TopoDS_Shape& shape,
- const Standard_Real deflection,
- const bool relative):
- BRepMesh_IncrementalMesh( shape, deflection, relative )
- {
- }
- Bnd_B3d GetBox() const
- {
- Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
- myBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
- Bnd_B3d bb;
- bb.Add( gp_XYZ( TXmin, TYmin, TZmin ));
- bb.Add( gp_XYZ( TXmax, TYmax, TZmax ));
- return bb;
- }
- };
- //================================================================================
/*!
* \brief Link of two nodes
*/
for ( int i = 0; i < 3; ++i )
{
const gp_Pnt& pn = myNodes->Value(n[i]);
- if ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 ))
+ if (( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 )))
break;
if ( !projectedOnly )
minD2 = Min( minD2, pn.SquareDistance( p ));
TopExp::MapShapes( theMesh.GetShapeToMesh(), TopAbs_FACE, faceMap );
// Triangulate the shape with the given deflection ?????????
+ {
+ BRepMesh_IncrementalMesh im( theMesh.GetShapeToMesh(), myHyp->GetDeflection(), /*isRelatif=*/0);
+ }
+
+ // get a bnd box
Bnd_B3d box;
{
- IncrementalMesh im( theMesh.GetShapeToMesh(), myHyp->GetDeflection(), /*Relatif=*/false);
- box = im.GetBox();
+ Bnd_Box aBox;
+ BRepBndLib::Add( theMesh.GetShapeToMesh(), aBox);
+ Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
+ aBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
+ box.Add( gp_XYZ( TXmin, TYmin, TZmin ));
+ box.Add( gp_XYZ( TXmax, TYmax, TZmax ));
}
// *theProgress = 0.3;
eData.AddPoint( eData.myPoints.end(), eData.myC3d.LastParameter() );
}
}
+ if ( myEdges.empty() ) return true;
if ( _computeCanceled ) return false;
// Take into account size of already existing segments
double maxSegSize = 0;
// get points to check distance to the face
- EdgeData::TPntIter pIt2 = eData.myPoints.begin(), pIt1 = pIt2++;
+ EdgeData::TPntIter pIt2 = eData.myPoints.begin(), pIt1 = pIt2++, pItLast;
maxSegSize = pIt1->mySegSize = Min( pIt1->mySegSize, sizeTree.GetSize( pIt1->myP ));
for ( ; pIt2 != eData.myPoints.end(); )
{
//cout << "E " << theMesh.GetMeshDS()->ShapeToIndex( eData.Edge() ) << endl;
sizeDecreased = false;
const gp_Pnt* avoidPnt = & eData.First().myP;
+ pItLast = --eData.myPoints.end();
for ( pIt1 = eData.myPoints.begin(); pIt1 != eData.myPoints.end(); )
{
double distToFace =
pIt1->mySegSize = allowedSize;
}
++pIt1;
- if ( & (*pIt1) == & eData.Last() )
+ if ( pIt1 == pItLast )
avoidPnt = & eData.Last().myP;
else
avoidPnt = NULL;
for ( ; edExp.More(); edExp.Next() )
{
- const TopoDS_Edge & edge = TopoDS::Edge( edExp.Current() );
+ //const TopoDS_Edge & edge = TopoDS::Edge( edExp.Current() );
StdMeshers_Regular_1D::Evaluate( theMesh, theShape, theResMap );
}
return true;