mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0022564: BRepMesh_Classifier improvements
This commit is contained in:
parent
c99551fa0f
commit
2b59653e67
@ -23,15 +23,6 @@ uses
|
|||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
Create (F : Face from TopoDS;
|
|
||||||
Tol : Real from Standard;
|
|
||||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
|
||||||
themap : IndexedMapOfInteger from TColStd;
|
|
||||||
Str : IndexedMapOfVertex from BRepMesh;
|
|
||||||
Umin, Umax, Vmin, Vmax: Real from Standard)
|
|
||||||
returns Classifier from BRepMesh;
|
|
||||||
|
|
||||||
|
|
||||||
Create (F : Face from TopoDS;
|
Create (F : Face from TopoDS;
|
||||||
Tol : Real from Standard;
|
Tol : Real from Standard;
|
||||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
||||||
@ -49,10 +40,6 @@ is
|
|||||||
returns Status from BRepMesh;
|
returns Status from BRepMesh;
|
||||||
---C++: inline
|
---C++: inline
|
||||||
|
|
||||||
NaturalRestriction(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---C++: inline
|
|
||||||
|
|
||||||
|
|
||||||
Destroy(me: in out);
|
Destroy(me: in out);
|
||||||
---C++: alias ~
|
---C++: alias ~
|
||||||
@ -76,6 +63,5 @@ fields
|
|||||||
U2 : Real from Standard;
|
U2 : Real from Standard;
|
||||||
V2 : Real from Standard;
|
V2 : Real from Standard;
|
||||||
myState : Status from BRepMesh;
|
myState : Status from BRepMesh;
|
||||||
isnatural : Boolean from Standard;
|
|
||||||
|
|
||||||
end Classifier from BRepMesh;
|
end Classifier from BRepMesh;
|
||||||
|
@ -88,8 +88,8 @@ static Standard_Boolean IsLine(const Handle(Geom2d_Curve)& C2d)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepMesh_Classifier::AnalizeWire (const TColgp_SequenceOfPnt2d& theSeqPnt2d,
|
void BRepMesh_Classifier::AnalizeWire (const TColgp_SequenceOfPnt2d& theSeqPnt2d,
|
||||||
const Standard_Real Umin, const Standard_Real Umax,
|
const Standard_Real Umin, const Standard_Real Umax,
|
||||||
const Standard_Real Vmin, const Standard_Real Vmax)
|
const Standard_Real Vmin, const Standard_Real Vmax)
|
||||||
{
|
{
|
||||||
const Standard_Integer nbpnts = theSeqPnt2d.Length();
|
const Standard_Integer nbpnts = theSeqPnt2d.Length();
|
||||||
if (nbpnts < 2) return;
|
if (nbpnts < 2) return;
|
||||||
@ -140,350 +140,16 @@ void BRepMesh_Classifier::AnalizeWire (const TColgp_SequenceOfPnt2d& theSeqPnt2
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
||||||
const Standard_Real TolUV,
|
const Standard_Real TolUV,
|
||||||
const BRepMesh_DataMapOfShapePairOfPolygon& edges,
|
const BRepMesh_DataMapOfShapePairOfPolygon& edges,
|
||||||
const TColStd_IndexedMapOfInteger& themap,
|
const TColStd_IndexedMapOfInteger& themap,
|
||||||
const BRepMesh_IndexedMapOfVertex& Str,
|
const Handle(BRepMesh_DataStructureOfDelaun)& Str,
|
||||||
const Standard_Real Umin,
|
const Standard_Real Umin,
|
||||||
const Standard_Real Umax,
|
const Standard_Real Umax,
|
||||||
const Standard_Real Vmin,
|
const Standard_Real Vmin,
|
||||||
const Standard_Real Vmax):
|
const Standard_Real Vmax):
|
||||||
Toluv(TolUV), Face(aFace),
|
Toluv(TolUV), Face(aFace),
|
||||||
myState(BRepMesh_NoError),
|
myState(BRepMesh_NoError)
|
||||||
isnatural(Standard_False)
|
|
||||||
{
|
|
||||||
//-- impasse sur les surfs definies sur plus d une periode
|
|
||||||
|
|
||||||
//-- once definition
|
|
||||||
Face.Orientation(TopAbs_FORWARD);
|
|
||||||
|
|
||||||
TopoDS_Edge edge;
|
|
||||||
BRepTools_WireExplorer WireExplorer;
|
|
||||||
//TopExp_Explorer FaceExplorer;
|
|
||||||
TopoDS_Iterator FaceExplorer;
|
|
||||||
|
|
||||||
TColgp_SequenceOfPnt2d aWirePoints, aWire;
|
|
||||||
TColStd_SequenceOfInteger aWireLength;
|
|
||||||
|
|
||||||
|
|
||||||
//-- twice definitions
|
|
||||||
TopAbs_Orientation anOr = TopAbs_FORWARD;
|
|
||||||
Standard_Boolean falsewire = Standard_False;
|
|
||||||
Standard_Integer i, index, firstindex = 0, lastindex = 0, nbedges = 0;
|
|
||||||
#ifdef DEB_MESH
|
|
||||||
debwire = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
|
||||||
{
|
|
||||||
#ifdef DEB_MESH
|
|
||||||
if (debclass) { debwire++; cout <<endl; cout << "#wire no "<<debwire; debedge = 0;}
|
|
||||||
#endif
|
|
||||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
|
||||||
continue;
|
|
||||||
// For each wire we create a data map, linking vertices (only
|
|
||||||
// the ends of edges) with their positions in the sequence of
|
|
||||||
// all 2d points from this wire.
|
|
||||||
// When we meet some vertex for the second time - the piece
|
|
||||||
// of sequence is treated for a HOLE and quits the sequence.
|
|
||||||
// Actually, we must unbind the vertices belonging to the
|
|
||||||
// loop from the map, but since they can't appear twice on the
|
|
||||||
// valid wire, leave them for a little speed up.
|
|
||||||
nbedges = 0;
|
|
||||||
TColgp_SequenceOfPnt2d SeqPnt2d;
|
|
||||||
TColStd_DataMapOfIntegerInteger NodeInSeq;
|
|
||||||
// Start traversing the wire
|
|
||||||
for (WireExplorer.Init(TopoDS::Wire(FaceExplorer.Value()),Face); WireExplorer.More(); WireExplorer.Next())
|
|
||||||
{
|
|
||||||
edge = WireExplorer.Current();
|
|
||||||
#ifdef DEB_MESH
|
|
||||||
if (debclass) { debedge++; cout << endl; cout << "#edge no "<<debedge <<endl;}
|
|
||||||
#endif
|
|
||||||
anOr = edge.Orientation();
|
|
||||||
if (anOr != TopAbs_FORWARD && anOr != TopAbs_REVERSED) continue;
|
|
||||||
if (edges.IsBound(edge))
|
|
||||||
{
|
|
||||||
// Retrieve polygon
|
|
||||||
// Define the direction for adding points to SeqPnt2d
|
|
||||||
Standard_Integer iFirst,iLast,iIncr;
|
|
||||||
const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
|
|
||||||
Handle(Poly_PolygonOnTriangulation) NOD;
|
|
||||||
if (anOr == TopAbs_FORWARD)
|
|
||||||
{
|
|
||||||
NOD = pair.First();
|
|
||||||
iFirst = 1;
|
|
||||||
iLast = NOD->NbNodes();
|
|
||||||
iIncr = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NOD = pair.Last();
|
|
||||||
iFirst = NOD->NbNodes();
|
|
||||||
iLast = 1;
|
|
||||||
iIncr = -1;
|
|
||||||
}
|
|
||||||
const TColStd_Array1OfInteger& indices = NOD->Nodes();
|
|
||||||
|
|
||||||
// indexFirst and nodeLast are the indices of first and last
|
|
||||||
// vertices of the edge in IndexedMap <Str>
|
|
||||||
const Standard_Integer indexFirst = themap.FindKey(indices(iFirst));
|
|
||||||
const Standard_Integer indexLast = themap.FindKey(indices(iLast));
|
|
||||||
|
|
||||||
// Skip degenerated edge : OCC481(apo)
|
|
||||||
if (indexLast == indexFirst && (iLast-iFirst) == iIncr) continue;
|
|
||||||
|
|
||||||
// If there's a gap between edges -> raise <falsewire> flag
|
|
||||||
if (nbedges)
|
|
||||||
{
|
|
||||||
if (indexFirst != lastindex)
|
|
||||||
{
|
|
||||||
falsewire = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else firstindex = indexFirst;
|
|
||||||
lastindex = indexLast;
|
|
||||||
|
|
||||||
// Record first vertex (to detect loops)
|
|
||||||
NodeInSeq.Bind(indexFirst,SeqPnt2d.Length()+1);
|
|
||||||
|
|
||||||
// Add vertices in sequence
|
|
||||||
for (i = iFirst; i != iLast; i += iIncr)
|
|
||||||
{
|
|
||||||
index = (i == iFirst)? indexFirst : themap.FindKey(indices(i));
|
|
||||||
|
|
||||||
gp_Pnt2d vp(Str(index).Coord());
|
|
||||||
SeqPnt2d.Append(vp);
|
|
||||||
#ifdef DEB_MESH
|
|
||||||
if (debclass) cout<<"point p"<<index<<" "<<vp.X()<<" "<< vp.Y()<<endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now, is there a loop?
|
|
||||||
if (NodeInSeq.IsBound(indexLast))
|
|
||||||
{
|
|
||||||
// Yes, treat it separately as a hole
|
|
||||||
// 1. Divide points into main wire and a loop
|
|
||||||
const Standard_Integer iWireStart = NodeInSeq(indexLast);
|
|
||||||
if(iWireStart < SeqPnt2d.Length()) {
|
|
||||||
SeqPnt2d.Split(iWireStart, aWire);
|
|
||||||
//OCC319-> the operation will be done later
|
|
||||||
// 2. Proceed the loop
|
|
||||||
//AnalizeWire(aLoop, Umin, Umax, Vmin, Vmax, aWirePoints, aWireLength, NbBiPoint);
|
|
||||||
aWireLength.Append(aWire.Length());
|
|
||||||
aWirePoints.Append(aWire);
|
|
||||||
//<-OCC319
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nbedges++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbedges)
|
|
||||||
{
|
|
||||||
// Isn't it open?
|
|
||||||
if (falsewire || (firstindex != lastindex) || SeqPnt2d.Length() > 1)
|
|
||||||
{
|
|
||||||
myState = BRepMesh_OpenWire;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef DEB_MESH
|
|
||||||
cout <<"Warning : empty wire" <<endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check natural restriction
|
|
||||||
const Standard_Integer nbwires = aWireLength.Length();
|
|
||||||
if (nbwires == 1 && nbedges == 4)
|
|
||||||
{
|
|
||||||
Handle(Geom2d_Curve) C2d;
|
|
||||||
Standard_Real pfbid, plbid;
|
|
||||||
isnatural = Standard_True;
|
|
||||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
|
||||||
{
|
|
||||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
|
||||||
continue;
|
|
||||||
TopoDS_Iterator aEdgeIt(FaceExplorer.Value());
|
|
||||||
for( ; aEdgeIt.More(); aEdgeIt.Next())
|
|
||||||
{
|
|
||||||
edge = TopoDS::Edge(aEdgeIt.Value());
|
|
||||||
if(anOr == TopAbs_FORWARD || anOr == TopAbs_REVERSED)
|
|
||||||
{
|
|
||||||
C2d = BRep_Tool::CurveOnSurface(edge,Face,pfbid,plbid);
|
|
||||||
//OCC316(APO): if(!IsLine(C2d)) { isnatural = Standard_False; break; }
|
|
||||||
if(!C2d.IsNull() && !IsLine(C2d)) { isnatural = Standard_False; break; }
|
|
||||||
else
|
|
||||||
{ // sont-ce des isos:
|
|
||||||
gp_Pnt2d P1, P2;
|
|
||||||
C2d->D0(pfbid, P1);
|
|
||||||
C2d->D0(plbid, P2);
|
|
||||||
if ((Abs(P1.X()-P2.X()) > 1.e-04) && (Abs(P1.Y()-P2.Y()) > 1.e-04)) { isnatural = Standard_False; break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer NbBiPoint = aWirePoints.Length();
|
|
||||||
BRepMesh_Array1OfBiPoint BiPoints(0,NbBiPoint);
|
|
||||||
|
|
||||||
BRepMesh_BiPoint *BP;
|
|
||||||
Standard_Real *Coordinates1;
|
|
||||||
Standard_Real x1, y1, x2, y2, xstart, ystart;
|
|
||||||
Standard_Integer j, l = 1;
|
|
||||||
BP = &(BiPoints.ChangeValue(1));
|
|
||||||
|
|
||||||
// Fill array of segments (bi-points)
|
|
||||||
for (i = 1; i <= nbwires; i++)
|
|
||||||
{
|
|
||||||
const Standard_Integer len = aWireLength(i) + 1;
|
|
||||||
for (j = 1; j <= len; j++)
|
|
||||||
{
|
|
||||||
// Obtain last point of the segment
|
|
||||||
if (j == len)
|
|
||||||
{
|
|
||||||
x2 = xstart;
|
|
||||||
y2 = ystart;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const gp_Pnt2d& PT = aWirePoints(l); l++;
|
|
||||||
x2 = PT.X();
|
|
||||||
y2 = PT.Y();
|
|
||||||
}
|
|
||||||
// Build segment (bi-point)
|
|
||||||
if (j == 1)
|
|
||||||
{
|
|
||||||
xstart = x2;
|
|
||||||
ystart = y2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Coordinates1 = ((Standard_Real*)(BP->Coordinates())); BP++;
|
|
||||||
Coordinates1[0] = x1;
|
|
||||||
Coordinates1[1] = y1;
|
|
||||||
Coordinates1[2] = x2;
|
|
||||||
Coordinates1[3] = y2;
|
|
||||||
Coordinates1[4] = x2 - x1;
|
|
||||||
Coordinates1[5] = y2 - y1;
|
|
||||||
}
|
|
||||||
x1 = x2;
|
|
||||||
y1 = y2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real *Coordinates2;
|
|
||||||
Standard_Real A1, B1, C1, A2, B2, C2, AB, BC, CA, xc, yc;
|
|
||||||
Standard_Real mu1, d, mu2;
|
|
||||||
Standard_Integer ik, ikEnd = 0, jk, jkEnd;
|
|
||||||
Standard_Real x11, x12, y11, y12, x21, x22, y21, y22;
|
|
||||||
for(i = 1; i <= nbwires; i++)
|
|
||||||
{
|
|
||||||
ik = ikEnd + 1; ikEnd += aWireLength(i);
|
|
||||||
// Explore first wire
|
|
||||||
for (; ik <= ikEnd; ik++)
|
|
||||||
{
|
|
||||||
Coordinates1 = ((Standard_Real*)(BiPoints.ChangeValue(ik).Coordinates()));
|
|
||||||
x11 = Coordinates1[0];
|
|
||||||
y11 = Coordinates1[1];
|
|
||||||
x12 = Coordinates1[2];
|
|
||||||
y12 = Coordinates1[3];
|
|
||||||
A1 = Coordinates1[5];
|
|
||||||
B1 = -Coordinates1[4];
|
|
||||||
C1 = - x11*A1 - y11*B1;
|
|
||||||
//mu1 = Sqrt(A1*A1+B1*B1);
|
|
||||||
mu1 = A1*A1+B1*B1;
|
|
||||||
for (j = i; j <= nbwires; j++)
|
|
||||||
{
|
|
||||||
//for i==j the algorithm check current wire on selfintersection
|
|
||||||
if (j == i)
|
|
||||||
{
|
|
||||||
jk = ik + 2; jkEnd = ikEnd;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jk = jkEnd + 1; jkEnd = jk + aWireLength(j) - 1;
|
|
||||||
}
|
|
||||||
// Explore second wire
|
|
||||||
for (; jk <= jkEnd; jk++)
|
|
||||||
{
|
|
||||||
// don't check end's segment of the wire on selfrestriction
|
|
||||||
if (jk == ikEnd) continue;
|
|
||||||
Coordinates2 = ((Standard_Real*)(BiPoints.ChangeValue(jk).Coordinates()));
|
|
||||||
x21 = Coordinates2[0];
|
|
||||||
y21 = Coordinates2[1];
|
|
||||||
x22 = Coordinates2[2];
|
|
||||||
y22 = Coordinates2[3];
|
|
||||||
A2 = Coordinates2[5];
|
|
||||||
B2 = -Coordinates2[4];
|
|
||||||
C2 = - x21*A2 - y21*B2;
|
|
||||||
//mu2 = Sqrt(A2*A2+B2*B2);
|
|
||||||
mu2 = A2*A2+B2*B2;
|
|
||||||
//different segments may have common vertex (see OCC287 bug for example)
|
|
||||||
//if(x22 == x11 && y22 == y11){ myState = BRepMesh_OpenWire; return;}
|
|
||||||
AB = A1*B2 - A2*B1;
|
|
||||||
//check on minimal of distance between current segment and points of another linear segments - OCC319
|
|
||||||
//d = Abs(A1*x22 + B1*y22 + C1);
|
|
||||||
d = A1*x22 + B1*y22 + C1;
|
|
||||||
if(i != j && // if compared wires are different &&
|
|
||||||
AB*AB > PARALL_COND*PARALL_COND*mu1*mu2 && // angle between two segments greater then PARALL_COND &&
|
|
||||||
d*d < MIN_DIST*MIN_DIST*mu1 && // distance between vertex of the segment and other one's less then MIN_DIST
|
|
||||||
(x22-x11)*(x22-x12) < 0.0 && (y22-y11)*(y22-y12) < 0.0)
|
|
||||||
{
|
|
||||||
myState = BRepMesh_SelfIntersectingWire; return;
|
|
||||||
}
|
|
||||||
//look for intersection of two linear segments
|
|
||||||
if(Abs(AB) <= RESOLUTION) continue; //current segments seem parallel - no intersection
|
|
||||||
//calculate coordinates of point of the intersection
|
|
||||||
BC = B1*C2 - B2*C1; xc = BC/AB;
|
|
||||||
CA = C1*A2 - C2*A1; yc = CA/AB;
|
|
||||||
if( Abs(xc-x11) > RESOLUTION && Abs(xc-x12) > RESOLUTION &&
|
|
||||||
Abs(yc-y11) > RESOLUTION && Abs(yc-y12) > RESOLUTION &&
|
|
||||||
Abs(xc-x21) > RESOLUTION && Abs(xc-x22) > RESOLUTION &&
|
|
||||||
Abs(yc-y21) > RESOLUTION && Abs(yc-y22) > RESOLUTION )
|
|
||||||
{
|
|
||||||
//check on belonging of intersection point to the both of segments
|
|
||||||
if((xc-x11)*(xc-x12) < 0.0 && (yc-y11)*(yc-y12) < 0.0 &&
|
|
||||||
(xc-x21)*(xc-x22) < 0.0 && (yc-y21)*(yc-y22) < 0.0)
|
|
||||||
{
|
|
||||||
//different segments may have common vertex (why "<" but "<=")
|
|
||||||
myState = BRepMesh_SelfIntersectingWire; return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find holes
|
|
||||||
for (i = nbwires; i >= 1; i--)
|
|
||||||
{
|
|
||||||
NbBiPoint = aWirePoints.Length() - aWireLength(i) + 1;
|
|
||||||
aWirePoints.Split(NbBiPoint, aWire);
|
|
||||||
AnalizeWire(aWire, Umin, Umax, Vmin, Vmax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Wind code duplication
|
|
||||||
|
|
||||||
BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|
||||||
const Standard_Real TolUV,
|
|
||||||
const BRepMesh_DataMapOfShapePairOfPolygon& edges,
|
|
||||||
const TColStd_IndexedMapOfInteger& themap,
|
|
||||||
const Handle(BRepMesh_DataStructureOfDelaun)& Str,
|
|
||||||
const Standard_Real Umin,
|
|
||||||
const Standard_Real Umax,
|
|
||||||
const Standard_Real Vmin,
|
|
||||||
const Standard_Real Vmax):
|
|
||||||
Toluv(TolUV), Face(aFace),
|
|
||||||
myState(BRepMesh_NoError),
|
|
||||||
isnatural(Standard_False)
|
|
||||||
{
|
{
|
||||||
//-- impasse sur les surfs definies sur plus d une periode
|
//-- impasse sur les surfs definies sur plus d une periode
|
||||||
|
|
||||||
@ -537,50 +203,50 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
if (edges.IsBound(edge))
|
if (edges.IsBound(edge))
|
||||||
{
|
{
|
||||||
// Retrieve polygon
|
// Retrieve polygon
|
||||||
// Define the direction for adding points to SeqPnt2d
|
// Define the direction for adding points to SeqPnt2d
|
||||||
Standard_Integer iFirst,iLast,iIncr;
|
Standard_Integer iFirst,iLast,iIncr;
|
||||||
const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
|
const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
|
||||||
Handle(Poly_PolygonOnTriangulation) NOD;
|
Handle(Poly_PolygonOnTriangulation) NOD;
|
||||||
if (anOr == TopAbs_FORWARD)
|
if (anOr == TopAbs_FORWARD)
|
||||||
{
|
{
|
||||||
NOD = pair.First();
|
NOD = pair.First();
|
||||||
iFirst = 1;
|
iFirst = 1;
|
||||||
iLast = NOD->NbNodes();
|
iLast = NOD->NbNodes();
|
||||||
iIncr = 1;
|
iIncr = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NOD = pair.Last();
|
NOD = pair.Last();
|
||||||
iFirst = NOD->NbNodes();
|
iFirst = NOD->NbNodes();
|
||||||
iLast = 1;
|
iLast = 1;
|
||||||
iIncr = -1;
|
iIncr = -1;
|
||||||
}
|
}
|
||||||
const TColStd_Array1OfInteger& indices = NOD->Nodes();
|
const TColStd_Array1OfInteger& indices = NOD->Nodes();
|
||||||
|
|
||||||
// indexFirst and nodeLast are the indices of first and last
|
// indexFirst and nodeLast are the indices of first and last
|
||||||
// vertices of the edge in IndexedMap <Str>
|
// vertices of the edge in IndexedMap <Str>
|
||||||
const Standard_Integer indexFirst = themap.FindKey(indices(iFirst));
|
const Standard_Integer indexFirst = themap.FindKey(indices(iFirst));
|
||||||
const Standard_Integer indexLast = themap.FindKey(indices(iLast));
|
const Standard_Integer indexLast = themap.FindKey(indices(iLast));
|
||||||
|
|
||||||
// Skip degenerated edge : OCC481(apo)
|
// Skip degenerated edge : OCC481(apo)
|
||||||
if (indexLast == indexFirst && (iLast-iFirst) == iIncr) continue;
|
if (indexLast == indexFirst && (iLast-iFirst) == iIncr) continue;
|
||||||
|
|
||||||
// If there's a gap between edges -> raise <falsewire> flag
|
// If there's a gap between edges -> raise <falsewire> flag
|
||||||
if (nbedges)
|
if (nbedges)
|
||||||
{
|
{
|
||||||
if (indexFirst != lastindex)
|
if (indexFirst != lastindex)
|
||||||
{
|
{
|
||||||
falsewire = Standard_True;
|
falsewire = Standard_True;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else firstindex = indexFirst;
|
else firstindex = indexFirst;
|
||||||
lastindex = indexLast;
|
lastindex = indexLast;
|
||||||
|
|
||||||
// Record first vertex (to detect loops)
|
// Record first vertex (to detect loops)
|
||||||
NodeInSeq.Bind(indexFirst,SeqPnt2d.Length()+1);
|
NodeInSeq.Bind(indexFirst,SeqPnt2d.Length()+1);
|
||||||
|
|
||||||
// Add vertices in sequence
|
// Add vertices in sequence
|
||||||
for (i = iFirst; i != iLast; i += iIncr)
|
for (i = iFirst; i != iLast; i += iIncr)
|
||||||
{
|
{
|
||||||
index = (i == iFirst)? indexFirst : themap.FindKey(indices(i));
|
index = (i == iFirst)? indexFirst : themap.FindKey(indices(i));
|
||||||
@ -592,24 +258,23 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, is there a loop?
|
// Now, is there a loop?
|
||||||
if (NodeInSeq.IsBound(indexLast))
|
if (NodeInSeq.IsBound(indexLast))
|
||||||
{
|
{
|
||||||
// Yes, treat it separately as a hole
|
// Yes, treat it separately as a hole
|
||||||
// 1. Divide points into main wire and a loop
|
// 1. Divide points into main wire and a loop
|
||||||
const Standard_Integer iWireStart = NodeInSeq(indexLast);
|
const Standard_Integer iWireStart = NodeInSeq(indexLast);
|
||||||
if(iWireStart < SeqPnt2d.Length()) {
|
if(iWireStart < SeqPnt2d.Length()) {
|
||||||
SeqPnt2d.Split(iWireStart, aWire);
|
SeqPnt2d.Split(iWireStart, aWire);
|
||||||
//OCC319-> the operation will be done later
|
//OCC319-> the operation will be done later
|
||||||
// 2. Proceed the loop
|
// 2. Proceed the loop
|
||||||
//AnalizeWire(aLoop, Umin, Umax, Vmin, Vmax, aWirePoints, aWireLength, NbBiPoint);
|
//AnalizeWire(aLoop, Umin, Umax, Vmin, Vmax, aWirePoints, aWireLength, NbBiPoint);
|
||||||
aWireLength.Append(aWire.Length());
|
aWireLength.Append(aWire.Length());
|
||||||
aWirePoints.Append(aWire);
|
aWirePoints.Append(aWire);
|
||||||
//<-OCC319
|
//<-OCC319
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nbedges++;
|
||||||
nbedges++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,8 +283,8 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
// Isn't it open?
|
// Isn't it open?
|
||||||
if (falsewire || (firstindex != lastindex) || SeqPnt2d.Length() > 1)
|
if (falsewire || (firstindex != lastindex) || SeqPnt2d.Length() > 1)
|
||||||
{
|
{
|
||||||
myState = BRepMesh_OpenWire;
|
myState = BRepMesh_OpenWire;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -630,38 +295,7 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check natural restriction
|
|
||||||
const Standard_Integer nbwires = aWireLength.Length();
|
const Standard_Integer nbwires = aWireLength.Length();
|
||||||
if (nbwires == 1 && nbedges == 4)
|
|
||||||
{
|
|
||||||
Handle(Geom2d_Curve) C2d;
|
|
||||||
Standard_Real pfbid, plbid;
|
|
||||||
isnatural = Standard_True;
|
|
||||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
|
||||||
{
|
|
||||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
|
||||||
continue;
|
|
||||||
TopoDS_Iterator aEdgeIt(FaceExplorer.Value());
|
|
||||||
for( ; aEdgeIt.More(); aEdgeIt.Next())
|
|
||||||
{
|
|
||||||
edge = TopoDS::Edge(aEdgeIt.Value());
|
|
||||||
if(anOr == TopAbs_FORWARD || anOr == TopAbs_REVERSED)
|
|
||||||
{
|
|
||||||
C2d = BRep_Tool::CurveOnSurface(edge,Face,pfbid,plbid);
|
|
||||||
//OCC316(APO): if(!IsLine(C2d)) { isnatural = Standard_False; break; }
|
|
||||||
if(!C2d.IsNull() && !IsLine(C2d)) { isnatural = Standard_False; break; }
|
|
||||||
else
|
|
||||||
{ // sont-ce des isos:
|
|
||||||
gp_Pnt2d P1, P2;
|
|
||||||
C2d->D0(pfbid, P1);
|
|
||||||
C2d->D0(plbid, P2);
|
|
||||||
if ((Abs(P1.X()-P2.X()) > 1.e-04) && (Abs(P1.Y()-P2.Y()) > 1.e-04)) { isnatural = Standard_False; break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer NbBiPoint = aWirePoints.Length();
|
Standard_Integer NbBiPoint = aWirePoints.Length();
|
||||||
BRepMesh_Array1OfBiPoint BiPoints(0,NbBiPoint);
|
BRepMesh_Array1OfBiPoint BiPoints(0,NbBiPoint);
|
||||||
|
|
||||||
@ -734,7 +368,7 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
for (j = i; j <= nbwires; j++)
|
for (j = i; j <= nbwires; j++)
|
||||||
{
|
{
|
||||||
//for i==j the algorithm check current wire on selfintersection
|
//for i==j the algorithm check current wire on selfintersection
|
||||||
if (j == i)
|
if (j == i)
|
||||||
{
|
{
|
||||||
jk = ik + 2; jkEnd = ikEnd;
|
jk = ik + 2; jkEnd = ikEnd;
|
||||||
}
|
}
|
||||||
@ -743,52 +377,52 @@ BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
|||||||
jk = jkEnd + 1; jkEnd = jk + aWireLength(j) - 1;
|
jk = jkEnd + 1; jkEnd = jk + aWireLength(j) - 1;
|
||||||
}
|
}
|
||||||
// Explore second wire
|
// Explore second wire
|
||||||
for (; jk <= jkEnd; jk++)
|
for (; jk <= jkEnd; jk++)
|
||||||
{
|
{
|
||||||
// don't check end's segment of the wire on selfrestriction
|
// don't check end's segment of the wire on selfrestriction
|
||||||
if (jk == ikEnd) continue;
|
if (jk == ikEnd) continue;
|
||||||
Coordinates2 = ((Standard_Real*)(BiPoints.ChangeValue(jk).Coordinates()));
|
Coordinates2 = ((Standard_Real*)(BiPoints.ChangeValue(jk).Coordinates()));
|
||||||
x21 = Coordinates2[0];
|
x21 = Coordinates2[0];
|
||||||
y21 = Coordinates2[1];
|
y21 = Coordinates2[1];
|
||||||
x22 = Coordinates2[2];
|
x22 = Coordinates2[2];
|
||||||
y22 = Coordinates2[3];
|
y22 = Coordinates2[3];
|
||||||
A2 = Coordinates2[5];
|
A2 = Coordinates2[5];
|
||||||
B2 = -Coordinates2[4];
|
B2 = -Coordinates2[4];
|
||||||
C2 = - x21*A2 - y21*B2;
|
C2 = - x21*A2 - y21*B2;
|
||||||
//mu2 = Sqrt(A2*A2+B2*B2);
|
//mu2 = Sqrt(A2*A2+B2*B2);
|
||||||
mu2 = A2*A2+B2*B2;
|
mu2 = A2*A2+B2*B2;
|
||||||
//different segments may have common vertex (see OCC287 bug for example)
|
//different segments may have common vertex (see OCC287 bug for example)
|
||||||
//if(x22 == x11 && y22 == y11){ myState = BRepMesh_OpenWire; return;}
|
//if(x22 == x11 && y22 == y11){ myState = BRepMesh_OpenWire; return;}
|
||||||
AB = A1*B2 - A2*B1;
|
AB = A1*B2 - A2*B1;
|
||||||
//check on minimal of distance between current segment and points of another linear segments - OCC319
|
//check on minimal of distance between current segment and points of another linear segments - OCC319
|
||||||
//d = Abs(A1*x22 + B1*y22 + C1);
|
//d = Abs(A1*x22 + B1*y22 + C1);
|
||||||
d = A1*x22 + B1*y22 + C1;
|
d = A1*x22 + B1*y22 + C1;
|
||||||
if(i != j && // if compared wires are different &&
|
if(i != j && // if compared wires are different &&
|
||||||
AB*AB > PARALL_COND*PARALL_COND*mu1*mu2 && // angle between two segments greater then PARALL_COND &&
|
AB*AB > PARALL_COND*PARALL_COND*mu1*mu2 && // angle between two segments greater then PARALL_COND &&
|
||||||
d*d < MIN_DIST*MIN_DIST*mu1 && // distance between vertex of the segment and other one's less then MIN_DIST
|
d*d < MIN_DIST*MIN_DIST*mu1 && // distance between vertex of the segment and other one's less then MIN_DIST
|
||||||
(x22-x11)*(x22-x12) < 0.0 && (y22-y11)*(y22-y12) < 0.0)
|
(x22-x11)*(x22-x12) < 0.0 && (y22-y11)*(y22-y12) < 0.0)
|
||||||
{
|
{
|
||||||
myState = BRepMesh_SelfIntersectingWire; return;
|
myState = BRepMesh_SelfIntersectingWire; return;
|
||||||
}
|
}
|
||||||
//look for intersection of two linear segments
|
//look for intersection of two linear segments
|
||||||
if(Abs(AB) <= RESOLUTION) continue; //current segments seem parallel - no intersection
|
if(Abs(AB) <= RESOLUTION) continue; //current segments seem parallel - no intersection
|
||||||
//calculate coordinates of point of the intersection
|
//calculate coordinates of point of the intersection
|
||||||
BC = B1*C2 - B2*C1; xc = BC/AB;
|
BC = B1*C2 - B2*C1; xc = BC/AB;
|
||||||
CA = C1*A2 - C2*A1; yc = CA/AB;
|
CA = C1*A2 - C2*A1; yc = CA/AB;
|
||||||
//check on belonging of intersection point to the both of segments
|
//check on belonging of intersection point to the both of segments
|
||||||
if( Abs(xc-x11) > RESOLUTION && Abs(xc-x12) > RESOLUTION &&
|
if( Abs(xc-x11) > RESOLUTION && Abs(xc-x12) > RESOLUTION &&
|
||||||
Abs(yc-y11) > RESOLUTION && Abs(yc-y12) > RESOLUTION &&
|
Abs(yc-y11) > RESOLUTION && Abs(yc-y12) > RESOLUTION &&
|
||||||
Abs(xc-x21) > RESOLUTION && Abs(xc-x22) > RESOLUTION &&
|
Abs(xc-x21) > RESOLUTION && Abs(xc-x22) > RESOLUTION &&
|
||||||
Abs(yc-y21) > RESOLUTION && Abs(yc-y22) > RESOLUTION )
|
Abs(yc-y21) > RESOLUTION && Abs(yc-y22) > RESOLUTION )
|
||||||
{
|
{
|
||||||
if((xc-x11)*(xc-x12) < 0.0 && (yc-y11)*(yc-y12) < 0.0 &&
|
if((xc-x11)*(xc-x12) < 0.0 && (yc-y11)*(yc-y12) < 0.0 &&
|
||||||
(xc-x21)*(xc-x22) < 0.0 && (yc-y21)*(yc-y22) < 0.0)
|
(xc-x21)*(xc-x22) < 0.0 && (yc-y21)*(yc-y22) < 0.0)
|
||||||
{
|
{
|
||||||
//different segments may have common vertex (why "<" but "<=")
|
//different segments may have common vertex (why "<" but "<=")
|
||||||
myState = BRepMesh_SelfIntersectingWire; return;
|
myState = BRepMesh_SelfIntersectingWire; return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,3 @@ inline BRepMesh_Status BRepMesh_Classifier::State() const
|
|||||||
{
|
{
|
||||||
return myState;
|
return myState;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NaturalRestriction
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
inline Standard_Boolean BRepMesh_Classifier::NaturalRestriction() const
|
|
||||||
{
|
|
||||||
return isnatural;
|
|
||||||
}
|
|
||||||
|
@ -33,115 +33,95 @@ class Delaun from BRepMesh
|
|||||||
is
|
is
|
||||||
-- Interface :
|
-- Interface :
|
||||||
|
|
||||||
Create (Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
|
Create (Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
|
||||||
ZPositive : in Boolean from Standard=Standard_True)
|
ZPositive : in Boolean from Standard=Standard_True)
|
||||||
---Purpose: Creates the triangulation with an empty Mesh
|
---Purpose: Creates the triangulation with an empty Mesh
|
||||||
-- data structure.
|
-- data structure.
|
||||||
returns Delaun from BRepMesh;
|
returns Delaun from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
|
Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
|
||||||
Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
|
Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
|
||||||
ZPositive : in Boolean from Standard=Standard_True)
|
ZPositive : in Boolean from Standard=Standard_True)
|
||||||
---Purpose: Creates the triangulation with and existant
|
---Purpose: Creates the triangulation with and existant
|
||||||
-- Mesh data structure.
|
-- Mesh data structure.
|
||||||
returns Delaun from BRepMesh;
|
returns Delaun from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
|
Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
|
||||||
VertexIndices : in out Array1OfInteger from TColStd;
|
VertexIndices : in out Array1OfInteger from TColStd;
|
||||||
ZPositive : in Boolean from Standard=Standard_True)
|
ZPositive : in Boolean from Standard=Standard_True)
|
||||||
---Purpose: Creates the triangulation with and existant
|
---Purpose: Creates the triangulation with and existant
|
||||||
-- Mesh data structure.
|
-- Mesh data structure.
|
||||||
returns Delaun from BRepMesh;
|
returns Delaun from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
AddVertex (me : in out;
|
RemoveVertex (me : in out;
|
||||||
theVertex : in Vertex from BRepMesh);
|
theVertex : in Vertex from BRepMesh);
|
||||||
---Purpose: Adds a new vertex in the triangulation.
|
|
||||||
|
|
||||||
|
|
||||||
RemoveVertex (me : in out;
|
|
||||||
theVertex : in Vertex from BRepMesh);
|
|
||||||
---Purpose: Removes a vertex in the triangulation.
|
---Purpose: Removes a vertex in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
AddVertices (me : in out;
|
AddVertices (me : in out;
|
||||||
Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
|
Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
|
||||||
---Purpose: Adds some vertices in the triangulation.
|
---Purpose: Adds some vertices in the triangulation.
|
||||||
|
|
||||||
|
|
||||||
RevertDiagonal (me : in out;
|
UseEdge (me : in out;
|
||||||
theEdge : in Integer from Standard)
|
theEdge : in Integer from Standard)
|
||||||
---Purpose: Substitutes the Edge beetween to triangles by the
|
|
||||||
-- other diagonal of the quadrilatere if it is
|
|
||||||
-- possible (convex polygon). Return True if done.
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
|
|
||||||
UseEdge (me : in out;
|
|
||||||
theEdge : in Integer from Standard)
|
|
||||||
---Purpose: Modify mesh to use the edge. Return True if done.
|
---Purpose: Modify mesh to use the edge. Return True if done.
|
||||||
returns Boolean from Standard;
|
returns Boolean from Standard;
|
||||||
|
|
||||||
|
|
||||||
SmoothMesh (me : in out;
|
Result (me)
|
||||||
Epsilon : in Real from Standard);
|
|
||||||
---Purpose: Smooths the mesh in 2d space. The method is to
|
|
||||||
-- move the free and OnSurface vertices at the
|
|
||||||
-- barycentre of their polygon.
|
|
||||||
|
|
||||||
|
|
||||||
Result (me)
|
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
---Purpose: Gives the Mesh data structure.
|
---Purpose: Gives the Mesh data structure.
|
||||||
returns DataStructureOfDelaun from BRepMesh;
|
returns DataStructureOfDelaun from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
Frontier (me : in out)
|
Frontier (me : in out)
|
||||||
---Purpose: Gives the list of frontier edges
|
---Purpose: Gives the list of frontier edges
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
returns MapOfInteger from BRepMesh;
|
returns MapOfInteger from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
InternalEdges (me : in out)
|
InternalEdges (me : in out)
|
||||||
---Purpose: Gives the list of internal edges
|
---Purpose: Gives the list of internal edges
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
returns MapOfInteger from BRepMesh;
|
returns MapOfInteger from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
FreeEdges (me : in out)
|
FreeEdges (me : in out)
|
||||||
---Purpose: Gives the list of free edges used only one time
|
---Purpose: Gives the list of free edges used only one time
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
returns MapOfInteger from BRepMesh;
|
returns MapOfInteger from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
GetVertex (me;
|
GetVertex (me;
|
||||||
vIndex : in Integer from Standard)
|
vIndex : in Integer from Standard)
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
---C++: inline
|
---C++: inline
|
||||||
returns Vertex from BRepMesh;
|
returns Vertex from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
GetEdge (me;
|
GetEdge (me;
|
||||||
eIndex : in Integer from Standard)
|
eIndex : in Integer from Standard)
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
---C++: inline
|
---C++: inline
|
||||||
returns Edge from BRepMesh;
|
returns Edge from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
GetTriangle (me;
|
GetTriangle (me;
|
||||||
tIndex : in Integer from Standard)
|
tIndex : in Integer from Standard)
|
||||||
---C++: return const &
|
---C++: return const &
|
||||||
---C++: inline
|
---C++: inline
|
||||||
returns Triangle from BRepMesh;
|
returns Triangle from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
-- Implementation :
|
-- Implementation :
|
||||||
|
|
||||||
Init (me : in out;
|
Init (me : in out;
|
||||||
Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
|
Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
|
||||||
---Purpose: Initializes the triangulation with an Array of
|
---Purpose: Initializes the triangulation with an Array of
|
||||||
-- Vertex.
|
-- Vertex.
|
||||||
|
|
||||||
Compute (me : in out;
|
Compute (me : in out;
|
||||||
@ -149,14 +129,10 @@ class Delaun from BRepMesh
|
|||||||
---Purpose: Computes the triangulation and add the vertices
|
---Purpose: Computes the triangulation and add the vertices
|
||||||
-- edges and triangles to the Mesh data structure.
|
-- edges and triangles to the Mesh data structure.
|
||||||
|
|
||||||
ReCompute (me : in out;
|
|
||||||
VertexIndices : in out Array1OfInteger from TColStd);
|
|
||||||
---Purpose: Clear the existing triangles and recomputes
|
|
||||||
-- the triangulation .
|
|
||||||
|
|
||||||
SuperMesh (me : in out;
|
SuperMesh (me : in out;
|
||||||
theBox : Box2d from Bnd);
|
theBox : Box2d from Bnd);
|
||||||
---Purpose: Build the super mesh .
|
---Purpose: Build the super mesh .
|
||||||
|
|
||||||
|
|
||||||
FrontierAdjust (me : in out)
|
FrontierAdjust (me : in out)
|
||||||
@ -164,9 +140,9 @@ class Delaun from BRepMesh
|
|||||||
is private;
|
is private;
|
||||||
|
|
||||||
|
|
||||||
MeshLeftPolygonOf (me : in out;
|
MeshLeftPolygonOf (me : in out;
|
||||||
EdgeIndex : Integer from Standard;
|
EdgeIndex : Integer from Standard;
|
||||||
EdgeSens : Boolean from Standard)
|
EdgeSens : Boolean from Standard)
|
||||||
---Purpose: Find left polygon of the edge and call MeshPolygon.
|
---Purpose: Find left polygon of the edge and call MeshPolygon.
|
||||||
is private;
|
is private;
|
||||||
|
|
||||||
@ -178,7 +154,7 @@ class Delaun from BRepMesh
|
|||||||
|
|
||||||
|
|
||||||
CreateTriangles(me : in out;
|
CreateTriangles(me : in out;
|
||||||
vertexIndex : Integer from Standard;
|
vertexIndex : Integer from Standard;
|
||||||
--vertex : in Vertex from BRepMesh;
|
--vertex : in Vertex from BRepMesh;
|
||||||
freeEdges: out MapOfIntegerInteger from BRepMesh)
|
freeEdges: out MapOfIntegerInteger from BRepMesh)
|
||||||
---Purpose: Creates the triangles beetween the node
|
---Purpose: Creates the triangles beetween the node
|
||||||
@ -196,32 +172,38 @@ class Delaun from BRepMesh
|
|||||||
is private;
|
is private;
|
||||||
|
|
||||||
|
|
||||||
Contains (me;
|
Perform (me: in out;
|
||||||
TrianIndex : Integer from Standard;
|
theBndBox : out Box2d from Bnd;
|
||||||
theVertex : in Vertex from BRepMesh;
|
theVertexIndices: out Array1OfInteger from TColStd)
|
||||||
edgeOn : out Integer from Standard)
|
is private;
|
||||||
---Purpose: Test if triangle of index <TrianIndex>
|
|
||||||
-- contains geometricaly <theVertex>. If <EdgeOn>
|
|
||||||
-- is != 0 then theVertex is on Edge of index
|
|
||||||
-- <edgeOn>.
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
TriangleContaining
|
|
||||||
(me : in out;
|
|
||||||
theVertex : in Vertex from BRepMesh)
|
|
||||||
---Purpose: Gives the index of triangle containing
|
|
||||||
-- geometricaly <theVertex>.
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
|
|
||||||
fields MeshData : DataStructureOfDelaun from BRepMesh;
|
Contains (me;
|
||||||
PositiveOrientation : Boolean from Standard;
|
TrianIndex : Integer from Standard;
|
||||||
tCircles : CircleTool from BRepMesh;
|
theVertex : in Vertex from BRepMesh;
|
||||||
supVert1 : Integer from Standard;
|
edgeOn : out Integer from Standard)
|
||||||
supVert2 : Integer from Standard;
|
---Purpose: Test if triangle of index <TrianIndex>
|
||||||
supVert3 : Integer from Standard;
|
-- contains geometricaly <theVertex>. If <EdgeOn>
|
||||||
supTrian : Triangle from BRepMesh;
|
-- is != 0 then theVertex is on Edge of index
|
||||||
mapEdges : MapOfInteger from BRepMesh;
|
-- <edgeOn>.
|
||||||
|
returns Boolean from Standard;
|
||||||
|
|
||||||
|
|
||||||
|
CreateTrianglesOnNewVertices(me : in out;
|
||||||
|
theVertexIndices: out Array1OfInteger from TColStd)
|
||||||
|
--vertex : in Vertex from BRepMesh;
|
||||||
|
---Purpose: Creates the triangles on new nodes
|
||||||
|
is private;
|
||||||
|
|
||||||
|
|
||||||
|
fields MeshData : DataStructureOfDelaun from BRepMesh;
|
||||||
|
PositiveOrientation : Boolean from Standard;
|
||||||
|
tCircles : CircleTool from BRepMesh;
|
||||||
|
supVert1 : Integer from Standard;
|
||||||
|
supVert2 : Integer from Standard;
|
||||||
|
supVert3 : Integer from Standard;
|
||||||
|
supTrian : Triangle from BRepMesh;
|
||||||
|
mapEdges : MapOfInteger from BRepMesh;
|
||||||
|
|
||||||
|
|
||||||
end Delaun;
|
end Delaun;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -128,6 +128,18 @@ is
|
|||||||
last : Real from Standard)
|
last : Real from Standard)
|
||||||
returns Boolean is private;
|
returns Boolean is private;
|
||||||
|
|
||||||
|
RelativeEdgeDeflection(myclass;
|
||||||
|
edge : Edge from TopoDS;
|
||||||
|
defle : Real from Standard;
|
||||||
|
dtotale : Real from Standard;
|
||||||
|
cdef : out Real from Standard)
|
||||||
|
---Purpose: Returns computed relative deflection for edge
|
||||||
|
returns Real from Standard;
|
||||||
|
|
||||||
|
BoxMaxDimension(myclass;
|
||||||
|
box : in Box from Bnd;
|
||||||
|
maxdim : out Real from Standard);
|
||||||
|
---Purpose: Returns the maximal dimension of Bnd_Box
|
||||||
|
|
||||||
InternalVertices
|
InternalVertices
|
||||||
(me : mutable;
|
(me : mutable;
|
||||||
|
@ -126,16 +126,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real theDefle,
|
|||||||
myInshape(theInshape)
|
myInshape(theInshape)
|
||||||
{
|
{
|
||||||
myAllocator = new NCollection_IncAllocator(64000);
|
myAllocator = new NCollection_IncAllocator(64000);
|
||||||
if (theRelative)
|
if(myRelative)
|
||||||
{
|
BoxMaxDimension(theBox, myDtotale);
|
||||||
Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
|
|
||||||
theBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
|
|
||||||
myDtotale = TXmax-TXmin;
|
|
||||||
const Standard_Real dy = TYmax-TYmin;
|
|
||||||
const Standard_Real dz = TZmax-TZmin;
|
|
||||||
if (dy > myDtotale) myDtotale = dy;
|
|
||||||
if (dz > myDtotale) myDtotale = dz;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -156,19 +148,57 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(const Standard_Real theDefle,
|
|||||||
myInshape(theInshape)
|
myInshape(theInshape)
|
||||||
{
|
{
|
||||||
myAllocator = new NCollection_IncAllocator(64000);
|
myAllocator = new NCollection_IncAllocator(64000);
|
||||||
if (theRelative)
|
if(myRelative)
|
||||||
{
|
BoxMaxDimension(theBox, myDtotale);
|
||||||
Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
|
|
||||||
theBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
|
|
||||||
myDtotale = TXmax-TXmin;
|
|
||||||
const Standard_Real dy = TYmax-TYmin;
|
|
||||||
const Standard_Real dz = TZmax-TZmin;
|
|
||||||
if (dy > myDtotale) myDtotale = dy;
|
|
||||||
if (dz > myDtotale) myDtotale = dz;
|
|
||||||
}
|
|
||||||
Perform(theShape);
|
Perform(theShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BoxMaxDimension
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BRepMesh_FastDiscret::BoxMaxDimension(const Bnd_Box& theBox, Standard_Real& theMaxDim)
|
||||||
|
{
|
||||||
|
if(theBox.IsVoid())
|
||||||
|
return;
|
||||||
|
Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
|
||||||
|
theBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
|
||||||
|
theMaxDim = TXmax-TXmin;
|
||||||
|
const Standard_Real dy = TYmax-TYmin;
|
||||||
|
const Standard_Real dz = TZmax-TZmin;
|
||||||
|
if (dy > theMaxDim) theMaxDim = dy;
|
||||||
|
if (dz > theMaxDim) theMaxDim = dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : RelativeEdgeDeflection
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Real BRepMesh_FastDiscret::RelativeEdgeDeflection(const TopoDS_Edge& theEdge,
|
||||||
|
const Standard_Real theDefle,
|
||||||
|
const Standard_Real theDTotale,
|
||||||
|
Standard_Real& theDefCoef)
|
||||||
|
{
|
||||||
|
theDefCoef = 1.;
|
||||||
|
Standard_Real defedge = theDefle;
|
||||||
|
if(theEdge.IsNull())
|
||||||
|
return defedge;
|
||||||
|
|
||||||
|
Bnd_Box B;
|
||||||
|
BRepBndLib::Add(theEdge, B);
|
||||||
|
BoxMaxDimension(B, defedge);
|
||||||
|
|
||||||
|
// adjusted in relation to the total size:
|
||||||
|
theDefCoef = theDTotale/(2*defedge);
|
||||||
|
if (theDefCoef < 0.5) theDefCoef = 0.5;
|
||||||
|
if (theDefCoef > 2.) theDefCoef = 2.;
|
||||||
|
defedge = theDefCoef * defedge * theDefle;
|
||||||
|
|
||||||
|
return defedge;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Perform(shape)
|
//function : Perform(shape)
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -270,7 +300,6 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
|||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
Standard_Real defedge, defface;
|
Standard_Real defedge, defface;
|
||||||
Standard_Real dx, dy, dz;
|
|
||||||
Standard_Integer nbEdge = 0;
|
Standard_Integer nbEdge = 0;
|
||||||
Standard_Real savangle = myAngle;
|
Standard_Real savangle = myAngle;
|
||||||
Standard_Real cdef;
|
Standard_Real cdef;
|
||||||
@ -301,20 +330,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
|||||||
defedge = P->Deflection();
|
defedge = P->Deflection();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Bnd_Box B;
|
defedge = RelativeEdgeDeflection(edge, myDeflection, myDtotale, cdef);
|
||||||
BRepBndLib::Add(edge, B);
|
|
||||||
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
|
||||||
dx = aXmax-aXmin;
|
|
||||||
dy = aYmax-aYmin;
|
|
||||||
dz = aZmax-aZmin;
|
|
||||||
defedge = dx;
|
|
||||||
if (defedge < dy) defedge = dy;
|
|
||||||
if (defedge < dz) defedge = dz;
|
|
||||||
// adjusted in relation to the total size:
|
|
||||||
cdef = myDtotale/(2*defedge);
|
|
||||||
if (cdef < 0.5) cdef = 0.5;
|
|
||||||
if (cdef > 2.) cdef = 2.;
|
|
||||||
defedge = cdef * defedge * myDeflection;
|
|
||||||
myAngle = savangle * cdef;
|
myAngle = savangle * cdef;
|
||||||
}
|
}
|
||||||
defface = defface + defedge;
|
defface = defface + defedge;
|
||||||
@ -510,7 +526,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
|||||||
BS.D0 (myumin, myvmin, P11);
|
BS.D0 (myumin, myvmin, P11);
|
||||||
BS.D0 (myumin, dfvave, P21);
|
BS.D0 (myumin, dfvave, P21);
|
||||||
BS.D0 (myumin, myvmax, P31);
|
BS.D0 (myumin, myvmax, P31);
|
||||||
for (i1=0, dfucur=myumin; i1 <= 20; i1++, dfucur+=du) {
|
for (i1=1, dfucur=myumin+du; i1 <= 20; i1++, dfucur+=du) {
|
||||||
BS.D0 (dfucur, myvmin, P12);
|
BS.D0 (dfucur, myvmin, P12);
|
||||||
BS.D0 (dfucur, dfvave, P22);
|
BS.D0 (dfucur, dfvave, P22);
|
||||||
BS.D0 (dfucur, myvmax, P32);
|
BS.D0 (dfucur, myvmax, P32);
|
||||||
@ -523,7 +539,7 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
|||||||
BS.D0(myumin, myvmin, P11);
|
BS.D0(myumin, myvmin, P11);
|
||||||
BS.D0(dfuave, myvmin, P21);
|
BS.D0(dfuave, myvmin, P21);
|
||||||
BS.D0(myumax, myvmin, P31);
|
BS.D0(myumax, myvmin, P31);
|
||||||
for (i1=0, dfvcur=myvmin; i1 <= 20; i1++, dfvcur+=dv) {
|
for (i1=1, dfvcur=myvmin+dv; i1 <= 20; i1++, dfvcur+=dv) {
|
||||||
BS.D0 (myumin, dfvcur, P12);
|
BS.D0 (myumin, dfvcur, P12);
|
||||||
BS.D0 (dfuave, dfvcur, P22);
|
BS.D0 (dfuave, dfvcur, P22);
|
||||||
BS.D0 (myumax, dfvcur, P32);
|
BS.D0 (myumax, dfvcur, P32);
|
||||||
@ -663,7 +679,6 @@ void BRepMesh_FastDiscret::Add(const TopoDS_Face& theface)
|
|||||||
myStructure.Nullify();
|
myStructure.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Add
|
//function : Add
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -224,9 +224,6 @@ void BRepMesh_FastDiscretFace::Add(const TopoDS_Face& theFace
|
|||||||
|
|
||||||
switch (thetype)
|
switch (thetype)
|
||||||
{
|
{
|
||||||
case GeomAbs_Plane:
|
|
||||||
rajout = !classifier->NaturalRestriction();
|
|
||||||
break;
|
|
||||||
case GeomAbs_Sphere:
|
case GeomAbs_Sphere:
|
||||||
case GeomAbs_Torus:
|
case GeomAbs_Torus:
|
||||||
rajout = Standard_True;
|
rajout = Standard_True;
|
||||||
@ -617,24 +614,7 @@ void BRepMesh_FastDiscretFace::InternalVertices(const Handle(BRepAdaptor_HSurfac
|
|||||||
Standard_Real deltaX = myAttrib->GetDeltaX();
|
Standard_Real deltaX = myAttrib->GetDeltaX();
|
||||||
Standard_Real deltaY = myAttrib->GetDeltaY();
|
Standard_Real deltaY = myAttrib->GetDeltaY();
|
||||||
|
|
||||||
if (thetype == GeomAbs_Plane && !theClassifier->NaturalRestriction())
|
if (thetype == GeomAbs_Sphere)
|
||||||
{
|
|
||||||
// rajout d`un seul point au milieu.
|
|
||||||
const Standard_Real U = 0.5*(umin+umax);
|
|
||||||
const Standard_Real V = 0.5*(vmin+vmax);
|
|
||||||
if (theClassifier->Perform(gp_Pnt2d(U, V)) == TopAbs_IN)
|
|
||||||
{
|
|
||||||
// Record 3d point
|
|
||||||
BRepMesh_GeomTool::D0(theCaro, U, V, p3d);
|
|
||||||
myNbLocat++;
|
|
||||||
myLocation3d.Bind(myNbLocat, p3d);
|
|
||||||
// Record 2d point
|
|
||||||
p2d.SetCoord((U-umin)/deltaX, (V-vmin)/deltaY);
|
|
||||||
newV.Initialize(p2d.XY(), myNbLocat, BRepMesh_Free);
|
|
||||||
theInternalV.Append(newV);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (thetype == GeomAbs_Sphere)
|
|
||||||
{
|
{
|
||||||
gp_Sphere S = BS.Sphere();
|
gp_Sphere S = BS.Sphere();
|
||||||
const Standard_Real R = S.Radius();
|
const Standard_Real R = S.Radius();
|
||||||
|
@ -178,20 +178,11 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Shape& S)
|
|||||||
myModified = Standard_False;
|
myModified = Standard_False;
|
||||||
TopExp_Explorer ex;
|
TopExp_Explorer ex;
|
||||||
|
|
||||||
Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
|
|
||||||
Standard_Real dx, dy, dz;
|
|
||||||
|
|
||||||
//AGV 080407: Since version 6.2.0 there would be exception without this check
|
//AGV 080407: Since version 6.2.0 there would be exception without this check
|
||||||
if (myBox.IsVoid())
|
if (myBox.IsVoid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
|
BRepMesh_FastDiscret::BoxMaxDimension(myBox, mydtotale);
|
||||||
dx = TXmax-TXmin;
|
|
||||||
dy = TYmax-TYmin;
|
|
||||||
dz = TZmax-TZmin;
|
|
||||||
mydtotale = dx;
|
|
||||||
if (dy > mydtotale) mydtotale = dy;
|
|
||||||
if (dz > mydtotale) mydtotale = dz;
|
|
||||||
|
|
||||||
for (ex.Init(S, TopAbs_EDGE); ex.More(); ex.Next()) {
|
for (ex.Init(S, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||||
if(BRep_Tool::IsGeometric(TopoDS::Edge(ex.Current()))) {
|
if(BRep_Tool::IsGeometric(TopoDS::Edge(ex.Current()))) {
|
||||||
@ -231,7 +222,7 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Shape& S)
|
|||||||
Standard_Real f, l, defedge;
|
Standard_Real f, l, defedge;
|
||||||
Standard_Integer i, nbNodes;
|
Standard_Integer i, nbNodes;
|
||||||
TopLoc_Location L;
|
TopLoc_Location L;
|
||||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
Standard_Real cdef = 1.;
|
||||||
ex.Init(S ,TopAbs_EDGE, TopAbs_FACE);
|
ex.Init(S ,TopAbs_EDGE, TopAbs_FACE);
|
||||||
|
|
||||||
while (ex.More()) {
|
while (ex.More()) {
|
||||||
@ -242,23 +233,11 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Shape& S)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myRelative) {
|
if (myRelative)
|
||||||
Bnd_Box B;
|
defedge = BRepMesh_FastDiscret::RelativeEdgeDeflection(E, myDeflection,
|
||||||
BRepBndLib::Add(E, B);
|
mydtotale, cdef);
|
||||||
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
else
|
||||||
dx = aXmax-aXmin;
|
defedge = myDeflection;
|
||||||
dy = aYmax-aYmin;
|
|
||||||
dz = aZmax-aZmin;
|
|
||||||
defedge = dx;
|
|
||||||
if (defedge < dy) defedge = dy;
|
|
||||||
if (defedge < dz) defedge = dz;
|
|
||||||
// ajustement par rapport a la taille totale:
|
|
||||||
Standard_Real cdef = mydtotale/(2*defedge);
|
|
||||||
if (cdef < 0.5) cdef = 0.5;
|
|
||||||
if (cdef > 2.) cdef = 2.;
|
|
||||||
defedge = cdef * defedge * myDeflection;
|
|
||||||
}
|
|
||||||
else defedge = myDeflection;
|
|
||||||
|
|
||||||
Handle(Poly_Polygon3D) P3D = BRep_Tool::Polygon3D(E, L);
|
Handle(Poly_Polygon3D) P3D = BRep_Tool::Polygon3D(E, L);
|
||||||
Standard_Boolean maill = Standard_False;
|
Standard_Boolean maill = Standard_False;
|
||||||
@ -279,8 +258,8 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Shape& S)
|
|||||||
TColgp_Array1OfPnt Nodes(1, nbNodes);
|
TColgp_Array1OfPnt Nodes(1, nbNodes);
|
||||||
TColStd_Array1OfReal UVNodes(1, nbNodes);
|
TColStd_Array1OfReal UVNodes(1, nbNodes);
|
||||||
for ( i = 1; i <= nbNodes; i++) {
|
for ( i = 1; i <= nbNodes; i++) {
|
||||||
Nodes(i) = TD.Value(i);
|
Nodes(i) = TD.Value(i);
|
||||||
UVNodes(i) = TD.Parameter(i);
|
UVNodes(i) = TD.Parameter(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
@ -305,6 +284,7 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Edge& E)
|
|||||||
Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
|
Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
|
||||||
Standard_Boolean found = Standard_False;
|
Standard_Boolean found = Standard_False;
|
||||||
Standard_Real defedge;
|
Standard_Real defedge;
|
||||||
|
Standard_Real cdef = 1.;
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
Standard_Boolean defined = Standard_False;
|
Standard_Boolean defined = Standard_False;
|
||||||
|
|
||||||
@ -313,33 +293,20 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Edge& E)
|
|||||||
i++;
|
i++;
|
||||||
if (!T.IsNull() && !Poly.IsNull()) {
|
if (!T.IsNull() && !Poly.IsNull()) {
|
||||||
if (!defined) {
|
if (!defined) {
|
||||||
if (myRelative) {
|
if (myRelative)
|
||||||
Bnd_Box aBox;
|
defedge = BRepMesh_FastDiscret::RelativeEdgeDeflection(E, myDeflection,
|
||||||
BRepBndLib::Add(E, aBox);
|
mydtotale, cdef);
|
||||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
|
else
|
||||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
defedge = myDeflection;
|
||||||
dx = aXmax-aXmin;
|
mymapedge.Bind(E, defedge);
|
||||||
dy = aYmax-aYmin;
|
defined = Standard_True;
|
||||||
dz = aZmax-aZmin;
|
|
||||||
defedge = dx;
|
|
||||||
if (defedge < dy) defedge = dy;
|
|
||||||
if (defedge < dz) defedge = dz;
|
|
||||||
// ajustement par rapport a la taille totale:
|
|
||||||
Standard_Real cdef = mydtotale/(2*defedge);
|
|
||||||
if (cdef < 0.5) cdef = 0.5;
|
|
||||||
if (cdef > 2.) cdef = 2.;
|
|
||||||
defedge = cdef * defedge * myDeflection;
|
|
||||||
}
|
|
||||||
else defedge = myDeflection;
|
|
||||||
mymapedge.Bind(E, defedge);
|
|
||||||
defined = Standard_True;
|
|
||||||
}
|
}
|
||||||
if ((!myRelative && Poly->Deflection() <= 1.1*defedge) ||
|
if ((!myRelative && Poly->Deflection() <= 1.1*defedge) ||
|
||||||
(myRelative && Poly->Deflection() <= 1.1*defedge))
|
(myRelative && Poly->Deflection() <= 1.1*defedge))
|
||||||
found = Standard_True;
|
found = Standard_True;
|
||||||
else {
|
else {
|
||||||
myModified = Standard_True;
|
myModified = Standard_True;
|
||||||
B.UpdateEdge(E, NullPoly, T, l);
|
B.UpdateEdge(E, NullPoly, T, l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!Poly.IsNull());
|
} while (!Poly.IsNull());
|
||||||
@ -369,7 +336,7 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Face& F)
|
|||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
TopExp_Explorer ex;
|
TopExp_Explorer ex;
|
||||||
|
|
||||||
Standard_Real defedge, defface;
|
Standard_Real defedge, defface, cdef = 1.;
|
||||||
Standard_Integer nbEdge = 0;
|
Standard_Integer nbEdge = 0;
|
||||||
if (myRelative) {
|
if (myRelative) {
|
||||||
defface = 0.;
|
defface = 0.;
|
||||||
@ -378,25 +345,10 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Face& F)
|
|||||||
const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
|
const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
|
||||||
nbEdge++;
|
nbEdge++;
|
||||||
if (mymapedge.IsBound(edge)) {
|
if (mymapedge.IsBound(edge)) {
|
||||||
defedge = mymapedge(edge);
|
defedge = mymapedge(edge);
|
||||||
}
|
|
||||||
else {
|
|
||||||
Bnd_Box aBox;
|
|
||||||
BRepBndLib::Add(edge, aBox);
|
|
||||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
|
|
||||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
|
||||||
dx = aXmax-aXmin;
|
|
||||||
dy = aYmax-aYmin;
|
|
||||||
dz = aZmax-aZmin;
|
|
||||||
defedge = dx;
|
|
||||||
if (defedge < dy) defedge = dy;
|
|
||||||
if (defedge < dz) defedge = dz;
|
|
||||||
// ajustement par rapport a la taille totale:
|
|
||||||
Standard_Real cdef = mydtotale/(2*defedge);
|
|
||||||
if (cdef < 0.5) cdef = 0.5;
|
|
||||||
if (cdef > 2.) cdef = 2.;
|
|
||||||
defedge = cdef * defedge * myDeflection;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
defedge = BRepMesh_FastDiscret::RelativeEdgeDeflection(edge, myDeflection, mydtotale, cdef);
|
||||||
defface = defface + defedge;
|
defface = defface + defedge;
|
||||||
}
|
}
|
||||||
if (nbEdge != 0) defface = defface / nbEdge;
|
if (nbEdge != 0) defface = defface / nbEdge;
|
||||||
@ -407,18 +359,16 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Face& F)
|
|||||||
|
|
||||||
if (!T.IsNull()) {
|
if (!T.IsNull()) {
|
||||||
if ((!myRelative && T->Deflection() <= 1.1*defface) ||
|
if ((!myRelative && T->Deflection() <= 1.1*defface) ||
|
||||||
(myRelative && T->Deflection() <= 1.1*defface)) {
|
(myRelative && T->Deflection() <= 1.1*defface)) {
|
||||||
for (ex.Init(F, TopAbs_EDGE);
|
for (ex.Init(F, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||||
ex.More();
|
const TopoDS_Shape& E = ex.Current();
|
||||||
ex.Next()) {
|
Poly = BRep_Tool::PolygonOnTriangulation(TopoDS::Edge(E), T, l);
|
||||||
const TopoDS_Shape& E = ex.Current();
|
if (Poly.IsNull() || myMap.Contains(E)) {
|
||||||
Poly = BRep_Tool::PolygonOnTriangulation(TopoDS::Edge(E), T, l);
|
WillBeTriangulated = Standard_True;
|
||||||
if (Poly.IsNull() || myMap.Contains(E)) {
|
// cas un peu special. la triangulation est bonne, mais
|
||||||
WillBeTriangulated = Standard_True;
|
// l'edge n'a pas de representation polygonalisee sur celle-ci.
|
||||||
// cas un peu special. la triangulation est bonne, mais
|
break;
|
||||||
// l'edge n'a pas de representation polygonalisee sur celle-ci.
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else WillBeTriangulated = Standard_True;
|
else WillBeTriangulated = Standard_True;
|
||||||
@ -428,8 +378,8 @@ void BRepMesh_IncrementalMesh::Update(const TopoDS_Face& F)
|
|||||||
myModified = Standard_True;
|
myModified = Standard_True;
|
||||||
if (!T.IsNull()) {
|
if (!T.IsNull()) {
|
||||||
for (ex.Init(F, TopAbs_EDGE); ex.More(); ex.Next()) {
|
for (ex.Init(F, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||||
B.UpdateEdge(TopoDS::Edge(ex.Current()), NullPoly, T, l);
|
B.UpdateEdge(TopoDS::Edge(ex.Current()), NullPoly, T, l);
|
||||||
myMap.Remove(ex.Current());
|
myMap.Remove(ex.Current());
|
||||||
}
|
}
|
||||||
B.UpdateFace(F, TNull);
|
B.UpdateFace(F, TNull);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user