1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0027362: Meshing performance

1) BRepMesh_FastDiscretFace.cxx:
- exclude planes from procedure of inserting internal points.
- localize declaration of the container aNewVertices in each method where it is needed.
- correct the logic of the method insertInternalVerticesOther, so that to separate the processes of removing extra points and addition of new points in different cycles, thus making the code more clear and in addition stable.
- insert useful output of intermediate mesh to a file in control() method for debug purposes (with definition DEBUG_MESH).

2) Add global functions MeshTest_DrawTriangles and MeshTest_DrawLinks to draw mesh data in debug session.

3) BRepMesh_FastDiscret:
- in the method Add calculations of deflections have been simplified for non-relative mode.
- replace the attribute MinDist with Deflection in EdgeAttributes structure. Correct its computation so that later to store this value as deflection of the polygon.

4) Make protection against exception in the method BRepMesh_Delaun::addTriangle() when an added triangle creates a third connection of a mesh edge.

5) BRepMesh_EdgeTessellator.cxx, BRepMesh_EdgeTessellationExtractor.cxx: use Geom2dAdaptor_Curve in order to use b-spline cache while computing value on a curve.

6) In BndLib_Box2dCurve::PerformBSpline, avoid creating new b-spline in case of requested parameter range differ from natural bounds insignificantly.

7) In GeomAdaptor classes, postpone building of cache till the time of its actual usage. So, creation of an adapter to compute intervals of continuity does not lead to creation of internal cache.

8) In the methods BRepAdaptor_Curve::Bezier and BSpline do not call Transformed() if transformation is identity.

9) In the classes Geom_BSplineCurve, Geom_BSplineSurface, Geom_BezierCurve, Geom_BezierSurface, Geom2d_BSplineCurve, Geom2d_BezierCurve change the method Pole() to return the point by const reference.

10) In CPnts_AbscissaPoint.cxx, compute derivative by D1 instead of DN to make use of b-spline cache.

11) Change test cases to actual state:
  - Number of triangles/nodes can grow due to more accurate work with deflection of edges. Now the edge is tessellated using its own tolerance instead of maximal tolerance of all shapes in the face.
  - Accept new numbers of mesh errors (free links, free nodes) for really bad shapes.
  - Correct the test "bugs/mesh/bug25612" to produce stable result.
  - Disable redundant checks in test cases bug25378* (lower limit for computation time).

- Speed up iso-lines computation for offset of bspline surfaces. For that use adaptor instead of original surface in evaluator of approximation.
- Add output of polylines for debug of insertInternalVerticesOther().

Reference data in test case bugs\moddata_2\bug453_3 have been changed to be close to expected theoretical values. This makes the test give stable result on different platforms.
This commit is contained in:
msv
2016-05-04 04:12:28 +03:00
committed by bugmaster
parent 4f51d9d704
commit 8109385697
65 changed files with 639 additions and 444 deletions

View File

@@ -1086,10 +1086,17 @@ Standard_Boolean BRepMesh_Delaun::checkIntersection(
//function : addTriangle
//purpose : Add a triangle based on the given oriented edges into mesh
//=======================================================================
inline void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
const Standard_Boolean (&theEdgesOri)[3],
const Standard_Integer (&theNodesId)[3] )
void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
const Standard_Boolean (&theEdgesOri)[3],
const Standard_Integer (&theNodesId)[3])
{
for (Standard_Integer i = 0; i < 3; ++i)
{
const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo(theEdgesId[i]);
if (aPair.Extent() == 2)
// it is forbidden to have more than two triangles connected to the same link
return;
}
Standard_Integer aNewTriangleId =
myMeshData->AddElement(BRepMesh_Triangle(theEdgesId,
theEdgesOri, BRepMesh_Free));

View File

@@ -223,9 +223,9 @@ private:
BRepMesh::MapOfIntegerInteger& thePoly);
//! Add a triangle based on the given oriented edges into mesh
inline void addTriangle (const Standard_Integer (&theEdgesId)[3],
const Standard_Boolean (&theEdgesOri)[3],
const Standard_Integer (&theNodesId)[3]);
void addTriangle (const Standard_Integer (&theEdgesId)[3],
const Standard_Boolean (&theEdgesOri)[3],
const Standard_Integer (&theNodesId)[3]);
//! Deletes the triangle with the given index and adds the free edges into the map.
//! When an edge is suppressed more than one time it is destroyed.

View File

@@ -14,7 +14,7 @@
// commercial license or contractual agreement.
#include <BRepMesh_EdgeTessellationExtractor.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
#include <BRepMesh_ShapeTool.hxx>
@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor,BRepMesh_IEdgeTool
//=======================================================================
BRepMesh_EdgeTessellationExtractor::BRepMesh_EdgeTessellationExtractor(
const TopoDS_Edge& theEdge,
const Handle(Geom2d_Curve)& thePCurve,
const Handle(Geom2dAdaptor_HCurve)& thePCurve,
const TopoDS_Face& theFace,
const Handle(Poly_Triangulation)& theTriangulation,
const Handle(Poly_PolygonOnTriangulation)& thePolygon,

View File

@@ -28,7 +28,7 @@ class Poly_Triangulation;
class Poly_PolygonOnTriangulation;
class TopoDS_Edge;
class TopoDS_Face;
class Geom2d_Curve;
class Geom2dAdaptor_HCurve;
//! Auxiliary class implements functionality retrieving tessellated
//! representation of an edge stored in polygon.
@@ -40,7 +40,7 @@ public:
//! Initializes extractor.
BRepMesh_EdgeTessellationExtractor(
const TopoDS_Edge& theEdge,
const Handle(Geom2d_Curve)& thePCurve,
const Handle(Geom2dAdaptor_HCurve)& thePCurve,
const TopoDS_Face& theFace,
const Handle(Poly_Triangulation)& theTriangulation,
const Handle(Poly_PolygonOnTriangulation)& thePolygon,
@@ -76,7 +76,7 @@ private:
private:
BRepMesh_EdgeParameterProvider myProvider;
const Handle(Geom2d_Curve)& myPCurve;
Handle(Geom2dAdaptor_HCurve) myPCurve;
const TColgp_Array1OfPnt& myNodes;
const TColStd_Array1OfInteger& myIndices;
const TopLoc_Location myLoc;

View File

@@ -17,6 +17,7 @@
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <BRepAdaptor_HSurface.hxx>
@@ -66,9 +67,11 @@ BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(
const GeomAbs_CurveType aCurveType = myCOnS.GetType();
Standard_Integer aMinPntNb = (aCurveType == GeomAbs_Circle) ? 4 : 2; //OCC287
// Get range on 2d curve
// Get 2d curve and init geom tool
Standard_Real aFirstParam, aLastParam;
BRep_Tool::Range(theEdge, theFaceAttribute->Face(), aFirstParam, aLastParam);
Handle(Geom2d_Curve) aCurve2d =
BRep_Tool::CurveOnSurface(theEdge, theFaceAttribute->Face(), aFirstParam, aLastParam);
myCurve2d.Load(aCurve2d, aFirstParam, aLastParam);
myTool = new BRepMesh_GeomTool(myCOnS, aFirstParam, aLastParam,
aPreciseLinDef, aPreciseAngDef, aMinPntNb, theMinSize);
@@ -94,7 +97,9 @@ BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(
Standard_Real aParam;
gp_Pnt aPoint3d;
gp_Pnt2d aPoint2d;
aDetalizator.Value( aNodeIt, mySurface, aParam, aPoint3d, aPoint2d );
aDetalizator.Value( aNodeIt, aParam, aPoint3d);
myCurve2d.D0(aParam, aPoint2d);
myTool->AddPoint( aPoint3d, aParam, Standard_False );
}
}
@@ -122,11 +127,10 @@ BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(
TopTools_ListIteratorOfListOfShape aFaceIt(aSharedFaces);
for (; aFaceIt.More(); aFaceIt.Next())
{
TopLoc_Location aLoc;
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Value());
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc);
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Value());
BRepAdaptor_Surface aSurf(aFace, Standard_False);
if (aSurf->IsInstance(STANDARD_TYPE(Geom_Plane)))
if (aSurf.GetType() == GeomAbs_Plane)
continue;
Standard_Real aF, aL;
@@ -136,20 +140,20 @@ BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(
{
continue;
}
Geom2dAdaptor_Curve aGACurve(aCurve2d, aF, aL);
aNodesNb = myTool->NbPoints();
TColStd_Array1OfReal aParamArray(1, aNodesNb);
for (Standard_Integer i = 1; i <= aNodesNb; ++i)
{
gp_Pnt2d aTmpUV;
gp_Pnt aTmpPnt;
Standard_Real aParam;
myTool->Value(i, mySurface, aParam, aTmpPnt, aTmpUV);
myTool->Value(i, aParam, aTmpPnt);
aParamArray.SetValue(i, aParam);
}
for (Standard_Integer i = 1; i < aNodesNb; ++i)
splitSegment(aSurf, aCurve2d, aParamArray(i), aParamArray(i + 1), 1);
splitSegment(aSurf, aGACurve, aParamArray(i), aParamArray(i + 1), 1);
}
}
@@ -174,7 +178,8 @@ Standard_Boolean BRepMesh_EdgeTessellator::Value(
gp_Pnt& thePoint,
gp_Pnt2d& theUV)
{
myTool->Value(theIndex, mySurface, theParameter, thePoint, theUV);
myTool->Value(theIndex, theParameter, thePoint);
myCurve2d.D0(theParameter, theUV);
// If point coordinates are out of surface range,
// it is necessary to re-project point.
@@ -207,8 +212,8 @@ Standard_Boolean BRepMesh_EdgeTessellator::Value(
//purpose :
//=======================================================================
void BRepMesh_EdgeTessellator::splitSegment(
const Handle(Geom_Surface)& theSurf,
const Handle(Geom2d_Curve)& theCurve2d,
const Adaptor3d_Surface& theSurf,
const Geom2dAdaptor_Curve& theCurve2d,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Integer theNbIter)
@@ -224,17 +229,17 @@ void BRepMesh_EdgeTessellator::splitSegment(
if(Abs(theLast - theFirst) < 2 * Precision::PConfusion())
return;
theCurve2d->D0(theFirst, uvf);
theCurve2d->D0(theLast, uvl);
theCurve2d.D0(theFirst, uvf);
theCurve2d.D0(theLast, uvl);
P3dF = theSurf->Value(uvf.X(), uvf.Y());
P3dL = theSurf->Value(uvl.X(), uvl.Y());
P3dF = theSurf.Value(uvf.X(), uvf.Y());
P3dL = theSurf.Value(uvl.X(), uvl.Y());
if(P3dF.SquareDistance(P3dL) < mySquareMinSize)
return;
uvm = gp_Pnt2d((uvf.XY() + uvl.XY())*0.5);
midP3dFromSurf = theSurf->Value(uvm.X(), uvm.Y());
midP3dFromSurf = theSurf.Value(uvm.X(), uvm.Y());
gp_XYZ Vec1 = midP3dFromSurf.XYZ() - P3dF.XYZ();
if(Vec1.SquareModulus() < mySquareMinSize)

View File

@@ -23,10 +23,10 @@
#include <BRepMesh_GeomTool.hxx>
#include <BRepMesh_FaceAttribute.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class Geom_Surface;
class Geom2d_Curve;
class Adaptor3d_Surface;
class TopoDS_Edge;
class BRepAdaptor_HSurface;
@@ -70,8 +70,8 @@ public:
private:
//!
void splitSegment(const Handle(Geom_Surface)& theSurf,
const Handle(Geom2d_Curve)& theCurve2d,
void splitSegment(const Adaptor3d_Surface& theSurf,
const Geom2dAdaptor_Curve& theCurve2d,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Integer theNbIter);
@@ -80,6 +80,7 @@ private:
NCollection_Handle<BRepMesh_GeomTool> myTool;
Handle(BRepAdaptor_HSurface) mySurface;
BRepAdaptor_Curve myCOnS;
Geom2dAdaptor_Curve myCurve2d;
Standard_Real mySquareEdgeDef;
Standard_Real mySquareMinSize;
Standard_Real myEdgeSqTol;

View File

@@ -41,6 +41,7 @@
#include <Precision.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <GeomAbs_SurfaceType.hxx>
@@ -205,7 +206,10 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
Standard_Real defface = 0.;
if (!myParameters.Relative)
{
defedge = Max(UVDEFLECTION, defedge);
defface = Max(myParameters.Deflection, maxdef);
}
const TopoDS_Face& aFace = myAttribute->Face();
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
@@ -215,9 +219,9 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
if (aEdge.IsNull())
continue;
if (!myMapdefle.IsBound(aEdge))
if (myParameters.Relative)
{
if (myParameters.Relative)
if (!myMapdefle.IsBound(aEdge))
{
if (myEdges.IsBound(aEdge))
{
@@ -232,26 +236,26 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
myParameters.Angle = savangle * cdef;
}
defface += defedge;
defface = Max(maxdef, defface);
}
else
{
defedge = myParameters.Deflection;
defedge = myMapdefle(aEdge);
}
defedge = Max(maxdef, defedge);
defedge = Max(UVDEFLECTION, defedge);
myMapdefle.Bind(aEdge, defedge);
defface += defedge;
defface = Max(maxdef, defface);
if (!myMapdefle.IsBound(aEdge))
{
defedge = Max(UVDEFLECTION, defedge);
myMapdefle.Bind(aEdge, defedge);
}
}
else
{
defedge = myMapdefle(aEdge);
if ( myParameters.Relative )
if (!myMapdefle.IsBound(aEdge))
{
defface += defedge;
defface = Max(maxdef, defface);
myMapdefle.Bind(aEdge, defedge);
}
}
@@ -261,8 +265,8 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
if (aCurve2d.IsNull())
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
Handle(Geom2dAdaptor_HCurve) aPCurve =
new Geom2dAdaptor_HCurve(aCurve2d, aFirstParam, aLastParam);
add(aEdge, aPCurve, defedge);
myParameters.Angle = savangle;
@@ -418,7 +422,8 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
if (aCurve2d.IsNull())
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
Handle(Geom2dAdaptor_HCurve) aPCurve =
new Geom2dAdaptor_HCurve(aCurve2d, aFirstParam, aLastParam);
add(anEdge, aPCurve, defedge);
}
}
@@ -590,7 +595,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
//=======================================================================
Standard_Boolean BRepMesh_FastDiscret::getEdgeAttributes(
const TopoDS_Edge& theEdge,
const BRepMesh_FastDiscret::EdgePCurve& thePCurve,
const Handle(Geom2dAdaptor_HCurve)& thePCurve,
const Standard_Real theDefEdge,
BRepMesh_FastDiscret::EdgeAttributes& theAttributes) const
{
@@ -610,35 +615,34 @@ Standard_Boolean BRepMesh_FastDiscret::getEdgeAttributes(
aEAttr.IsSameUV =
aEAttr.FirstUV.IsEqual(aEAttr.LastUV, Precision::PConfusion());
//Control tolerance of vertices
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
gp_Pnt pFirst = gFace->Value(aEAttr.FirstUV.X(), aEAttr.FirstUV.Y());
gp_Pnt pLast = gFace->Value(aEAttr.LastUV.X(), aEAttr.LastUV.Y());
aEAttr.MinDist = 10. * Max(pFirst.Distance(BRep_Tool::Pnt(aEAttr.FirstVertex)),
pLast .Distance(BRep_Tool::Pnt(aEAttr.LastVertex)));
if (aEAttr.MinDist < BRep_Tool::Tolerance(aEAttr.FirstVertex) ||
aEAttr.MinDist < BRep_Tool::Tolerance(aEAttr.LastVertex))
{
aEAttr.MinDist = theDefEdge;
}
if (aEAttr.IsSameUV)
{
// 1. is it really sameUV without being degenerated
gp_Pnt2d uvF, uvL;
thePCurve.Curve2d->D0(thePCurve.FirstParam, uvF);
thePCurve.Curve2d->D0(thePCurve.LastParam, uvL);
thePCurve->D0(thePCurve->FirstParameter(), uvF);
thePCurve->D0(thePCurve->LastParameter(), uvL);
if (!aEAttr.FirstUV.IsEqual(uvF, Precision::PConfusion()))
aEAttr.FirstUV = uvF;
if (!aEAttr.LastUV.IsEqual(uvL, Precision::PConfusion()))
aEAttr.LastUV = uvL;
aEAttr.IsSameUV =
aEAttr.FirstUV.IsEqual(aEAttr.LastUV, Precision::PConfusion());
}
//Control tolerance of vertices
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
gp_Pnt pFirst = gFace->Value(aEAttr.FirstUV.X(), aEAttr.FirstUV.Y());
gp_Pnt pLast = gFace->Value(aEAttr.LastUV.X(), aEAttr.LastUV.Y());
Standard_Real aSqDist = pFirst.SquareDistance(BRep_Tool::Pnt(aEAttr.FirstVertex));
aSqDist = Max(aSqDist, pLast.SquareDistance(BRep_Tool::Pnt(aEAttr.LastVertex)));
aEAttr.Deflection = Max(theDefEdge, BRep_Tool::Tolerance(theEdge));
aEAttr.Deflection = Max(aEAttr.Deflection, sqrt(aSqDist));
return Standard_True;
}
@@ -670,21 +674,30 @@ void BRepMesh_FastDiscret::registerEdgeVertices(
new TopoDSVExplorer(aEAttr.LastVertex, aEAttr.IsSameUV, aEAttr.FirstVertex);
}
gp_XY aTmpUV;
// Process first vertex
ipf = myAttribute->GetVertexIndex(aEAttr.FirstVExtractor, Standard_True);
aTmpUV = BRepMesh_ShapeTool::FindUV(ipf, aEAttr.FirstUV, aEAttr.FirstVertex,
aEAttr.MinDist, myAttribute);
Standard_Real aMinDist = 2. * BRep_Tool::Tolerance(aEAttr.FirstVertex);
gp_XY aTmpUV1 = BRepMesh_ShapeTool::FindUV(ipf, aEAttr.FirstUV, aMinDist, myAttribute);
myAttribute->AddNode(ipf, aTmpUV, BRepMesh_Frontier, ivf, isvf);
myAttribute->AddNode(ipf, aTmpUV1, BRepMesh_Frontier, ivf, isvf);
// Process last vertex
ipl = aEAttr.LastVertex.IsSame(aEAttr.FirstVertex) ? ipf :
myAttribute->GetVertexIndex(aEAttr.LastVExtractor, Standard_True);
aTmpUV = BRepMesh_ShapeTool::FindUV(ipl, aEAttr.LastUV, aEAttr.LastVertex,
aEAttr.MinDist, myAttribute);
aMinDist = 2. * BRep_Tool::Tolerance(aEAttr.LastVertex);
gp_XY aTmpUV2 = BRepMesh_ShapeTool::FindUV(ipl, aEAttr.LastUV, aMinDist, myAttribute);
myAttribute->AddNode(ipl, aTmpUV, BRepMesh_Frontier, ivl, isvl);
myAttribute->AddNode(ipl, aTmpUV2, BRepMesh_Frontier, ivl, isvl);
// Update edge deflection
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
gp_Pnt aPntE1 = gFace->Value(aEAttr.FirstUV.X(), aEAttr.FirstUV.Y());
gp_Pnt aPntFound1 = gFace->Value(aTmpUV1.X(), aTmpUV1.Y());
Standard_Real aSqDist = aPntE1.SquareDistance(aPntFound1);
gp_Pnt aPntE2 = gFace->Value(aEAttr.LastUV.X(), aEAttr.LastUV.Y());
gp_Pnt aPntFound2 = gFace->Value(aTmpUV2.X(), aTmpUV2.Y());
aSqDist = Max(aSqDist, aPntE2.SquareDistance(aPntFound2));
aEAttr.Deflection = Max(aEAttr.Deflection, sqrt(aSqDist));
}
//=======================================================================
@@ -693,7 +706,7 @@ void BRepMesh_FastDiscret::registerEdgeVertices(
//=======================================================================
void BRepMesh_FastDiscret::add(
const TopoDS_Edge& theEdge,
const BRepMesh_FastDiscret::EdgePCurve& thePCurve,
const Handle(Geom2dAdaptor_HCurve)& thePCurve,
const Standard_Real theDefEdge)
{
const TopAbs_Orientation orEdge = theEdge.Orientation();
@@ -706,7 +719,7 @@ void BRepMesh_FastDiscret::add(
if (!myEdges.IsBound(theEdge))
{
update(theEdge, thePCurve.Curve2d, theDefEdge, aEAttr);
update(theEdge, thePCurve, theDefEdge, aEAttr);
return;
}
@@ -743,7 +756,7 @@ void BRepMesh_FastDiscret::add(
const gp_Pnt& aPnt = myBoundaryPoints->Find(aPointId);
const Standard_Real aParam = aProvider.Parameter(i, aPnt);
gp_Pnt2d aUV = thePCurve.Curve2d->Value(aParam);
gp_Pnt2d aUV = thePCurve->Value(aParam);
Standard_Integer iv2, isv;
myAttribute->AddNode(aPointId, aUV.Coord(), BRepMesh_OnCurve, iv2, isv);
@@ -756,7 +769,7 @@ void BRepMesh_FastDiscret::add(
Handle(Poly_PolygonOnTriangulation) P1 =
new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
storePolygon(theEdge, P1, theDefEdge);
storePolygon(theEdge, P1, aEAttr.Deflection);
}
//=======================================================================
@@ -765,7 +778,7 @@ void BRepMesh_FastDiscret::add(
//=======================================================================
void BRepMesh_FastDiscret::update(
const TopoDS_Edge& theEdge,
const Handle(Geom2d_Curve)& theC2d,
const Handle(Geom2dAdaptor_HCurve)& theC2d,
const Standard_Real theDefEdge,
BRepMesh_FastDiscret::EdgeAttributes& theAttributes)
{
@@ -885,8 +898,8 @@ void BRepMesh_FastDiscret::update(
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
}
storePolygon(theEdge, P1, theDefEdge);
storePolygonSharedData(theEdge, P2, theDefEdge);
storePolygon(theEdge, P1, aEAttr.Deflection);
storePolygonSharedData(theEdge, P2, aEAttr.Deflection);
}
//=======================================================================

View File

@@ -40,8 +40,8 @@ class Bnd_Box;
class TopoDS_Shape;
class TopoDS_Face;
class TopoDS_Edge;
class Geom2dAdaptor_HCurve;
class BRepAdaptor_HSurface;
class Geom2d_Curve;
class BRepMesh_Edge;
class BRepMesh_Vertex;
class gp_Pnt;
@@ -273,27 +273,18 @@ private:
gp_Pnt2d FirstUV;
gp_Pnt2d LastUV;
Standard_Real Deflection;
Standard_Boolean IsSameUV;
Standard_Real MinDist;
NCollection_Handle<TopoDSVExplorer> FirstVExtractor;
NCollection_Handle<TopoDSVExplorer> LastVExtractor;
};
//! Structure keeps geometrical parameters of edge's PCurve.
//! Used for caching.
struct EdgePCurve
{
Handle(Geom2d_Curve) Curve2d;
Standard_Real FirstParam;
Standard_Real LastParam;
};
//! Fills structure of by attributes of the given edge.
//! @return TRUE on success, FALSE elsewhere.
Standard_Boolean getEdgeAttributes(
const TopoDS_Edge& theEdge,
const EdgePCurve& thePCurve,
const Handle(Geom2dAdaptor_HCurve)& thePCurve,
const Standard_Real theDefEdge,
EdgeAttributes& theAttributes) const;
@@ -311,7 +302,7 @@ private:
//! Adds tessellated representation of the given edge to
//! mesh data structure of currently processed face.
void add(const TopoDS_Edge& theEdge,
const EdgePCurve& theCurve2D,
const Handle(Geom2dAdaptor_HCurve)& theCurve2D,
const Standard_Real theEdgeDeflection);
//! Updates tessellated representation of the given edge.
@@ -320,7 +311,7 @@ private:
//! Computes tessellation using edge's geometry elsewhere.
void update(
const TopoDS_Edge& theEdge,
const Handle(Geom2d_Curve)& theCurve2D,
const Handle(Geom2dAdaptor_HCurve)& theCurve2D,
const Standard_Real theEdgeDeflection,
EdgeAttributes& theAttributes);

View File

@@ -56,6 +56,11 @@
#include <algorithm>
//#define DEBUG_MESH "mesh.tcl"
#ifdef DEBUG_MESH
#include <fstream>
#endif
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscretFace,Standard_Transient)
@@ -393,27 +398,28 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
Standard_Real aDef = -1;
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
{
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::ListOfVertex aNewVertices(anAlloc);
if (!rajout)
{
aDef = control(aNewVertices, trigu, Standard_True);
// compute maximal deflection
aDef = control(trigu, Standard_True);
rajout = (aDef > myAttribute->GetDefFace() || aDef < 0.);
}
if (!rajout && useUVParam)
if (thetype != GeomAbs_Plane)
{
rajout = (myVParam.Extent() > 2 &&
(gFace->IsUClosed() || gFace->IsVClosed()));
}
if (!rajout && useUVParam)
{
rajout = (myVParam.Extent() > 2 &&
(gFace->IsUClosed() || gFace->IsVClosed()));
}
if (rajout)
{
insertInternalVertices(aNewVertices, trigu);
if (rajout)
{
insertInternalVertices(trigu);
//control internal points
if (myIsControlSurfaceDeflection)
aDef = control(aNewVertices, trigu, Standard_False);
//control internal points
if (myIsControlSurfaceDeflection)
aDef = control(trigu, Standard_False);
}
}
}
@@ -455,7 +461,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::addVerticesToMesh(
}
//=======================================================================
//function : insertInternalVertices
//function : filterParameters
//purpose :
//=======================================================================
static void filterParameters(const BRepMesh::IMapOfReal& theParams,
@@ -516,35 +522,39 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
theResult.Append(aParamArray(aParamLength));
}
void BRepMesh_FastDiscretFace::insertInternalVertices(
BRepMesh::ListOfVertex& theNewVertices,
BRepMesh_Delaun& theMeshBuilder)
//=======================================================================
//function : insertInternalVertices
//purpose :
//=======================================================================
void BRepMesh_FastDiscretFace::insertInternalVertices(BRepMesh_Delaun& theMeshBuilder)
{
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::ListOfVertex aNewVertices(anAlloc);
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
switch (gFace->GetType())
{
case GeomAbs_Sphere:
insertInternalVerticesSphere(theNewVertices);
break;
insertInternalVerticesSphere(aNewVertices);
break;
case GeomAbs_Cylinder:
insertInternalVerticesCylinder(theNewVertices);
break;
insertInternalVerticesCylinder(aNewVertices);
break;
case GeomAbs_Cone:
insertInternalVerticesCone(theNewVertices);
insertInternalVerticesCone(aNewVertices);
break;
case GeomAbs_Torus:
insertInternalVerticesTorus(theNewVertices);
insertInternalVerticesTorus(aNewVertices);
break;
default:
insertInternalVerticesOther(theNewVertices);
insertInternalVerticesOther(aNewVertices);
break;
}
addVerticesToMesh(theNewVertices, theMeshBuilder);
addVerticesToMesh(aNewVertices, theMeshBuilder);
}
//=======================================================================
@@ -856,41 +866,119 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
// check intermediate isolines
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
// precision for compare square distances
const Standard_Real aPrecision = Precision::Confusion();
// insert additional points where it is needed to conform criteria.
// precision for normals calculation
const Standard_Real aNormPrec = Precision::Confusion();
for (Standard_Integer k = 0; k < 2; ++k)
{
const Standard_Integer aOtherIndex = (k + 1) % 2;
BRepMesh::SequenceOfReal& aParams1 = aParams[k];
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherIndex];
const Standard_Boolean isU = (k == 0);
Standard_Integer aStartIndex, aEndIndex;
if (isU)
for (Standard_Integer i = 2; i < aParams1.Length(); ++i)
{
aStartIndex = 1;
aEndIndex = aParams1.Length();
}
else
{
aStartIndex = 2;
aEndIndex = aParams1.Length() - 1;
}
const Standard_Real aParam1 = aParams1(i);
GeomAdaptor_Curve aIso(isU ?
aSurface->UIso(aParam1) : aSurface->VIso(aParam1));
Standard_Real aPrevParam2 = aParams2(1);
gp_Pnt aPrevPnt2;
gp_Vec aPrevVec2;
aIso.D1(aPrevParam2, aPrevPnt2, aPrevVec2);
for (Standard_Integer j = 2; j <= aParams2.Length();)
{
Standard_Real aParam2 = aParams2(j);
gp_Pnt aPnt2;
gp_Vec aVec2;
aIso.D1(aParam2, aPnt2, aVec2);
Standard_Real aMidParam = 0.5 * (aPrevParam2 + aParam2);
gp_Pnt aMidPnt = aIso.Value(aMidParam);
Standard_Real aDist = deflectionOfSegment(aPrevPnt2, aPnt2, aMidPnt);
if (aDist > aDefFace && aDist > myMinSize)
{
// insertion
aParams2.InsertBefore(j, aMidParam);
continue;
}
//put regular grig for normals
gp_Pnt2d aStPnt1, aStPnt2;
if (isU)
{
aStPnt1 = gp_Pnt2d(aParam1, aPrevParam2);
aStPnt2 = gp_Pnt2d(aParam1, aMidParam);
}
else
{
aStPnt1 = gp_Pnt2d(aPrevParam2, aParam1);
aStPnt2 = gp_Pnt2d(aMidParam, aParam1);
}
gp_Dir N1(0, 0, 1), N2(0, 0, 1);
Standard_Integer aSt1 = GeomLib::NormEstim(aSurface, aStPnt1, aNormPrec, N1);
Standard_Integer aSt2 = GeomLib::NormEstim(aSurface, aStPnt2, aNormPrec, N2);
const Standard_Real aAngle = N2.Angle(N1);
if (aSt1 < 1 && aSt2 < 1 && aAngle > myAngle)
{
const Standard_Real aLen = GCPnts_AbscissaPoint::Length(
aIso, aPrevParam2, aMidParam, aDefFace);
if (aLen > myMinSize)
{
// insertion
aParams2.InsertBefore(j, aMidParam);
continue;
}
}
aPrevParam2 = aParam2;
aPrevPnt2 = aPnt2;
aPrevVec2 = aVec2;
++j;
}
}
}
#ifdef DEBUG_InsertInternal
// output numbers of parameters along U and V
cout << "aParams: " << aParams[0].Length() << " " << aParams[1].Length() << endl;
#endif
// try to reduce number of points evaluating of isolines sampling
for (Standard_Integer k = 0; k < 2; ++k)
{
const Standard_Integer aOtherIndex = (k + 1) % 2;
BRepMesh::SequenceOfReal& aParams1 = aParams[k];
BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherIndex];
const Standard_Boolean isU = (k == 0);
BRepMesh::MapOfReal& aToRemove2 = aParamsToRemove[aOtherIndex];
BRepMesh::MapOfReal& aForbiddenToRemove1 = aParamsForbiddenToRemove[k];
BRepMesh::MapOfReal& aForbiddenToRemove2 = aParamsForbiddenToRemove[aOtherIndex];
for (Standard_Integer i = aStartIndex; i <= aEndIndex; ++i)
for (Standard_Integer i = 2; i < aParams1.Length(); ++i)
{
const Standard_Real aParam1 = aParams1(i);
GeomAdaptor_Curve aIso(isU ?
aSurface->UIso (aParam1) : aSurface->VIso (aParam1));
#ifdef DEBUG_InsertInternal
// write polyline containing initial parameters to the file
{
ofstream ff(DEBUG_InsertInternal, std::ios_base::app);
ff << "polyline " << (k == 0 ? "u" : "v") << i << " ";
for (Standard_Integer j = 1; j <= aParams2.Length(); j++)
{
gp_Pnt aP;
aIso.D0(aParams2(j), aP);
ff << aP.X() << " " << aP.Y() << " " << aP.Z() << " ";
}
ff << endl;
}
#endif
Standard_Real aPrevParam2 = aParams2(1);
gp_Pnt aPrevPnt2;
@@ -903,115 +991,114 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
gp_Vec aVec2;
aIso.D1 (aParam2, aPnt2, aVec2);
Standard_Real aMidParam = 0.5 * (aPrevParam2 + aParam2);
gp_Pnt aMidPnt = aIso.Value(aMidParam);
Standard_Real aDist = deflectionOfSegment (aPrevPnt2, aPnt2, aMidPnt);
if (aDist > aDefFace && aDist > myMinSize)
// Here we should leave at least 3 parameters as far as
// we must have at least one parameter related to surface
// internals in order to prevent movement of triangle body
// outside the surface in case of highly curved ones, e.g.
// BSpline springs.
if (aParams2.Length() > 3 && j < aParams2.Length())
{
// insertion
aParams2.InsertBefore(j, aMidParam);
}
else
{
//put regular grig for normals
gp_Pnt2d aStPnt1, aStPnt2;
if (isU)
{
aStPnt1 = gp_Pnt2d(aParam1, aPrevParam2);
aStPnt2 = gp_Pnt2d(aParam1, aMidParam);
}
else
{
aStPnt1 = gp_Pnt2d(aPrevParam2, aParam1);
aStPnt2 = gp_Pnt2d(aMidParam, aParam1);
}
// Remove too dense points
const Standard_Real aNextParam = aParams2(j + 1);
gp_Pnt aNextPnt;
gp_Vec aNextVec;
aIso.D1(aNextParam, aNextPnt, aNextVec);
gp_Dir N1(0, 0, 1), N2(0, 0, 1);
Standard_Boolean aSt1 = GeomLib::NormEstim (aSurface, aStPnt1, aPrecision, N1);
Standard_Boolean aSt2 = GeomLib::NormEstim (aSurface, aStPnt2, aPrecision, N2);
const Standard_Real aAngle = N2.Angle(N1);
if (aSt1 < 1 && aSt2 < 1 && aAngle > myAngle)
// Lets check current parameter.
// If it fits deflection, we can remove it.
Standard_Real aDist = deflectionOfSegment(aPrevPnt2, aNextPnt, aPnt2);
if (aDist < aDefFace)
{
const Standard_Real aLen = GCPnts_AbscissaPoint::Length (
aIso, aPrevParam2, aMidParam, aDefFace);
if (aLen > myMinSize)
// Lets check parameters for angular deflection.
if (aPrevVec2.Angle(aNextVec) < myAngle)
{
// insertion
aParams2.InsertBefore(j, aMidParam);
// For current Iso line we can remove this parameter.
#ifdef DEBUG_InsertInternal
// write point of removed parameter
{
ofstream ff(DEBUG_InsertInternal, std::ios_base::app);
ff << "point " << (k == 0 ? "u" : "v") << i << "r_" << j << " "
<< aPnt2.X() << " " << aPnt2.Y() << " " << aPnt2.Z() << endl;
}
#endif
aToRemove2.Add(aParam2);
aPrevParam2 = aNextParam;
aPrevPnt2 = aNextPnt;
aPrevVec2 = aNextVec;
j += 2;
continue;
}
}
// Here we should leave at least 3 parameters as far as
// we must have at least one parameter related to surface
// internals in order to prevent movement of triangle body
// outside the surface in case of highly curved ones, e.g.
// BSpline springs.
if (aDist < aDefFace &&
aParams2.Length () > 3 &&
j < aParams2.Length ())
{
// Remove too dense points
const Standard_Real aTmpParam = aParams2 (j + 1);
gp_Pnt aTmpPnt;
gp_Vec aTmpVec;
aIso.D1 (aTmpParam, aTmpPnt, aTmpVec);
Standard_Real aTmpMidParam = 0.5 * (aPrevParam2 + aTmpParam);
gp_Pnt aTmpMidPnt = aIso.Value (aTmpMidParam);
// Lets check next parameter.
// If it also fits deflection, we can remove previous parameter.
aDist = deflectionOfSegment (aPrevPnt2, aTmpPnt, aTmpMidPnt);
if (aDist < aDefFace)
{
// Lets check parameters for angular deflection.
if (aPrevVec2.SquareMagnitude() < gp::Resolution() ||
aTmpVec.SquareMagnitude() < gp::Resolution() ||
aPrevVec2.Angle (aTmpVec) < myAngle)
else {
// We have found a place on the surface refusing
// removement of this parameter.
#ifdef DEBUG_InsertInternal
// write point of forbidden to remove parameter
{
// For current Iso line we can remove this parameter.
aToRemove2.Add (aParam2);
aParam2 = aTmpParam;
aPnt2 = aTmpPnt;
aVec2 = aTmpVec;
++j;
}
else {
// We have found a place on the surface refusing
// removement of this parameter.
aForbiddenToRemove1.Add (aParam1);
aForbiddenToRemove2.Add (aParam2);
ofstream ff(DEBUG_InsertInternal, std::ios_base::app);
ff << "vertex " << (k == 0 ? "u" : "v") << i << "f_" << j << " "
<< aPnt2.X() << " " << aPnt2.Y() << " " << aPnt2.Z() << endl;
}
#endif
aForbiddenToRemove1.Add(aParam1);
aForbiddenToRemove2.Add(aParam2);
}
}
aPrevParam2 = aParam2;
aPrevPnt2 = aPnt2;
aPrevVec2 = aVec2;
++j;
}
aPrevParam2 = aParam2;
aPrevPnt2 = aPnt2;
aPrevVec2 = aVec2;
++j;
}
}
}
// remove filtered out parameters
for (Standard_Integer k = 0; k < 2; ++k)
{
BRepMesh::SequenceOfReal& aParamsk = aParams[k];
for (Standard_Integer i = 1; i <= aParamsk.Length();)
{
const Standard_Real aParam = aParamsk.Value(i);
if (aParamsToRemove[k].Contains(aParam) &&
!aParamsForbiddenToRemove[k].Contains(aParam))
{
aParamsk.Remove(i);
}
else
i++;
}
}
#ifdef DEBUG_InsertInternal
// write polylines containing remaining parameters
{
ofstream ff(DEBUG_InsertInternal, std::ios_base::app);
for (Standard_Integer k = 0; k < 2; ++k)
{
for (Standard_Integer i = 1; i <= aParams[k].Length(); i++)
{
ff << "polyline " << (k == 0 ? "uo" : "vo") << i << " ";
for (Standard_Integer j = 1; j <= aParams[1 - k].Length(); j++)
{
gp_Pnt aP;
if (k == 0)
gFace->D0(aParams[k](i), aParams[1 - k](j), aP);
else
gFace->D0(aParams[1 - k](j), aParams[k](i), aP);
ff << aP.X() << " " << aP.Y() << " " << aP.Z() << " ";
}
ff << endl;
}
}
}
#endif
// insert nodes of the regular grid
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
for (Standard_Integer i = 1; i <= aParams[0].Length(); ++i)
{
const Standard_Real aParam1 = aParams[0].Value (i);
if (aParamsToRemove[0].Contains (aParam1) && !aParamsForbiddenToRemove[0].Contains (aParam1))
continue;
for (Standard_Integer j = 1; j <= aParams[1].Length(); ++j)
{
const Standard_Real aParam2 = aParams[1].Value (j);
if (aParamsToRemove[1].Contains (aParam2) && !aParamsForbiddenToRemove[1].Contains (aParam2))
continue;
gp_Pnt2d aPnt2d(aParam1, aParam2);
// Classify intersection point
@@ -1091,7 +1178,6 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
//purpose :
//=======================================================================
Standard_Real BRepMesh_FastDiscretFace::control(
BRepMesh::ListOfVertex& theNewVertices,
BRepMesh_Delaun& theTrigu,
const Standard_Boolean theIsFirst)
{
@@ -1115,7 +1201,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
NCollection_Map<BRepMesh_Edge> aCouples(3 * aTrianglesNb, anAlloc);
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
// Perform refinement passes
@@ -1131,7 +1217,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
{
aTempAlloc->Reset(Standard_False);
theNewVertices.Clear();
BRepMesh::ListOfVertex aNewVertices(aTempAlloc);
// Reset stop condition
aInsertedNb = 0;
@@ -1206,7 +1292,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
aSqDef *= aSqDef;
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
aSqDef, aSqDefFace, aCircles, aNewVertices, aMaxSqDef, aTempAlloc);
if (isSkipped)
break;
@@ -1217,30 +1303,18 @@ Standard_Real BRepMesh_FastDiscretFace::control(
if (m[i]) // is a boundary
continue;
Standard_Integer j = (i + 1) % 3;
// Check if this link was already processed
Standard_Integer aFirstVertex, aLastVertex;
if (v[i] < v[j])
{
aFirstVertex = v[i];
aLastVertex = v[j];
}
else
{
aFirstVertex = v[j];
aLastVertex = v[i];
}
if (aCouples.Add(BRepMesh_OrientedEdge(aFirstVertex, aLastVertex)))
if (aCouples.Add(myStructure->GetLink(e[i])))
{
// Check deflection on edge 1
Standard_Integer j = (i + 1) % 3;
gp_XY mi2d = (xy[i] + xy[j]) * 0.5;
gFace->D0(mi2d.X(), mi2d.Y(), pDef);
gp_Lin aLin(p[i], gp_Vec(p[i], p[j]));
aSqDef = aLin.SquareDistance(pDef);
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
aSqDef, aSqDefFace, aCircles, aNewVertices, aMaxSqDef, aTempAlloc);
}
}
@@ -1286,7 +1360,43 @@ Standard_Real BRepMesh_FastDiscretFace::control(
if (theIsFirst)
continue;
if (addVerticesToMesh(theNewVertices, theTrigu))
#ifdef DEBUG_MESH
// append to the file triangles in the form of polyline commands;
// so the file can be sourced in draw to analyze triangles on each pass of the algorithm.
// write triangles
ofstream ftt(DEBUG_MESH, std::ios_base::app);
Standard_Integer nbElem = myStructure->NbElements();
for (Standard_Integer i = 1; i <= nbElem; i++)
{
const BRepMesh_Triangle& aTri = myStructure->GetElement(i);
if (aTri.Movability() == BRepMesh_Deleted)
continue;
Standard_Integer n[3];
myStructure->ElementNodes(aTri, n);
const BRepMesh_Vertex& aV1 = myStructure->GetNode(n[0]);
const BRepMesh_Vertex& aV2 = myStructure->GetNode(n[1]);
const BRepMesh_Vertex& aV3 = myStructure->GetNode(n[2]);
const gp_Pnt& aP1 = myAttribute->GetPoint(aV1);
const gp_Pnt& aP2 = myAttribute->GetPoint(aV2);
const gp_Pnt& aP3 = myAttribute->GetPoint(aV3);
ftt << "polyline t" << aPass << "_" << i << " "
<< aP1.X() << " " << aP1.Y() << " " << aP1.Z() << " "
<< aP2.X() << " " << aP2.Y() << " " << aP2.Z() << " "
<< aP3.X() << " " << aP3.Y() << " " << aP3.Z() << " "
<< aP1.X() << " " << aP1.Y() << " " << aP1.Z() << endl;
}
// write points to insert on the current pass
BRepMesh::ListOfVertex::Iterator it(aNewVertices);
for (Standard_Integer i=1; it.More(); it.Next(), i++)
{
const BRepMesh_Vertex& aVertex = it.Value();
const gp_Pnt& aP = myAttribute->GetPoint(aVertex);
ftt << "vertex vt" << aPass << "_" << i << " "
<< aP.X() << " " << aP.Y() << " " << aP.Z() << endl;
}
#endif
if (addVerticesToMesh(aNewVertices, theTrigu))
++aInsertedNb;
}
@@ -1314,7 +1424,7 @@ void BRepMesh_FastDiscretFace::add(const TopoDS_Vertex& theVertex)
NCollection_Handle<FixedVExplorer> aFixedVExplorer = new FixedVExplorer(theVertex);
Standard_Integer aIndex = myAttribute->GetVertexIndex(aFixedVExplorer);
gp_XY anUV = BRepMesh_ShapeTool::FindUV(aIndex, aPnt2d,
theVertex, BRep_Tool::Tolerance(theVertex), myAttribute);
BRep_Tool::Tolerance(theVertex), myAttribute);
Standard_Integer aTmpId1, aTmpId2;
anUV = myAttribute->Scale(anUV, Standard_True);

View File

@@ -69,8 +69,7 @@ private:
void add(const Handle(BRepMesh_FaceAttribute)& theAttribute);
void add(const TopoDS_Vertex& theVertex);
Standard_Real control(BRepMesh::ListOfVertex& theNewVertices,
BRepMesh_Delaun& theMeshBuilder,
Standard_Real control(BRepMesh_Delaun& theMeshBuilder,
const Standard_Boolean theIsFirst);
//! Registers the given nodes in mesh data structure and
@@ -84,11 +83,9 @@ private:
BRepMesh_Delaun& theMeshBuilder);
//! Calculates nodes lying on face's surface and inserts them to a mesh.
//! @param theNewVertices list of vertices to be extended and added to mesh.
//! @param theMeshBuilder initialized tool refining mesh
//! in respect to inserting nodes.
void insertInternalVertices(BRepMesh::ListOfVertex& theNewVertices,
BRepMesh_Delaun& theMeshBuilder);
void insertInternalVertices(BRepMesh_Delaun& theMeshBuilder);
//! Calculates nodes lying on spherical surface.
//! @param theNewVertices list of vertices to be extended and added to mesh.

View File

@@ -76,10 +76,8 @@ BRepMesh_GeomTool::BRepMesh_GeomTool(
//=======================================================================
Standard_Boolean BRepMesh_GeomTool::Value(
const Standard_Integer theIndex,
const Handle(BRepAdaptor_HSurface)& theSurface,
Standard_Real& theParam,
gp_Pnt& thePoint,
gp_Pnt2d& theUV) const
gp_Pnt& thePoint) const
{
if (theIndex < 1 || theIndex > NbPoints())
return Standard_False;
@@ -90,14 +88,6 @@ Standard_Boolean BRepMesh_GeomTool::Value(
thePoint = myDiscretTool.Value(theIndex);
theParam = myDiscretTool.Parameter(theIndex);
const TopoDS_Face& aFace = ((BRepAdaptor_Surface*)&(theSurface->Surface()))->Face();
Standard_Real aFirst, aLast;
Handle(Geom2d_Curve) aCurve =
BRep_Tool::CurveOnSurface(*myEdge, aFace, aFirst, aLast);
aCurve->D0(theParam, theUV);
return Standard_True;
}

View File

@@ -124,16 +124,12 @@ public:
//! Gets parameters of discretization point with the given index.
//! @param theIndex index of discretization point.
//! @param theSurface surface the curve is lying onto.
//! @param theParam[out] parameter of the point on the curve.
//! @param thePoint[out] discretization point.
//! @param theUV[out] discretization point in parametric space of the surface.
//! @return TRUE on success, FALSE elsewhere.
Standard_EXPORT Standard_Boolean Value(const Standard_Integer theIndex,
const Handle(BRepAdaptor_HSurface)& theSurface,
Standard_Real& theParam,
gp_Pnt& thePoint,
gp_Pnt2d& theUV) const;
gp_Pnt& thePoint) const;
public: //! @name static API

View File

@@ -130,7 +130,6 @@ Standard_Real BRepMesh_ShapeTool::RelativeEdgeDeflection(
gp_XY BRepMesh_ShapeTool::FindUV(
const Standard_Integer theIndexOfPnt3d,
const gp_Pnt2d& thePnt2d,
const TopoDS_Vertex& theVertex,
const Standard_Real theMinDistance,
const Handle(BRepMesh_FaceAttribute)& theFaceAttribute)
{
@@ -164,8 +163,7 @@ gp_XY BRepMesh_ShapeTool::FindUV(
}
}
const Standard_Real aTolerance =
Min(2. * BRep_Tool::Tolerance(theVertex), theMinDistance);
const Standard_Real aTolerance = theMinDistance;
// Get face limits
Standard_Real aDiffU = theFaceAttribute->GetUMax() - theFaceAttribute->GetUMin();

View File

@@ -67,12 +67,8 @@ public:
//! representation should be associated.
//! @param thePnt2d 2d representation of the point with the
//! given index.
//! @param theVertex vertex corresponded to 3d point with the
//! given index. Used to extract vertex tolerance in 3d space.
//! @param theMinDistance minimum distance between vertices
//! regarding which they could be treated as distinct ones.
//! This value is defined by mesher using parameters given by
//! user in connection with shape metrics.
//! @param theFaceAttribute attributes contining data calculated
//! according to face geomtry and define limits of face in parametric
//! space. If defined, will be used instead of surface parameter.
@@ -83,7 +79,6 @@ public:
Standard_EXPORT static gp_XY FindUV(
const Standard_Integer theIndexOfPnt3d,
const gp_Pnt2d& thePnt2d,
const TopoDS_Vertex& theVertex,
const Standard_Real theMinDistance,
const Handle(BRepMesh_FaceAttribute)& theFaceAttribute);