mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
15 Commits
CR0-751-Fi
...
V7_5_3
Author | SHA1 | Date | |
---|---|---|---|
|
fecb042498 | ||
|
c194e1bc39 | ||
|
96815dec17 | ||
|
03e79361dc | ||
|
3a8f6b11e8 | ||
|
45ec28cf68 | ||
|
7aaaf5eb13 | ||
|
0dc2c377fc | ||
|
1078e94941 | ||
|
6b26c6d26d | ||
|
dd56857183 | ||
|
2c8eacb996 | ||
|
3b05b748de | ||
|
91e51cb0f2 | ||
|
bb00fe2713 |
@@ -1356,9 +1356,7 @@ MF.Add(W);
|
||||
TopoDS_Face F = MF;
|
||||
~~~~~
|
||||
|
||||
More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked). The edges on a Face must have a parametric curve description.
|
||||
|
||||
If there is no parametric curve for an edge of the wire on the Face it is computed by projection.
|
||||
More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked).
|
||||
|
||||
For one wire, a simple syntax is provided to construct the face from the surface and the wire. The above lines could be written:
|
||||
|
||||
@@ -1366,6 +1364,8 @@ For one wire, a simple syntax is provided to construct the face from the surfac
|
||||
TopoDS_Face F = BRepBuilderAPI_MakeFace(C,W);
|
||||
~~~~~
|
||||
|
||||
The edges on a face must have a parametric curve description. If there is no parametric curve for an edge of the wire on the face it is computed by projection, moreover, the calculation is possible only for the planar face.
|
||||
|
||||
A planar face can be created from only a wire, provided this wire defines a plane. For example, to create a planar face from a set of points you can use *BRepBuilderAPI_MakePolygon* and *BRepBuilderAPI_MakeFace*.
|
||||
|
||||
~~~~~
|
||||
|
@@ -648,8 +648,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
// check if the pave block has a valid range
|
||||
Standard_Real aFirst, aLast;
|
||||
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aTolR3D,
|
||||
aT1, BRep_Tool::Pnt(aV1), BRep_Tool::Tolerance(aV1),
|
||||
aT2, BRep_Tool::Pnt(aV2), BRep_Tool::Tolerance(aV2),
|
||||
aT1, BRep_Tool::Pnt(aV1), Max (aTolR3D, BRep_Tool::Tolerance(aV1)),
|
||||
aT2, BRep_Tool::Pnt(aV2), Max (aTolR3D, BRep_Tool::Tolerance(aV2)),
|
||||
aFirst, aLast))
|
||||
{
|
||||
// If the pave block does not have valid range, i.e. it is completely
|
||||
@@ -3035,9 +3035,21 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aDistVP > aTolV)
|
||||
// Check if there will be valid range on the curve
|
||||
Standard_Real aFirst, aLast;
|
||||
Standard_Real aNewTolV = Max(aTolV, aDistVP + BOPTools_AlgoTools::DTolerance());
|
||||
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
|
||||
aT[0], aP[0], aNewTolV,
|
||||
aT[1], aP[1], aNewTolV,
|
||||
aFirst, aLast))
|
||||
{
|
||||
Standard_Integer nVn = UpdateVertex(nV, aDistVP + BOPTools_AlgoTools::DTolerance());
|
||||
// No valid range
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNewTolV > aTolV)
|
||||
{
|
||||
Standard_Integer nVn = UpdateVertex(nV, aNewTolV);
|
||||
if (nVn != nV)
|
||||
{
|
||||
aPave.SetIndex(nVn);
|
||||
@@ -3046,17 +3058,6 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
||||
aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV)));
|
||||
}
|
||||
|
||||
// Check if there will be valid range on the curve
|
||||
Standard_Real aFirst, aLast;
|
||||
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
|
||||
aT[0], aP[0], aTolV,
|
||||
aT[1], aP[1], aTolV,
|
||||
aFirst, aLast))
|
||||
{
|
||||
// No valid range
|
||||
return;
|
||||
}
|
||||
|
||||
// Add closing pave to the curve
|
||||
BOPDS_Pave aNewPave;
|
||||
aNewPave.SetIndex(nV);
|
||||
|
@@ -135,6 +135,9 @@ public:
|
||||
Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
|
||||
|
||||
//! Make a face from a Surface and a wire.
|
||||
//! If the surface S is not plane,
|
||||
//! it must contain pcurves for all edges in W,
|
||||
//! otherwise the wrong shape will be created.
|
||||
Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
|
||||
|
||||
//! Adds the wire <W> in the face <F>
|
||||
|
@@ -1450,6 +1450,10 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
|
||||
for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++)
|
||||
{
|
||||
const TopoDS_Shape& aVshape = aVEdges->Value(i, inde);
|
||||
if (aVshape.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aVshape.ShapeType() == TopAbs_EDGE ||
|
||||
aVshape.ShapeType() == TopAbs_FACE)
|
||||
ListVshapes->Append(aVshape);
|
||||
|
@@ -2969,13 +2969,25 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
|
||||
// Construction of the shell
|
||||
TopoDS_Shell shell;
|
||||
B.MakeShell(shell);
|
||||
Standard_Integer aNbFaces = 0;
|
||||
for (ipath=1; ipath<=NbPath; ipath++)
|
||||
for (isec=1; isec <=NbLaw; isec++) {
|
||||
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
|
||||
for (isec=1; isec <=NbLaw; isec++)
|
||||
{
|
||||
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
|
||||
if (!face.IsNull() &&
|
||||
(face.ShapeType() == TopAbs_FACE) ) B.Add(shell, face);
|
||||
(face.ShapeType() == TopAbs_FACE) )
|
||||
{
|
||||
B.Add(shell, face);
|
||||
aNbFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
isDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
TopTools_ListIteratorOfListOfShape It(myAuxShape);
|
||||
for (; It.More(); It.Next()) {
|
||||
const TopoDS_Shape& face = It.Value();
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <IntRes2d_IntersectionSegment.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
@@ -278,6 +279,14 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
Handle(BRepAlgo_AsDes) theAsDes2d,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
{
|
||||
// Update vertices
|
||||
TopTools_ListIteratorOfListOfShape aIt(theLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
|
||||
BRep_Builder().UpdateVertex(aV, theTol);
|
||||
}
|
||||
|
||||
// Get vertices already added to the edge and check the distances to the new ones
|
||||
const TopTools_ListOfShape& aLVEx = theAsDes2d->Descendant(theEdge);
|
||||
if (!IsToUpdate && aLVEx.IsEmpty()) {
|
||||
if (theLV.Extent()) theAsDes2d->Add(theEdge, theLV);
|
||||
@@ -285,21 +294,23 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
}
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve aProjPC;
|
||||
Standard_Real aTolE = 0.0;
|
||||
if (IsToUpdate) {
|
||||
Standard_Real aT1, aT2;
|
||||
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(theEdge, aT1, aT2);
|
||||
aProjPC.Init(aC, aT1, aT2);
|
||||
aTolE = BRep_Tool::Tolerance(theEdge);
|
||||
}
|
||||
//
|
||||
TopTools_MapOfShape aMV;
|
||||
TopTools_ListIteratorOfListOfShape aIt(theLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
for (aIt.Init(theLV); aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
|
||||
if (!aMV.Add(aV)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& aP = BRep_Tool::Pnt(aV);
|
||||
const Standard_Real aTol = BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
TopTools_ListOfShape aLVC;
|
||||
TopTools_ListIteratorOfListOfShape aItEx(aLVEx);
|
||||
@@ -309,7 +320,8 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
break;
|
||||
}
|
||||
const gp_Pnt& aPEx = BRep_Tool::Pnt(aVEx);
|
||||
if (aP.IsEqual(aPEx, theTol)) {
|
||||
const Standard_Real aTolVEx = BRep_Tool::Tolerance(aVEx);
|
||||
if (aP.IsEqual(aPEx, aTol + aTolVEx)) {
|
||||
aLVC.Append(aVEx);
|
||||
}
|
||||
}
|
||||
@@ -325,16 +337,13 @@ static void Store(const TopoDS_Edge& theEdge,
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aProjPC.LowerDistance() > theTol) {
|
||||
if (aProjPC.LowerDistance() > aTol + aTolE) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Real aT = aProjPC.LowerDistanceParameter();
|
||||
TopoDS_Shape aLocalShape = aV.Oriented(TopAbs_INTERNAL);
|
||||
BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, theTol);
|
||||
}
|
||||
else {
|
||||
BRep_Builder().UpdateVertex(aV, theTol);
|
||||
BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, aTol);
|
||||
}
|
||||
//
|
||||
if (aLVC.Extent()) {
|
||||
@@ -672,7 +681,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
return;
|
||||
|
||||
Standard_Real f[3],l[3];
|
||||
Standard_Real TolDub = 1.e-7;
|
||||
Standard_Real TolDub = 1.e-7, TolLL = 0.0;
|
||||
Standard_Integer i;
|
||||
|
||||
//BRep_Tool::Range(E1, f[1], l[1]);
|
||||
@@ -689,9 +698,6 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
BRepLib::BuildCurve3d(E1);
|
||||
BRepLib::BuildCurve3d(E2);
|
||||
|
||||
Standard_Real TolSum = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolSum = Max( TolSum, 1.e-5 );
|
||||
|
||||
TColgp_SequenceOfPnt ResPoints;
|
||||
TColStd_SequenceOfReal ResParamsOnE1, ResParamsOnE2;
|
||||
gp_Pnt DegPoint;
|
||||
@@ -721,11 +727,19 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
(GAC2.GetType() == GeomAbs_Line))
|
||||
{
|
||||
// Just quickly check if lines coincide
|
||||
if (GAC1.Line().Direction().IsParallel (GAC2.Line().Direction(), 1.e-8))
|
||||
Standard_Real anAngle = Abs(GAC1.Line().Direction().Angle(GAC2.Line().Direction()));
|
||||
if (anAngle <= 1.e-8 || M_PI - anAngle <= 1.e-8)
|
||||
{
|
||||
theCoincide = Standard_True;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Take into account the intersection range of line-line intersection
|
||||
// (the smaller angle between curves, the bigger range)
|
||||
TolLL = IntTools_Tools::ComputeIntRange(TolDub, TolDub, anAngle);
|
||||
TolLL = Min (TolLL, 1.e-5);
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
|
||||
@@ -943,10 +957,12 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
else
|
||||
theImageVV.Bind (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
|
||||
}
|
||||
|
||||
|
||||
////-----------------------------------------------------
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolStore = Max (TolStore, Tol);
|
||||
// Compare to Line-Line tolerance
|
||||
TolStore = Max (TolStore, TolLL);
|
||||
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
|
||||
}
|
||||
}
|
||||
|
@@ -195,6 +195,12 @@ static
|
||||
BRepOffset_DataMapOfShapeMapOfShape& theLocValidEdges,
|
||||
BRepOffset_DataMapOfShapeMapOfShape& theNeutralEdges);
|
||||
|
||||
static
|
||||
void MakeInvertedEdgesInvalid(const TopTools_ListOfShape& theLFOffset,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
|
||||
const TopTools_MapOfShape& theInvertedEdges,
|
||||
TopTools_IndexedMapOfShape& theInvEdges);
|
||||
|
||||
static
|
||||
void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
|
||||
const TopTools_IndexedMapOfShape& theInvEdges,
|
||||
@@ -1030,6 +1036,10 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
|
||||
FindInvalidEdges (aLFDone, theFImages, theFacesOrigins, theAnalyse,
|
||||
theInvEdges, theValidEdges, aDMFMIE, aDMFMVE, aDMFMNE);
|
||||
|
||||
// Additional step to mark inverted edges located inside loops
|
||||
// of invalid edges as invalid as well
|
||||
MakeInvertedEdgesInvalid(aLFDone, theFImages, theInvertedEdges, theInvEdges);
|
||||
|
||||
#ifdef OFFSET_DEBUG
|
||||
// show invalid edges
|
||||
TopoDS_Compound aCEInv1;
|
||||
@@ -2180,6 +2190,82 @@ void FindInvalidEdges (const TopTools_ListOfShape& theLFOffset,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeInvertedEdgesInvalid
|
||||
//purpose : Makes inverted edges located inside loop of invalid edges, invalid as well
|
||||
//=======================================================================
|
||||
void MakeInvertedEdgesInvalid(const TopTools_ListOfShape& theLFOffset,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
|
||||
const TopTools_MapOfShape& theInvertedEdges,
|
||||
TopTools_IndexedMapOfShape& theInvEdges)
|
||||
{
|
||||
if (theInvEdges.IsEmpty() || theInvertedEdges.IsEmpty())
|
||||
return;
|
||||
|
||||
// Map all invalid edges
|
||||
TopoDS_Compound aCBEInv;
|
||||
BRep_Builder().MakeCompound(aCBEInv);
|
||||
for (Standard_Integer i = 1; i <= theInvEdges.Extent(); ++i)
|
||||
{
|
||||
BRep_Builder().Add(aCBEInv, theInvEdges(i));
|
||||
}
|
||||
|
||||
// Make loops of invalid edges
|
||||
TopTools_ListOfShape aLCB;
|
||||
BOPTools_AlgoTools::MakeConnexityBlocks(aCBEInv, TopAbs_VERTEX, TopAbs_EDGE, aLCB);
|
||||
|
||||
// Analyze each loop on closeness and use only closed ones
|
||||
TopTools_DataMapOfShapeShape aDMVCB;
|
||||
|
||||
for (TopTools_ListOfShape::Iterator itLCB(aLCB); itLCB.More(); itLCB.Next())
|
||||
{
|
||||
const TopoDS_Shape& aCB = itLCB.Value();
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aDMVE;
|
||||
TopExp::MapShapesAndAncestors(aCB, TopAbs_VERTEX, TopAbs_EDGE, aDMVE);
|
||||
Standard_Boolean isClosed = Standard_True;
|
||||
for (Standard_Integer iV = 1; iV <= aDMVE.Extent(); ++iV)
|
||||
{
|
||||
if (aDMVE(iV).Extent() != 2)
|
||||
{
|
||||
isClosed = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isClosed)
|
||||
continue;
|
||||
|
||||
// Bind loop to each vertex of the loop
|
||||
for (Standard_Integer iV = 1; iV <= aDMVE.Extent(); ++iV)
|
||||
{
|
||||
aDMVCB.Bind(aDMVE.FindKey(iV), aCB);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any inverted edges of offset faces are locked inside the loops of invalid edges.
|
||||
// Make such edges invalid as well.
|
||||
for (TopTools_ListOfShape::Iterator itLF(theLFOffset); itLF.More(); itLF.Next())
|
||||
{
|
||||
const TopTools_ListOfShape& aLFIm = theFImages.FindFromKey(itLF.Value());
|
||||
for (TopTools_ListOfShape::Iterator itLFIm(aLFIm); itLFIm.More(); itLFIm.Next())
|
||||
{
|
||||
for (TopExp_Explorer expE(itLFIm.Value(), TopAbs_EDGE); expE.More(); expE.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(expE.Current());
|
||||
if (!theInvEdges.Contains(aE) && theInvertedEdges.Contains(aE))
|
||||
{
|
||||
const TopoDS_Shape* pCB1 = aDMVCB.Seek (TopExp::FirstVertex(aE));
|
||||
const TopoDS_Shape* pCB2 = aDMVCB.Seek (TopExp::LastVertex(aE));
|
||||
if (pCB1 && pCB2 && pCB1->IsSame(*pCB2))
|
||||
{
|
||||
theInvEdges.Add(aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindInvalidFaces
|
||||
//purpose : Looking for the invalid faces by analyzing their invalid edges
|
||||
|
@@ -560,6 +560,10 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
|
||||
di << " -CN dx dy dz : BiNormal is given by dx dy dz\n";
|
||||
di << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed\n";
|
||||
di << " -G guide 0|1(Plan|ACR) 0|1|2(no contact|contact|contact on border) : with guide\n";
|
||||
di << " -SM : Set the maximum degree of approximation\n";
|
||||
di << " paramvalue more then 0 (100 by default)\n";
|
||||
di << " -DM : Set the maximum number of span of approximation\n";
|
||||
di << " paramvalue [1; 14] (11 by default)\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -630,6 +634,42 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
|
||||
(BRepFill_TypeOfContact)KeepContact);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(a[1], "-DM"))
|
||||
{
|
||||
if (n != 3)
|
||||
{
|
||||
di << "bad arguments !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Draw::Atoi(a[2]) > 0 && Draw::Atoi(a[2]) < 15)
|
||||
{
|
||||
Sweep->SetMaxDegree(Draw::Atoi(a[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
di << " -DM paramvalue must be [1; 14]\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(a[1], "-SM"))
|
||||
{
|
||||
if (n != 3)
|
||||
{
|
||||
di << "bad arguments !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Draw::Atoi(a[2]) > 0)
|
||||
{
|
||||
Sweep->SetMaxSegments(Draw::Atoi(a[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
di << " -SM paramvalue must be more then 0\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
di << "The option " << a[1] << " is unknown !\n";
|
||||
@@ -638,7 +678,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// addsweep
|
||||
//=======================================================================
|
||||
@@ -985,9 +1024,9 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("errorsweep", "errorsweep: returns the summary error on resulting surfaces reached by Sweep",
|
||||
__FILE__, errorsweep, g);
|
||||
|
||||
theCommands.Add("simulsweep", "simulsweep r [n] [option]"
|
||||
theCommands.Add("simulsweep", "simulsweep r [n] [option]",
|
||||
__FILE__, simulsweep, g);
|
||||
theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]"
|
||||
theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]",
|
||||
__FILE__, geompipe, g);
|
||||
|
||||
theCommands.Add("middlepath", "middlepath res shape startshape endshape",
|
||||
|
@@ -84,14 +84,21 @@ public:
|
||||
//! Return the Nth extremum on S.
|
||||
Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
//! Change Sequence of SquareDistance
|
||||
TColStd_SequenceOfReal& SquareDistances()
|
||||
{
|
||||
return mySqDist;
|
||||
}
|
||||
//! Change Sequence of PointOnCurv
|
||||
Extrema_SequenceOfPOnCurv& PointsOnCurve()
|
||||
{
|
||||
return myPoint1;
|
||||
}
|
||||
//! Change Sequence of PointOnSurf
|
||||
Extrema_SequenceOfPOnSurf& PointsOnSurf()
|
||||
{
|
||||
return myPoint2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -306,33 +306,83 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
|
||||
Tol(2) = mytol2;
|
||||
Tol(3) = mytol2;
|
||||
//
|
||||
TUVinf(1) = mytmin;
|
||||
TUVinf(2) = trimumin;
|
||||
TUVinf(3) = trimvmin;
|
||||
//
|
||||
TUVsup(1) = mytsup;
|
||||
TUVsup(2) = trimusup;
|
||||
TUVsup(3) = trimvsup;
|
||||
//
|
||||
// Number of particles used in PSO algorithm (particle swarm optimization).
|
||||
const Standard_Integer aNbParticles = 48;
|
||||
//
|
||||
if (aNbVar == 3)
|
||||
|
||||
Standard_Integer aNbIntC = 1;
|
||||
if (C.IsClosed() || C.IsPeriodic())
|
||||
{
|
||||
GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
}
|
||||
else if (aNbVar == 2)
|
||||
{
|
||||
GlobMinConicS(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobMinCQuadric(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
Standard_Real aPeriod = C.Period();
|
||||
if (C.LastParameter() - C.FirstParameter() > 2. * aPeriod / 3.)
|
||||
{
|
||||
aNbIntC = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Find min approximation
|
||||
math_FunctionSetRoot anA(myF, Tol);
|
||||
anA.Perform(myF, TUV, TUVinf, TUVsup);
|
||||
Standard_Integer anInt;
|
||||
Standard_Real dT = (mytsup - mytmin) / aNbIntC;
|
||||
for (anInt = 1; anInt <= aNbIntC; anInt++)
|
||||
{
|
||||
TUVinf(1) = mytmin + (anInt - 1) * dT;
|
||||
TUVinf(2) = trimumin;
|
||||
TUVinf(3) = trimvmin;
|
||||
//
|
||||
TUVsup(1) = TUVinf(1) + dT; // mytsup;
|
||||
TUVsup(2) = trimusup;
|
||||
TUVsup(3) = trimvsup;
|
||||
//
|
||||
if (aNbVar == 3)
|
||||
{
|
||||
GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
}
|
||||
else if (aNbVar == 2)
|
||||
{
|
||||
GlobMinConicS(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobMinCQuadric(C, aNbParticles, TUVinf, TUVsup, TUV);
|
||||
}
|
||||
|
||||
// Find min approximation
|
||||
math_FunctionSetRoot anA(myF, Tol);
|
||||
anA.Perform(myF, TUV, TUVinf, TUVsup);
|
||||
}
|
||||
if (aNbIntC > 1 && myF.NbExt() > 1)
|
||||
{
|
||||
//Try to remove "false" extrema caused by dividing curve interval
|
||||
TColStd_SequenceOfReal& aSqDists = myF.SquareDistances();
|
||||
Extrema_SequenceOfPOnCurv& aPntsOnCrv = myF.PointsOnCurve();
|
||||
Extrema_SequenceOfPOnSurf& aPntsOnSurf = myF.PointsOnSurf();
|
||||
TColStd_SequenceOfReal aSqDists1(aSqDists);
|
||||
Extrema_SequenceOfPOnCurv aPntsOnCrv1(aPntsOnCrv);
|
||||
Extrema_SequenceOfPOnSurf aPntsOnSurf1(aPntsOnSurf);
|
||||
|
||||
Standard_Real aMinDist = aSqDists(1);
|
||||
Standard_Integer i;
|
||||
for (i = 2; i <= aSqDists.Length(); ++i)
|
||||
{
|
||||
Standard_Real aDist = aSqDists(i);
|
||||
if (aDist < aMinDist)
|
||||
{
|
||||
aMinDist = aDist;
|
||||
}
|
||||
}
|
||||
aSqDists.Clear();
|
||||
aPntsOnCrv.Clear();
|
||||
aPntsOnSurf.Clear();
|
||||
Standard_Real aTol = Precision::SquareConfusion();
|
||||
for (i = 1; i <= aSqDists1.Length(); ++i)
|
||||
{
|
||||
Standard_Real aDist = aSqDists1(i);
|
||||
if (Abs(aDist - aMinDist) <= aTol)
|
||||
{
|
||||
aSqDists.Append(aDist);
|
||||
aPntsOnCrv.Append(aPntsOnCrv1(i));
|
||||
aPntsOnSurf.Append(aPntsOnSurf1(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
myDone = Standard_True;
|
||||
|
||||
}
|
||||
|
@@ -882,7 +882,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co
|
||||
|
||||
frenet->Intervals(FrenetInt, S);
|
||||
EvolAroundT->Intervals(LawInt, S);
|
||||
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion);
|
||||
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True);
|
||||
|
||||
return Fusion.Length()-1;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co
|
||||
|
||||
frenet->Intervals(FrenetInt, S);
|
||||
EvolAroundT->Intervals(LawInt, S);
|
||||
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion);
|
||||
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True);
|
||||
|
||||
for(Standard_Integer i = 1; i <= Fusion.Length(); i++)
|
||||
T.ChangeValue(i) = Fusion.Value(i);
|
||||
|
@@ -692,7 +692,7 @@ Standard_Boolean
|
||||
myCurve->Intervals(TrimInt, tmpS);
|
||||
|
||||
TColStd_SequenceOfReal Fusion;
|
||||
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion);
|
||||
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True);
|
||||
|
||||
return Fusion.Length() - 1;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ Standard_Boolean
|
||||
myCurve->Intervals(TrimInt, tmpS);
|
||||
|
||||
TColStd_SequenceOfReal Fusion;
|
||||
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion);
|
||||
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True);
|
||||
|
||||
for (Standard_Integer i = 1; i <= Fusion.Length(); i++)
|
||||
T.ChangeValue(i) = Fusion.Value(i);
|
||||
|
@@ -415,7 +415,8 @@ void GeomLib::DensifyArray1OfReal(const Standard_Integer MinNumPoints,
|
||||
void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1,
|
||||
const TColStd_Array1OfReal& I2,
|
||||
TColStd_SequenceOfReal& Seq,
|
||||
const Standard_Real Epspar)
|
||||
const Standard_Real Epspar,
|
||||
const Standard_Boolean IsAdjustToFirstInterval)
|
||||
{
|
||||
Standard_Integer ind1=1, ind2=1;
|
||||
Standard_Real v1, v2;
|
||||
@@ -432,7 +433,14 @@ void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1,
|
||||
v2 = I2(ind2);
|
||||
if (Abs(v1-v2)<= Epspar) {
|
||||
// Ici les elements de I1 et I2 conviennent .
|
||||
Seq.Append((v1+v2)/2);
|
||||
if (IsAdjustToFirstInterval)
|
||||
{
|
||||
Seq.Append(v1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Seq.Append((v1 + v2) / 2);
|
||||
}
|
||||
ind1++;
|
||||
ind2++;
|
||||
}
|
||||
|
@@ -170,7 +170,19 @@ public:
|
||||
//! non decreasing
|
||||
Standard_EXPORT static void DensifyArray1OfReal (const Standard_Integer MinNumPoints, const TColStd_Array1OfReal& InParameters, Handle(TColStd_HArray1OfReal)& OutParameters);
|
||||
|
||||
Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, const TColStd_Array1OfReal& Interval2, TColStd_SequenceOfReal& Fusion, const Standard_Real Confusion = 1.0e-9);
|
||||
//! This method fuse intervals Interval1 and Interval2 with specified Confusion
|
||||
//! @param Interval1 [in] first interval to fuse
|
||||
//! @param Interval2 [in] second interval to fuse
|
||||
//! @param Confision [in] tolerance to compare intervals
|
||||
//! @param IsAdjustToFirstInterval [in] flag to set method of fusion, if intervals are close
|
||||
//! if false, intervals are fusing by half-division methdod
|
||||
//! if true, intervals are fusing by selecting value from Interval1
|
||||
//! @param Fusion [out] output interval
|
||||
Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1,
|
||||
const TColStd_Array1OfReal& Interval2,
|
||||
TColStd_SequenceOfReal& Fusion,
|
||||
const Standard_Real Confusion = 1.0e-9,
|
||||
const Standard_Boolean IsAdjustToFirstInterval = Standard_False);
|
||||
|
||||
//! this will compute the maximum distance at the
|
||||
//! parameters given in the Parameters array by
|
||||
|
@@ -178,7 +178,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Stop();
|
||||
#endif
|
||||
|
||||
Standard_Boolean isOnDegeneratedBorder = Standard_False;
|
||||
|
||||
if (Cadre) { // update of limits.
|
||||
BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM;
|
||||
}
|
||||
@@ -262,6 +263,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
/ (uv[aCoordIdx - 1] - uvprev[aCoordIdx - 1]) );
|
||||
Standard_Integer aFixIdx = aCoordIdx == 1? 2 : 1; // Fixing index;
|
||||
Uvap(aFixIdx) = uv[aFixIdx - 1] + (uv[aFixIdx - 1] - uvprev[aFixIdx - 1]) * aScaleCoeff;
|
||||
isOnDegeneratedBorder = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,6 +309,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
if (N <= 0) { // jag 941017
|
||||
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
|
||||
Tgtend = Func.IsTangent(); // jag 940616
|
||||
if (isOnDegeneratedBorder)
|
||||
Tgtend = Standard_True;
|
||||
N = -N;
|
||||
}
|
||||
Arrive = (wd2[I].etat == 12); // the line is open
|
||||
@@ -315,6 +319,9 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
aStatus = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
|
||||
NbDivision,PasC,StepSign);
|
||||
|
||||
if (isOnDegeneratedBorder && Tgtend)
|
||||
aStatus = IntWalk_ArretSurPoint;
|
||||
|
||||
StatusPrecedent = aStatus;
|
||||
if (aStatus == IntWalk_PasTropGrand) {// division of the step
|
||||
Arrive = Standard_False;
|
||||
|
@@ -29,6 +29,9 @@
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_Hyperbola.hxx>
|
||||
#include <Geom_Parabola.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ElementarySurface.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
@@ -67,6 +70,7 @@
|
||||
#include <TColGeom_SequenceOfSurface.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfBoolean.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -96,11 +100,10 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,Standard_Transient)
|
||||
|
||||
struct SubSequenceOfEdges
|
||||
{
|
||||
TopTools_SequenceOfShape SeqsEdges;
|
||||
TopoDS_Edge UnionEdges;
|
||||
};
|
||||
static void SplitWire (const TopoDS_Wire& theWire,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopTools_IndexedMapOfShape& theVmap,
|
||||
TopTools_SequenceOfShape& theWireSeq);
|
||||
|
||||
static Standard_Real TrueValueOfOffset(const Standard_Real theValue,
|
||||
const Standard_Real thePeriod)
|
||||
@@ -135,6 +138,40 @@ static void UpdateBoundaries(const Handle(Geom2d_Curve)& thePCurve,
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Boolean TryMakeLine(const Handle(Geom2d_Curve)& thePCurve,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
Handle(Geom2d_Line)& theLine)
|
||||
{
|
||||
gp_Pnt2d aFirstPnt = thePCurve->Value (theFirst);
|
||||
gp_Pnt2d aLastPnt = thePCurve->Value (theLast);
|
||||
gp_Vec2d aVec (aFirstPnt, aLastPnt);
|
||||
Standard_Real aSqLen = aVec.SquareMagnitude();
|
||||
Standard_Real aSqParamLen = (theLast - theFirst)*(theLast - theFirst);
|
||||
if (Abs(aSqLen - aSqParamLen) > Precision::Confusion())
|
||||
return Standard_False;
|
||||
|
||||
gp_Dir2d aDir = aVec;
|
||||
gp_Vec2d anOffset = -aDir;
|
||||
anOffset *= theFirst;
|
||||
gp_Pnt2d anOrigin = aFirstPnt.Translated(anOffset);
|
||||
gp_Lin2d aLin (anOrigin, aDir);
|
||||
|
||||
const Standard_Integer NbSamples = 10;
|
||||
Standard_Real aDelta = (theLast - theFirst)/NbSamples;
|
||||
for (Standard_Integer i = 1; i < NbSamples; i++)
|
||||
{
|
||||
Standard_Real aParam = theFirst + i*aDelta;
|
||||
gp_Pnt2d aPnt = thePCurve->Value(aParam);
|
||||
Standard_Real aDist = aLin.Distance (aPnt);
|
||||
if (aDist > Precision::Confusion())
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theLine = new Geom2d_Line (aLin);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
static void RemoveEdgeFromMap(const TopoDS_Edge& theEdge,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theVEmap)
|
||||
{
|
||||
@@ -1444,18 +1481,330 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
||||
return ResEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnionPCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape& theChain,
|
||||
TopoDS_Edge& theEdge)
|
||||
{
|
||||
TopTools_SequenceOfShape aFaceSeq;
|
||||
|
||||
const TopoDS_Edge& aFirstEdge = TopoDS::Edge(theChain.Value(1));
|
||||
const TopTools_ListOfShape& aFaceList = myEFmap.FindFromKey (aFirstEdge);
|
||||
TopTools_ListIteratorOfListOfShape anItl (aFaceList);
|
||||
for (; anItl.More(); anItl.Next())
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face (anItl.Value());
|
||||
if (myFacePlaneMap.IsBound(aFace))
|
||||
continue;
|
||||
|
||||
if (myFaceNewFace.IsBound(aFace))
|
||||
aFace = TopoDS::Face (myFaceNewFace(aFace));
|
||||
|
||||
BRepAdaptor_Surface aBAsurf (aFace, Standard_False);
|
||||
if (aBAsurf.GetType() == GeomAbs_Plane)
|
||||
continue;
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace, aLoc);
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (Standard_Integer ii = 1; ii <= aFaceSeq.Length(); ii++)
|
||||
{
|
||||
TopLoc_Location aPrevLoc;
|
||||
Handle(Geom_Surface) aPrevSurf = BRep_Tool::Surface (TopoDS::Face(aFaceSeq(ii)), aPrevLoc);
|
||||
if (aPrevSurf == aSurf && aPrevLoc == aLoc)
|
||||
{
|
||||
isFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isFound)
|
||||
continue;
|
||||
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, aFirst, aLast);
|
||||
|
||||
aFaceSeq.Append (aFace);
|
||||
}
|
||||
|
||||
TColGeom2d_SequenceOfCurve ResPCurves;
|
||||
TColStd_SequenceOfReal ResFirsts;
|
||||
TColStd_SequenceOfReal ResLasts;
|
||||
TColStd_SequenceOfReal aTolVerSeq;
|
||||
TopoDS_Edge aPrevEdge;
|
||||
|
||||
for (Standard_Integer j = 1; j <= aFaceSeq.Length(); j++)
|
||||
{
|
||||
TColGeom2d_SequenceOfCurve aPCurveSeq;
|
||||
TColStd_SequenceOfReal aFirstsSeq;
|
||||
TColStd_SequenceOfReal aLastsSeq;
|
||||
TColStd_SequenceOfBoolean aForwardsSeq;
|
||||
GeomAbs_CurveType aCurrentType = GeomAbs_OtherCurve;
|
||||
|
||||
Standard_Real aFirst, aLast;
|
||||
for (Standard_Integer i = 1; i <= theChain.Length(); i++)
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(theChain.Value(i));
|
||||
Standard_Boolean isForward = (anEdge.Orientation() != TopAbs_REVERSED);
|
||||
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, TopoDS::Face(aFaceSeq(j)),
|
||||
aFirst, aLast);
|
||||
if (aPCurve.IsNull())
|
||||
continue;
|
||||
|
||||
Geom2dAdaptor_Curve anAdaptor(aPCurve);
|
||||
GeomAbs_CurveType aType = anAdaptor.GetType();
|
||||
|
||||
Handle(Geom2d_Line) aLine;
|
||||
if (aType == GeomAbs_BSplineCurve ||
|
||||
aType == GeomAbs_BezierCurve)
|
||||
TryMakeLine (aPCurve, aFirst, aLast, aLine);
|
||||
if (!aLine.IsNull())
|
||||
{
|
||||
aPCurve = aLine;
|
||||
anAdaptor.Load (aPCurve);
|
||||
aType = GeomAbs_Line;
|
||||
}
|
||||
|
||||
if (aPCurveSeq.IsEmpty()) {
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
aForwardsSeq.Append(isForward);
|
||||
aCurrentType = aType;
|
||||
aPrevEdge = anEdge;
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Boolean isSameCurve = Standard_False;
|
||||
Standard_Real aNewF = aFirst;
|
||||
Standard_Real aNewL = aLast;
|
||||
if (aPCurve == aPCurveSeq.Last())
|
||||
{
|
||||
isSameCurve = Standard_True;
|
||||
}
|
||||
else if (aType == aCurrentType)
|
||||
{
|
||||
Geom2dAdaptor_Curve aPrevAdaptor(aPCurveSeq.Last());
|
||||
switch (aType) {
|
||||
case GeomAbs_Line: {
|
||||
gp_Lin2d aPrevLin = aPrevAdaptor.Line();
|
||||
gp_Pnt2d aFirstP2d = aPCurve->Value (aFirst);
|
||||
gp_Pnt2d aLastP2d = aPCurve->Value (aLast);
|
||||
if (aPrevLin.Contains (aFirstP2d, Precision::Confusion()) &&
|
||||
aPrevLin.Contains (aLastP2d, Precision::Confusion()))
|
||||
{
|
||||
isSameCurve = Standard_True;
|
||||
gp_Pnt2d p1 = anAdaptor.Value(aFirst);
|
||||
gp_Pnt2d p2 = anAdaptor.Value(aLast);
|
||||
aNewF = ElCLib::Parameter(aPrevLin, p1);
|
||||
aNewL = ElCLib::Parameter(aPrevLin, p2);
|
||||
if (aNewF > aNewL)
|
||||
{
|
||||
Standard_Real aTmp = aNewF;
|
||||
aNewF = aNewL;
|
||||
aNewL = aTmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Circle: {
|
||||
gp_Circ2d aCirc = anAdaptor.Circle();
|
||||
gp_Circ2d aPrevCirc = aPrevAdaptor.Circle();
|
||||
if (aCirc.Location().Distance(aPrevCirc.Location()) <= Precision::Confusion() &&
|
||||
Abs(aCirc.Radius() - aPrevCirc.Radius()) <= Precision::Confusion())
|
||||
{
|
||||
isSameCurve = Standard_True;
|
||||
gp_Pnt2d p1 = anAdaptor.Value(aFirst);
|
||||
gp_Pnt2d p2 = anAdaptor.Value(aLast);
|
||||
aNewF = ElCLib::Parameter(aPrevCirc, p1);
|
||||
aNewL = ElCLib::Parameter(aPrevCirc, p2);
|
||||
if (aNewF > aNewL)
|
||||
{
|
||||
Standard_Real aTmp = aNewF;
|
||||
aNewF = aNewL;
|
||||
aNewL = aTmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isSameCurve) {
|
||||
if (aForwardsSeq.Last() == Standard_True)
|
||||
aLastsSeq.ChangeLast() = aNewL;
|
||||
else
|
||||
aFirstsSeq.ChangeLast() = aNewF;
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
aForwardsSeq.Append(isForward);
|
||||
aCurrentType = aType;
|
||||
TopoDS_Vertex aV;
|
||||
TopExp::CommonVertex(aPrevEdge, anEdge, aV);
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(aV);
|
||||
aTolVerSeq.Append (aTol);
|
||||
}
|
||||
aPrevEdge = anEdge;
|
||||
}
|
||||
|
||||
Handle(Geom2d_Curve) aResPCurve;
|
||||
Standard_Real aResFirst, aResLast;
|
||||
if (aPCurveSeq.Length() == 1) {
|
||||
aResPCurve = aPCurveSeq.Last();
|
||||
aResFirst = aFirstsSeq.Last();
|
||||
aResLast = aLastsSeq.Last();
|
||||
if (aForwardsSeq.Last() == Standard_False)
|
||||
{
|
||||
Standard_Real aNewLast = aResPCurve->ReversedParameter (aResFirst);
|
||||
Standard_Real aNewFirst = aResPCurve->ReversedParameter (aResLast);
|
||||
aResPCurve->Reverse();
|
||||
aResFirst = aNewFirst;
|
||||
aResLast = aNewLast;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//C1 concatenation for PCurveSeq
|
||||
TColGeom2d_Array1OfBSplineCurve tab_c2d(0, aPCurveSeq.Length() - 1);
|
||||
for (Standard_Integer i = 1; i <= aPCurveSeq.Length(); i++) {
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurveSeq(i), aFirstsSeq(i), aLastsSeq(i));
|
||||
if (aForwardsSeq(i) == Standard_False)
|
||||
{
|
||||
aTrPCurve->Reverse();
|
||||
}
|
||||
tab_c2d(i - 1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i - 1), Precision::Confusion());
|
||||
}
|
||||
|
||||
TColStd_Array1OfReal tabtolvertex(0, aTolVerSeq.Length() - 1);
|
||||
Standard_Real aMaxTol = 0.0;
|
||||
for (Standard_Integer i = 1; i <= aTolVerSeq.Length(); i++)
|
||||
{
|
||||
Standard_Real aTol = aTolVerSeq(i);
|
||||
tabtolvertex(i - 1) = aTol;
|
||||
if (aTol > aMaxTol)
|
||||
aMaxTol = aTol;
|
||||
}
|
||||
|
||||
Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
|
||||
Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
|
||||
Standard_Boolean aClosedFlag = Standard_False;
|
||||
Geom2dConvert::ConcatC1(tab_c2d,
|
||||
tabtolvertex,
|
||||
ArrayOfInd2d,
|
||||
concatc2d,
|
||||
aClosedFlag,
|
||||
Precision::Confusion()); //C1 concatenation
|
||||
|
||||
if (concatc2d->Length() > 1)
|
||||
{
|
||||
Geom2dConvert_CompCurveToBSplineCurve Concat2d(concatc2d->Value(concatc2d->Lower()));
|
||||
|
||||
for (Standard_Integer i = concatc2d->Lower() + 1; i <= concatc2d->Upper(); i++)
|
||||
Concat2d.Add(concatc2d->Value(i), aMaxTol, Standard_True);
|
||||
|
||||
concatc2d->SetValue(concatc2d->Lower(), Concat2d.BSplineCurve());
|
||||
}
|
||||
Handle(Geom2d_BSplineCurve) aBSplineCurve = concatc2d->Value(concatc2d->Lower());
|
||||
aResPCurve = aBSplineCurve;
|
||||
aResFirst = aBSplineCurve->FirstParameter();
|
||||
aResLast = aBSplineCurve->LastParameter();
|
||||
}
|
||||
ResPCurves.Append(aResPCurve);
|
||||
ResFirsts.Append(aResFirst);
|
||||
ResLasts.Append(aResLast);
|
||||
}
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(theEdge);
|
||||
|
||||
//Reparametrize pcurves if needed
|
||||
for (Standard_Integer ii = 2; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
if (Abs (ResFirsts(1) - ResFirsts(ii)) > Precision::Confusion() ||
|
||||
Abs (ResLasts(1) - ResLasts(ii)) > Precision::Confusion())
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve =
|
||||
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
|
||||
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
|
||||
aBSplinePCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (ResFirsts(1), ResLasts(1), aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
}
|
||||
|
||||
//Reparametrize 3d curve if needed
|
||||
if (!ResPCurves.IsEmpty())
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aFirst, aLast);
|
||||
if (Abs (aFirst - ResFirsts(1)) > Precision::Confusion() ||
|
||||
Abs (aLast - ResLasts(1)) > Precision::Confusion())
|
||||
{
|
||||
GeomAdaptor_Curve aGAcurve (aCurve);
|
||||
GeomAbs_CurveType aType = aGAcurve.GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
{
|
||||
gp_Lin aLin = aGAcurve.Line();
|
||||
gp_Dir aDir = aLin.Direction();
|
||||
gp_Pnt aPnt = aGAcurve.Value (aFirst);
|
||||
gp_Vec anOffset = -aDir;
|
||||
anOffset *= ResFirsts(1);
|
||||
aPnt.Translate (anOffset);
|
||||
Handle(Geom_Line) aLine = new Geom_Line (aPnt, aDir);
|
||||
aBuilder.UpdateEdge (theEdge, aLine, aTol);
|
||||
}
|
||||
else if (aType == GeomAbs_Circle)
|
||||
{
|
||||
gp_Circ aCirc = aGAcurve.Circle();
|
||||
Standard_Real aRadius = aCirc.Radius();
|
||||
gp_Ax2 aPosition = aCirc.Position();
|
||||
gp_Ax1 anAxis = aPosition.Axis();
|
||||
Standard_Real anOffset = aFirst - ResFirsts(1);
|
||||
aPosition.Rotate (anAxis, anOffset);
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle (aPosition, aRadius);
|
||||
aBuilder.UpdateEdge (theEdge, aCircle, aTol);
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
Handle(Geom_TrimmedCurve) aTrCurve =
|
||||
new Geom_TrimmedCurve (aCurve, aFirst, aLast);
|
||||
Handle(Geom_BSplineCurve) aBSplineCurve = GeomConvert::CurveToBSplineCurve(aTrCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplineCurve->NbKnots());
|
||||
aBSplineCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (ResFirsts(1), ResLasts(1), aKnots);
|
||||
aBSplineCurve->SetKnots (aKnots);
|
||||
aBuilder.UpdateEdge (theEdge, aBSplineCurve, aTol);
|
||||
}
|
||||
}
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
|
||||
for (Standard_Integer j = 1; j <= ResPCurves.Length(); j++)
|
||||
{
|
||||
aBuilder.UpdateEdge(theEdge, ResPCurves(j), TopoDS::Face(aFaceSeq(j)), aTol);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MergeSubSeq
|
||||
//purpose : Merges a sequence of edges into one edge if possible
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
TopoDS_Edge& OutEdge,
|
||||
double theAngTol,
|
||||
Standard_Boolean ConcatBSplines,
|
||||
Standard_Boolean isSafeInputMode,
|
||||
Handle(ShapeBuild_ReShape)& theContext)
|
||||
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
TopoDS_Edge& OutEdge)
|
||||
{
|
||||
ShapeAnalysis_Edge sae;
|
||||
BRep_Builder B;
|
||||
@@ -1521,12 +1870,12 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
if(c3d1.IsNull() || c3d2.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
if (c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) tc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(c3d1);
|
||||
c3d1 = tc->BasisCurve();
|
||||
}
|
||||
while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
if (c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) tc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(c3d2);
|
||||
c3d2 = tc->BasisCurve();
|
||||
@@ -1536,7 +1885,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
|
||||
gp_Dir Dir1 = L1->Position().Direction();
|
||||
gp_Dir Dir2 = L2->Position().Direction();
|
||||
if(!Dir1.IsParallel(Dir2,theAngTol))
|
||||
if (!Dir1.IsParallel (Dir2, myAngTol))
|
||||
IsUnionOfLinesPossible = Standard_False;
|
||||
}
|
||||
else
|
||||
@@ -1564,15 +1913,15 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
V[1] = sae.LastVertex(TopoDS::Edge(theChain.Last()));
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt(V[1]);
|
||||
gp_Vec Vec(PV1, PV2);
|
||||
if (isSafeInputMode) {
|
||||
if (mySafeInputMode) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
if (!theContext->IsRecorded(V[k])) {
|
||||
if (!myContext->IsRecorded(V[k])) {
|
||||
TopoDS_Vertex Vcopy = TopoDS::Vertex(V[k].EmptyCopied());
|
||||
theContext->Replace(V[k], Vcopy);
|
||||
myContext->Replace(V[k], Vcopy);
|
||||
V[k] = Vcopy;
|
||||
}
|
||||
else
|
||||
V[k] = TopoDS::Vertex(theContext->Apply(V[k]));
|
||||
V[k] = TopoDS::Vertex (myContext->Apply(V[k]));
|
||||
}
|
||||
}
|
||||
Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
|
||||
@@ -1583,6 +1932,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
B.Add (E,V[0]); B.Add (E,V[1]);
|
||||
B.UpdateVertex(V[0], 0., E, 0.);
|
||||
B.UpdateVertex(V[1], dist, E, 0.);
|
||||
UnionPCurves(theChain, E);
|
||||
OutEdge = E;
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -1593,7 +1943,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
TopoDS_Edge FE = TopoDS::Edge(theChain.First());
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(FE,f,l);
|
||||
|
||||
while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) tc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(c3d);
|
||||
c3d = tc->BasisCurve();
|
||||
@@ -1638,55 +1988,53 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
B.Add(E,V[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isSafeInputMode) {
|
||||
else //open chain
|
||||
{
|
||||
Standard_Real ParamFirst = BRep_Tool::Parameter(V[0], FE);
|
||||
TopoDS_Vertex VertexLastOnFE = sae.LastVertex(FE);
|
||||
Standard_Real ParamLast = BRep_Tool::Parameter(VertexLastOnFE, FE);
|
||||
|
||||
if (mySafeInputMode) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
if (!theContext->IsRecorded(V[k])) {
|
||||
if (!myContext->IsRecorded(V[k])) {
|
||||
TopoDS_Vertex Vcopy = TopoDS::Vertex(V[k].EmptyCopied());
|
||||
theContext->Replace(V[k], Vcopy);
|
||||
myContext->Replace(V[k], Vcopy);
|
||||
V[k] = Vcopy;
|
||||
}
|
||||
else
|
||||
V[k] = TopoDS::Vertex(theContext->Apply(V[k]));
|
||||
V[k] = TopoDS::Vertex (myContext->Apply(V[k]));
|
||||
}
|
||||
}
|
||||
gp_Pnt PV1 = BRep_Tool::Pnt(V[0]);
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt(V[1]);
|
||||
TopoDS_Vertex VM = sae.LastVertex(FE);
|
||||
gp_Pnt PVM = BRep_Tool::Pnt(VM);
|
||||
GC_MakeCircle MC (PV1,PVM,PV2);
|
||||
Handle(Geom_Circle) C = MC.Value();
|
||||
gp_Pnt P0 = C->Location();
|
||||
gp_Dir D1(gp_Vec(P0,PV1));
|
||||
gp_Dir D2(gp_Vec(P0,PV2));
|
||||
Standard_Real fpar = C->XAxis().Direction().Angle(D1);
|
||||
if(fabs(fpar)>Precision::Confusion()) {
|
||||
// check orientation
|
||||
gp_Dir ND = C->XAxis().Direction().Crossed(D1);
|
||||
if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
|
||||
fpar = -fpar;
|
||||
}
|
||||
}
|
||||
Standard_Real lpar = C->XAxis().Direction().Angle(D2);
|
||||
if(fabs(lpar)>Precision::Confusion()) {
|
||||
// check orientation
|
||||
gp_Dir ND = C->XAxis().Direction().Crossed(D2);
|
||||
if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
|
||||
lpar = -lpar;
|
||||
}
|
||||
}
|
||||
if (lpar < fpar) lpar += 2*M_PI;
|
||||
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
|
||||
|
||||
gp_Pnt PointFirst = BRep_Tool::Pnt(V[0]);
|
||||
while (Abs(ParamLast - ParamFirst) > 7*M_PI/8)
|
||||
ParamLast = (ParamFirst + ParamLast)/2;
|
||||
BRepAdaptor_Curve BAcurveFE(FE);
|
||||
gp_Pnt PointLast = BAcurveFE.Value(ParamLast);
|
||||
gp_Pnt Origin = Cir->Circ().Location();
|
||||
gp_Dir Dir1 = gp_Vec(Origin, PointFirst);
|
||||
gp_Dir Dir2 = gp_Vec(Origin, PointLast);
|
||||
gp_Dir Vdir = Dir1 ^ Dir2;
|
||||
gp_Ax2 anAx2(Origin, Vdir, Dir1);
|
||||
Handle(Geom_Circle) aNewCircle = new Geom_Circle(anAx2, Cir->Radius());
|
||||
gp_Pnt PointLastInChain = BRep_Tool::Pnt(V[1]);
|
||||
gp_Dir DirLastInChain = gp_Vec(Origin, PointLastInChain);
|
||||
Standard_Real lpar = Dir1.AngleWithRef(DirLastInChain, Vdir);
|
||||
if (lpar < 0.)
|
||||
lpar += 2*M_PI;
|
||||
|
||||
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(aNewCircle,0.,lpar);
|
||||
B.MakeEdge (E,tc,Precision::Confusion());
|
||||
B.Add(E,V[0]);
|
||||
B.Add(E,V[1]);
|
||||
B.UpdateVertex(V[0], fpar, E, 0.);
|
||||
B.UpdateVertex(V[0], 0., E, 0.);
|
||||
B.UpdateVertex(V[1], lpar, E, 0.);
|
||||
}
|
||||
UnionPCurves(theChain, E);
|
||||
OutEdge = E;
|
||||
return Standard_True;
|
||||
}
|
||||
if (theChain.Length() > 1 && ConcatBSplines) {
|
||||
if (theChain.Length() > 1 && myConcatBSplines) {
|
||||
// second step: union edges with various curves
|
||||
// skl for bug 0020052 from Mantis: perform such unions
|
||||
// only if curves are bspline or bezier
|
||||
@@ -1699,7 +2047,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
TopLoc_Location Loc;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge,Loc,fp1,lp1);
|
||||
if(c3d.IsNull()) continue;
|
||||
while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) tc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(c3d);
|
||||
c3d = tc->BasisCurve();
|
||||
@@ -1912,15 +2260,10 @@ static void GenerateSubSeq (const TopTools_SequenceOfShape& anInpEdgeSeq,
|
||||
//function : MergeEdges
|
||||
//purpose : auxilary
|
||||
//=======================================================================
|
||||
static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
const Standard_Real theAngTol,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Boolean ConcatBSplines,
|
||||
const Standard_Boolean isSafeInputMode,
|
||||
Handle(ShapeBuild_ReShape)& theContext,
|
||||
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
|
||||
const TopTools_MapOfShape& NonMergVrt)
|
||||
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
|
||||
const TopTools_MapOfShape& NonMergVrt)
|
||||
{
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
|
||||
Standard_Integer j;
|
||||
@@ -2001,7 +2344,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
|
||||
// split chain by vertices at which merging is not possible
|
||||
NCollection_Sequence<SubSequenceOfEdges> aOneSeq;
|
||||
GenerateSubSeq(aChain, aOneSeq, IsClosed, theAngTol, theLinTol, VerticesToAvoid, theVFmap);
|
||||
GenerateSubSeq(aChain, aOneSeq, IsClosed, myAngTol, myLinTol, VerticesToAvoid, theVFmap);
|
||||
|
||||
// put sub-chains in the result
|
||||
SeqOfSubSeqOfEdges.Append(aOneSeq);
|
||||
@@ -2012,9 +2355,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
TopoDS_Edge UE;
|
||||
if (SeqOfSubSeqOfEdges(i).SeqsEdges.Length() < 2)
|
||||
continue;
|
||||
if (MergeSubSeq(SeqOfSubSeqOfEdges(i).SeqsEdges, theVFmap,
|
||||
UE, theAngTol,
|
||||
ConcatBSplines, isSafeInputMode, theContext))
|
||||
if (MergeSubSeq(SeqOfSubSeqOfEdges(i).SeqsEdges, theVFmap, UE))
|
||||
SeqOfSubSeqOfEdges(i).UnionEdges = UE;
|
||||
}
|
||||
return Standard_True;
|
||||
@@ -2025,25 +2366,19 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
//purpose : Tries to unify the sequence of edges with the set of
|
||||
// another edges which lies on the same geometry
|
||||
//=======================================================================
|
||||
static Standard_Boolean MergeSeq (TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
const Standard_Real theAngTol,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Boolean ConcatBSplines,
|
||||
const Standard_Boolean isSafeInputMode,
|
||||
Handle(ShapeBuild_ReShape)& theContext,
|
||||
const TopTools_MapOfShape& nonMergVert)
|
||||
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeSeq (TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
const TopTools_MapOfShape& nonMergVert)
|
||||
{
|
||||
NCollection_Sequence<SubSequenceOfEdges> SeqOfSubsSeqOfEdges;
|
||||
if (MergeEdges(SeqEdges, theVFmap, theAngTol, theLinTol, ConcatBSplines, isSafeInputMode,
|
||||
theContext, SeqOfSubsSeqOfEdges, nonMergVert))
|
||||
if (MergeEdges(SeqEdges, theVFmap, SeqOfSubsSeqOfEdges, nonMergVert))
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= SeqOfSubsSeqOfEdges.Length(); i++ )
|
||||
{
|
||||
if (SeqOfSubsSeqOfEdges(i).UnionEdges.IsNull())
|
||||
continue;
|
||||
|
||||
theContext->Merge(SeqOfSubsSeqOfEdges(i).SeqsEdges,
|
||||
myContext->Merge(SeqOfSubsSeqOfEdges(i).SeqsEdges,
|
||||
SeqOfSubsSeqOfEdges(i).UnionEdges);
|
||||
}
|
||||
return Standard_True;
|
||||
@@ -2143,6 +2478,8 @@ void ShapeUpgrade_UnifySameDomain::Initialize(const TopoDS_Shape& aShape,
|
||||
myContext->Clear();
|
||||
myKeepShapes.Clear();
|
||||
myFacePlaneMap.Clear();
|
||||
myEFmap.Clear();
|
||||
myFaceNewFace.Clear();
|
||||
myHistory->Clear();
|
||||
}
|
||||
|
||||
@@ -2680,6 +3017,7 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
BB.MakeWire(aNewWire);
|
||||
BB.Add(aNewWire, StartEdge);
|
||||
RemoveEdgeFromMap(StartEdge, VEmap);
|
||||
TopTools_IndexedMapOfShape SplittingVertices;
|
||||
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom2d_Curve) StartPCurve = BRep_Tool::CurveOnSurface(StartEdge, F_RefFace, fpar, lpar);
|
||||
@@ -2761,6 +3099,7 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
else
|
||||
{
|
||||
//we must choose the closest direction - the biggest angle
|
||||
SplittingVertices.Add (CurVertex);
|
||||
Standard_Real MaxAngle = RealFirst();
|
||||
TopoDS_Edge TrueEdge;
|
||||
Handle(Geom2d_Curve) CurPCurve = BRep_Tool::CurveOnSurface(CurEdge, F_RefFace, fpar, lpar);
|
||||
@@ -2910,7 +3249,11 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
}
|
||||
else //may be this wire is a hole
|
||||
{
|
||||
NewWires.Append(aNewWire);
|
||||
//split this wire if needed
|
||||
if (!SplittingVertices.IsEmpty())
|
||||
SplitWire (aNewWire, F_RefFace, SplittingVertices, NewWires);
|
||||
else
|
||||
NewWires.Append(aNewWire);
|
||||
}
|
||||
} //while (!edges.IsEmpty())
|
||||
|
||||
@@ -2974,6 +3317,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
BB.Add(aResult, InternalWires(ii));
|
||||
aResult.Orientation(RefFaceOrientation);
|
||||
myContext->Merge(faces, aResult);
|
||||
//Update the map Face-NewFace
|
||||
for (Standard_Integer jj = 1; jj <= faces.Length(); jj++)
|
||||
myFaceNewFace.Bind (faces(jj), aResult);
|
||||
}
|
||||
else if (NewFaces.Length() == 1)
|
||||
{
|
||||
@@ -2983,6 +3329,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
for (Standard_Integer ii = 1; ii <= InternalWires.Length(); ii++)
|
||||
BB.Add(aNewFace, InternalWires(ii));
|
||||
myContext->Merge(faces, NewFaces(1));
|
||||
//Update the map Face-NewFace
|
||||
for (Standard_Integer jj = 1; jj <= faces.Length(); jj++)
|
||||
myFaceNewFace.Bind (faces(jj), NewFaces(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3016,6 +3365,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
facesForThisFace.Append(faces(jj));
|
||||
}
|
||||
myContext->Merge(facesForThisFace, NewFaces(ii));
|
||||
//Update the map Face-NewFace
|
||||
for (Standard_Integer jj = 1; jj <= facesForThisFace.Length(); jj++)
|
||||
myFaceNewFace.Bind (facesForThisFace(jj), NewFaces(ii));
|
||||
}
|
||||
}
|
||||
} //if (faces.Length() > 1)
|
||||
@@ -3052,8 +3404,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
||||
TopTools_MapOfShape aSharedVert;
|
||||
CheckSharedVertices(aSeqEdges, aMapEdgesVertex, myKeepShapes, aSharedVert);
|
||||
// Merge the edges avoiding removal of the shared vertices
|
||||
Standard_Boolean isMerged = MergeSeq(aSeqEdges, aVFmap, myAngTol, myLinTol, myConcatBSplines,
|
||||
mySafeInputMode, myContext, aSharedVert);
|
||||
Standard_Boolean isMerged = MergeSeq(aSeqEdges, aVFmap, aSharedVert);
|
||||
// Collect faces to rebuild
|
||||
TopTools_IndexedMapOfShape aChangedFaces;
|
||||
if (isMerged)
|
||||
@@ -3140,6 +3491,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
||||
//=======================================================================
|
||||
void ShapeUpgrade_UnifySameDomain::Build()
|
||||
{
|
||||
TopExp::MapShapesAndAncestors(myInitShape, TopAbs_EDGE, TopAbs_FACE, myEFmap);
|
||||
|
||||
if (myUnifyFaces)
|
||||
UnifyFaces();
|
||||
if (myUnifyEdges)
|
||||
@@ -3233,3 +3586,112 @@ void ShapeUpgrade_UnifySameDomain::FillHistory()
|
||||
// Merge the history of the operation into global history
|
||||
myHistory->Merge(aUSDHistory);
|
||||
}
|
||||
|
||||
void SplitWire (const TopoDS_Wire& theWire,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopTools_IndexedMapOfShape& theVmap,
|
||||
TopTools_SequenceOfShape& theWireSeq)
|
||||
{
|
||||
TopTools_DataMapOfShapeListOfShape aVEmap;
|
||||
|
||||
TopTools_MapOfShape aEmap;
|
||||
TopoDS_Iterator itw (theWire);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (itw.Value());
|
||||
if (!aEmap.Add (anEdge))
|
||||
continue;
|
||||
if (anEdge.Orientation() != TopAbs_FORWARD &&
|
||||
anEdge.Orientation() != TopAbs_REVERSED)
|
||||
continue;
|
||||
|
||||
const TopoDS_Vertex& aVertex = TopExp::FirstVertex (anEdge, Standard_True); //with orientation
|
||||
if (aVEmap.IsBound (aVertex))
|
||||
aVEmap(aVertex).Append (anEdge);
|
||||
else
|
||||
{
|
||||
TopTools_ListOfShape aElist;
|
||||
aElist.Append (anEdge);
|
||||
aVEmap.Bind (aVertex, aElist);
|
||||
}
|
||||
}
|
||||
|
||||
BRep_Builder aBB;
|
||||
for (Standard_Integer ii = 1; ii <= theVmap.Extent(); ii++)
|
||||
{
|
||||
const TopoDS_Vertex& anOrigin = TopoDS::Vertex (theVmap(ii));
|
||||
TopTools_ListOfShape& aBranches = aVEmap (anOrigin);
|
||||
TopTools_ListIteratorOfListOfShape anItl (aBranches);
|
||||
while (anItl.More())
|
||||
{
|
||||
TopoDS_Edge CurEdge = TopoDS::Edge (anItl.Value());
|
||||
aBranches.Remove (anItl);
|
||||
|
||||
TopoDS_Wire aNewWire;
|
||||
aBB.MakeWire (aNewWire);
|
||||
for (;;)
|
||||
{
|
||||
aBB.Add (aNewWire, CurEdge);
|
||||
|
||||
const TopoDS_Vertex& aVertex = TopExp::LastVertex (CurEdge, Standard_True); //with orientation
|
||||
if (aVertex.IsSame(anOrigin))
|
||||
break;
|
||||
|
||||
if (!aVEmap.IsBound (aVertex))
|
||||
break;
|
||||
|
||||
TopTools_ListOfShape& aElist = aVEmap (aVertex);
|
||||
if (aElist.Extent() == 0)
|
||||
break;
|
||||
|
||||
if (aElist.Extent() == 1)
|
||||
{
|
||||
CurEdge = TopoDS::Edge (aElist.First());
|
||||
aElist.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(CurEdge, theFace, fpar, lpar);
|
||||
Standard_Real aParam = (CurEdge.Orientation() == TopAbs_FORWARD)? lpar : fpar;
|
||||
gp_Pnt2d aPoint;
|
||||
gp_Vec2d CurDir;
|
||||
aPCurve->D1(aParam, aPoint, CurDir);
|
||||
CurDir.Normalize();
|
||||
if (CurEdge.Orientation() == TopAbs_REVERSED)
|
||||
CurDir.Reverse();
|
||||
//choose the rightest direction - the smallest angle
|
||||
Standard_Real MinAngle = RealLast();
|
||||
TopoDS_Edge NextEdge;
|
||||
TopTools_ListIteratorOfListOfShape aLocalIter (aElist);
|
||||
for (; aLocalIter.More(); aLocalIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aLocalIter.Value());
|
||||
aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
|
||||
aParam = (anEdge.Orientation() == TopAbs_FORWARD)? fpar : lpar;
|
||||
gp_Vec2d aDir;
|
||||
aPCurve->D1(aParam, aPoint, aDir);
|
||||
aDir.Normalize();
|
||||
if (anEdge.Orientation() == TopAbs_REVERSED)
|
||||
aDir.Reverse();
|
||||
Standard_Real anAngle = CurDir.Angle(aDir);
|
||||
if (anAngle < MinAngle)
|
||||
{
|
||||
MinAngle = anAngle;
|
||||
NextEdge = anEdge;
|
||||
}
|
||||
}
|
||||
CurEdge = NextEdge;
|
||||
//Remove <CurEdge> from list
|
||||
for (aLocalIter.Initialize(aElist); aLocalIter.More(); aLocalIter.Next())
|
||||
if (CurEdge.IsSame (aLocalIter.Value()))
|
||||
{
|
||||
aElist.Remove (aLocalIter);
|
||||
break;
|
||||
}
|
||||
} //else (more than one edge)
|
||||
} //for (;;)
|
||||
theWireSeq.Append (aNewWire);
|
||||
} //while (anItl.More())
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Precision.hxx>
|
||||
class ShapeBuild_ReShape;
|
||||
@@ -64,6 +65,13 @@ DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, Standard_Transient)
|
||||
//! The algorithm provides a place holder for the history and collects the
|
||||
//! history by default.
|
||||
//! To avoid collecting of the history the place holder should be set to null handle.
|
||||
|
||||
struct SubSequenceOfEdges
|
||||
{
|
||||
TopTools_SequenceOfShape SeqsEdges;
|
||||
TopoDS_Edge UnionEdges;
|
||||
};
|
||||
|
||||
class ShapeUpgrade_UnifySameDomain : public Standard_Transient
|
||||
{
|
||||
|
||||
@@ -166,6 +174,27 @@ protected:
|
||||
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces);
|
||||
|
||||
//! Splits the sequence of edges into the sequence of chains
|
||||
Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
|
||||
const TopTools_MapOfShape& NonMergVrt);
|
||||
|
||||
//! Tries to unify the sequence of edges with the set of
|
||||
//! another edges which lies on the same geometry
|
||||
Standard_Boolean MergeSeq(TopTools_SequenceOfShape& SeqEdges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
const TopTools_MapOfShape& nonMergVert);
|
||||
|
||||
//! Merges a sequence of edges into one edge if possible
|
||||
Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
|
||||
TopoDS_Edge& OutEdge);
|
||||
|
||||
//! Unifies the pcurve of the chain into one pcurve of the edge
|
||||
void UnionPCurves(const TopTools_SequenceOfShape& theChain,
|
||||
TopoDS_Edge& theEdge);
|
||||
|
||||
//! Fills the history of the modifications during the operation.
|
||||
Standard_EXPORT void FillHistory();
|
||||
|
||||
@@ -183,6 +212,8 @@ private:
|
||||
Handle(ShapeBuild_ReShape) myContext;
|
||||
TopTools_MapOfShape myKeepShapes;
|
||||
DataMapOfFacePlane myFacePlaneMap;
|
||||
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
|
||||
TopTools_DataMapOfShapeShape myFaceNewFace;
|
||||
|
||||
Handle(BRepTools_History) myHistory; //!< The history.
|
||||
};
|
||||
|
@@ -35,7 +35,7 @@
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 5
|
||||
#define OCC_VERSION_MAINTENANCE 1
|
||||
#define OCC_VERSION_MAINTENANCE 3
|
||||
|
||||
//! This macro must be commented in official release, and set to non-empty
|
||||
//! string in other situations, to identify specifics of the version, e.g.:
|
||||
@@ -47,7 +47,7 @@
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.5
|
||||
#define OCC_VERSION_STRING "7.5"
|
||||
#define OCC_VERSION_COMPLETE "7.5.1"
|
||||
#define OCC_VERSION_COMPLETE "7.5.3"
|
||||
|
||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||
#ifdef OCC_VERSION_DEVELOPMENT
|
||||
|
@@ -186,9 +186,11 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
|
||||
|
||||
Handle(StepGeom_Curve) Gpms;
|
||||
Handle(Geom_Curve) C = CA.Curve().Curve();
|
||||
|
||||
if (!C.IsNull()) {
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
|
||||
gp_Trsf Tr1 = CA.Trsf();
|
||||
C->Transform(Tr1);
|
||||
// Special treatment is needed for very short edges based on periodic curves.
|
||||
// Since edge in STEP does not store its parametric range, parameters are computed
|
||||
// on import by projecting vertices on a curve, and for periodic curve this may
|
||||
@@ -246,8 +248,7 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
|
||||
}
|
||||
}
|
||||
|
||||
gp_Trsf Tr1 = CA.Trsf();
|
||||
C->Transform(Tr1);
|
||||
|
||||
GeomToStep_MakeCurve MkCurve(C);
|
||||
Gpms = MkCurve.Value();
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ CheckIsFeatureRemoved feature3 {v e f}
|
||||
|
||||
removefeatures res5 s feature4
|
||||
checkshape res5
|
||||
checkprops res5 -s 2387.67 -v 1060.67 -deps 1.e-7
|
||||
checkprops res5 -s 2387.67 -v 1060.68 -deps 1.e-7
|
||||
checknbshapes res5 -vertex 67 -edge 100 -wire 35 -face 35 -shell 1 -solid 1 -t
|
||||
CheckIsFeatureRemoved feature4 {v e f}
|
||||
|
||||
|
@@ -10,6 +10,6 @@ compound s_2 s_25 s_1 s_4 feature
|
||||
|
||||
removefeatures result s feature
|
||||
checkshape result
|
||||
checkprops result -s 2392.41 -v 1063.75 -deps 1.e-7
|
||||
checkprops result -s 2392.42 -v 1063.76 -deps 1.e-7
|
||||
checknbshapes result -vertex 61 -edge 91 -wire 34 -face 33 -shell 1 -solid 1
|
||||
CheckIsFeatureRemoved feature {e f}
|
||||
|
12
tests/bugs/heal/bug31524
Normal file
12
tests/bugs/heal/bug31524
Normal file
@@ -0,0 +1,12 @@
|
||||
puts "TODO OCC31524 ALL: Faulty shapes in variables faulty_1"
|
||||
|
||||
puts "==============================================================================================="
|
||||
puts "0031524: Modeling Algorithms - Unify same domain corrupts shape representing a cylindrical tube"
|
||||
puts "==============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31524.brep] shape
|
||||
|
||||
unifysamedom res shape
|
||||
checkshape shape
|
||||
|
28
tests/bugs/heal/bug31778
Normal file
28
tests/bugs/heal/bug31778
Normal file
@@ -0,0 +1,28 @@
|
||||
puts "============================================="
|
||||
puts "OCC31778: UnifySameDomain fails in Debug mode"
|
||||
puts "============================================="
|
||||
puts ""
|
||||
|
||||
brestore [locate_data_file bug31778.brep] s
|
||||
explode s
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s_1
|
||||
baddtools s_2 s_3
|
||||
bfillds
|
||||
bbop q 1
|
||||
explode q
|
||||
|
||||
unifysamedom result q_1
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -solid 1 -shell 1 -face 19 -wire 21 -edge 51 -vertex 34
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 5.e-5} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -v 15173.9
|
18
tests/bugs/heal/bug32140
Normal file
18
tests/bugs/heal/bug32140
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "=============================================================="
|
||||
puts "OCC32140: unify same domain calls crossed for opposite vectors"
|
||||
puts "=============================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32140.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -solid 1 -shell 1 -face 26 -wire 32 -edge 69 -vertex 41
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
20
tests/bugs/heal/bug32213
Normal file
20
tests/bugs/heal/bug32213
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "==========================================="
|
||||
puts "OCC32213: Invalid result of UnifySameDomain"
|
||||
puts "==========================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32213.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -solid 1 -shell 1 -face 21 -wire 22 -edge 58 -vertex 38
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 81.9221
|
@@ -19,16 +19,18 @@ checkprops result -s 8206.54
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 5
|
||||
EDGE : 9
|
||||
EDGE : 8
|
||||
WIRE : 4
|
||||
FACE : 4
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 25
|
||||
SHAPE : 24
|
||||
"
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations common"
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
||||
|
@@ -19,16 +19,18 @@ checkprops result -s 34566
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 13
|
||||
EDGE : 21
|
||||
EDGE : 20
|
||||
WIRE : 8
|
||||
FACE : 8
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 53
|
||||
SHAPE : 52
|
||||
"
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations cut"
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
||||
|
12
tests/bugs/modalg_7/bug31984
Normal file
12
tests/bugs/modalg_7/bug31984
Normal file
@@ -0,0 +1,12 @@
|
||||
puts "=============================================="
|
||||
puts " 0031984: Sweep crashes if Bi-normal is given"
|
||||
puts "=============================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31984.brep] a
|
||||
explode a
|
||||
|
||||
mksweep a_1
|
||||
addsweep a_2
|
||||
setsweep -CN 0 0 1
|
||||
buildsweep result
|
54
tests/bugs/modalg_7/bug32136
Normal file
54
tests/bugs/modalg_7/bug32136
Normal file
@@ -0,0 +1,54 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032136: Modeling Algorithms - Boolean fuse fails and corrupts the argument-shape"
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32136_obj.brep] s
|
||||
restore [locate_data_file bug32136_tools.brep] t
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s
|
||||
eval baddtools [explode t]
|
||||
bfillds
|
||||
bbop result 1
|
||||
|
||||
checkshape result
|
||||
checknbshapes result -face 731 -shell 1 -solid 1 -t
|
||||
checkprops result -s 0.051066 -v 8.9084e-06
|
||||
|
||||
foreach sh {result s} {
|
||||
if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
|
||||
puts "Error: the $sh shape is self-interfered"
|
||||
}
|
||||
checkmaxtol $sh -ref 5.e-6
|
||||
}
|
||||
|
||||
foreach sh [explode t] {
|
||||
if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
|
||||
puts "Error: the $sh shape is self-interfered"
|
||||
}
|
||||
checkmaxtol $sh -ref 5.e-6
|
||||
}
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}_fuse.png
|
||||
|
||||
# subsequent cut operation
|
||||
box box 0.06335 0.06335 0.05
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects box
|
||||
baddtools result
|
||||
bfillds
|
||||
bbop result_cut 2
|
||||
|
||||
checkshape result_cut
|
||||
checknbshapes result_cut -face 756 -shell 1 -solid 1 -t
|
||||
checkprops result_cut -s 0.0545148 -v 0.000191753
|
||||
|
||||
if {![regexp "This shape seems to be OK" [bopcheck result_cut]]} {
|
||||
puts "Error: the result_cut shape is self-interfered"
|
||||
}
|
||||
checkmaxtol result_cut -ref 5.e-6
|
||||
|
||||
checkview -display result_cut -2d -path ${imagedir}/${test_image}_cut.png
|
15
tests/bugs/modalg_7/bug32189
Normal file
15
tests/bugs/modalg_7/bug32189
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "============================="
|
||||
puts " 0032189: BOP Cut regression"
|
||||
puts "============================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32189_a.brep] a
|
||||
restore [locate_data_file bug32189_b.brep] b
|
||||
|
||||
bcut result a b
|
||||
|
||||
checkshape result
|
||||
checknbshapes result -vertex 5 -edge 6 -wire 3 -face 3 -shell 1 -solid 1
|
||||
checkprops result -s 0.000687454 -v 8.86946e-07
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
29
tests/bugs/modalg_7/bug32291
Normal file
29
tests/bugs/modalg_7/bug32291
Normal file
@@ -0,0 +1,29 @@
|
||||
puts "======================================================="
|
||||
puts " 0032291: General Fuse produces wrong number of solids"
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32291.brep] s
|
||||
|
||||
explode s
|
||||
baddobjects s_1
|
||||
baddtools s_2 s_3 s_4 s_5 s_6 s_7 s_8
|
||||
bfillds
|
||||
bbuild result
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -vertex 79 -edge 176 -wire 112 -face 112 -shell 18 -solid 18
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 7.e-5} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
axo
|
||||
clear
|
||||
explode result So
|
||||
fit
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
8
tests/bugs/step/bug32264
Normal file
8
tests/bugs/step/bug32264
Normal file
@@ -0,0 +1,8 @@
|
||||
restore [locate_data_file bug32264.brep] s
|
||||
set aTmpFile "$imagedir/${casename}.brep"
|
||||
testwritestep "$aTmpFile" s
|
||||
testreadstep "$aTmpFile" s1
|
||||
file delete "$aTmpFile"
|
||||
checkshape s1 f
|
||||
checkmaxtol s1 -ref 1.e-7
|
||||
checkprops s1 -v 16.1759 -deps 0.01
|
@@ -18,7 +18,7 @@ if {[regexp "Faulties" [bopargcheck result]]} {
|
||||
puts "Error: bopargcheck has found some faulties in res2"
|
||||
}
|
||||
|
||||
checkmaxtol result -ref 0.031968491076118669
|
||||
checkmaxtol result -ref 5.e-6
|
||||
|
||||
smallview
|
||||
don result sw tw
|
||||
|
28
tests/lowalgos/extcs/bug32225
Normal file
28
tests/lowalgos/extcs/bug32225
Normal file
@@ -0,0 +1,28 @@
|
||||
puts "========"
|
||||
puts "OCC32225: Modeling Data - Wrong result of extrema curve-surface"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32225_curve.draw] c
|
||||
restore [locate_data_file bug32225_surf.draw] s
|
||||
|
||||
extrema c s
|
||||
|
||||
if {[isdraw ext_1]} {
|
||||
set ext_dist [lindex [length ext_1] end]
|
||||
checkreal "Ext_1 min distance" $ext_dist 0. 1.e-10 1.e-10
|
||||
} else {
|
||||
puts "Error: invalid result"
|
||||
}
|
||||
|
||||
if {[isdraw ext_2]} {
|
||||
set ext_dist [lindex [length ext_2] end]
|
||||
checkreal "Ext_2 min distance" $ext_dist 0. 1.e-10 1.e-10
|
||||
} else {
|
||||
puts "Error: invalid result"
|
||||
}
|
||||
smallview
|
||||
donly c ext_1 ext_2
|
||||
fit
|
||||
disp s
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
@@ -1,6 +1,6 @@
|
||||
puts "TODO OCC27414 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC27414 ALL: Error : The volume of result shape is"
|
||||
puts "TODO OCC27414 ALL: Error : is WRONG because number of"
|
||||
puts "TODO OCC27414 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC27414 ALL: gives an empty result"
|
||||
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
|
||||
|
||||
puts "========"
|
||||
puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
|
||||
@@ -15,9 +15,8 @@ offsetonface s_9 7
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 222993 -v 1.87721e+06
|
||||
checknbshapes result -shell 1 -solid 1
|
||||
|
||||
unifysamedom result_unif result
|
||||
|
||||
checknbshapes result_unif -vertex 26 -edge 39 -wire 15 -face 15 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
||||
#unifysamedom result_unif result
|
||||
#checknbshapes result_unif -vertex 26 -edge 39 -wire 15 -face 15 -shell 1 -solid 1
|
||||
#checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
||||
|
34
tests/offset/shape_type_i_c/XY1
Normal file
34
tests/offset/shape_type_i_c/XY1
Normal file
@@ -0,0 +1,34 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_trimmed.brep] s
|
||||
|
||||
set ref_values { { 23829.6 171246 13 13 } \
|
||||
{ 25781.5 196049 14 14 } \
|
||||
{ 27762.8 222816 14 14 } \
|
||||
{ 29808.5 251596 12 12 } \
|
||||
{ 31919.5 282455 12 12 } \
|
||||
{ 34088.4 315454 12 12 } \
|
||||
{ 36315.3 350651 12 12 } \
|
||||
{ 38600 388104 12 12 } \
|
||||
{ 40942.8 427870 12 12 } \
|
||||
{ 43343.5 470009 12 12 } \
|
||||
{ 45802.1 514577 12 12 } \
|
||||
{ 48318.6 561632 12 12 } \
|
||||
{ 50893.1 611233 12 12 } \
|
||||
{ 53525.6 663438 12 12 } \
|
||||
{ 56215.9 718304 12 12 } \
|
||||
{ 58964.3 775889 12 12 } \
|
||||
{ 61770.5 836251 12 12 } \
|
||||
{ 64634.7 899449 12 12 } \
|
||||
{ 67556.9 965540 12 12 } \
|
||||
{ 70537 1.03458e+06 12 12 } }
|
||||
|
||||
perform_offset_increasing s 1 20 1 $ref_values
|
||||
|
||||
copy r5 result
|
||||
copy r5_unif result_unif
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
17
tests/offset/shape_type_i_c/XY2
Normal file
17
tests/offset/shape_type_i_c/XY2
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 5
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 3.47344e+06 -v 4.06389e+07
|
||||
|
||||
unifysamedom result_unif result
|
||||
checknbshapes result_unif -wire 962 -face 962 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
17
tests/offset/shape_type_i_c/XY3
Normal file
17
tests/offset/shape_type_i_c/XY3
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 8
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 3.35577e+06 -v 5.12413e+07
|
||||
|
||||
unifysamedom result_unif result
|
||||
checknbshapes result_unif -wire 755 -face 755 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
22
tests/offset/shape_type_i_c/XY4
Normal file
22
tests/offset/shape_type_i_c/XY4
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "TODO CR32333 ALL: Error : The area of result shape is"
|
||||
puts "TODO CR32333 ALL: Error : The command is not valid."
|
||||
puts "TODO CR32333 ALL: Error : The volume of result shape is"
|
||||
puts "TODO CR32333 ALL: Error : is WRONG because number of"
|
||||
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 10
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 3.1312e+06 -v 5.77267e+07
|
||||
|
||||
unifysamedom result_unif result
|
||||
checknbshapes result_unif -wire 492 -face 492 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
22
tests/offset/shape_type_i_c/XY5
Normal file
22
tests/offset/shape_type_i_c/XY5
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "TODO OCC32333 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC32333 ALL: gives an empty result"
|
||||
puts "TODO OCC32333 ALL: TEST INCOMPLETE"
|
||||
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 11
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 2.75287e+06 -v 6.08747e+07
|
||||
checknbshapes result -shell 1 -solid 1
|
||||
|
||||
#unifysamedom result_unif result
|
||||
#checknbshapes result_unif -wire 234 -face 234 -shell 1 -solid 1
|
||||
|
||||
#checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
17
tests/offset/shape_type_i_c/XY6
Normal file
17
tests/offset/shape_type_i_c/XY6
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 13
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 2.84681e+06 -v 6.64723e+07
|
||||
|
||||
unifysamedom result_unif result
|
||||
checknbshapes result_unif -wire 234 -face 234 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
17
tests/offset/shape_type_i_c/XY7
Normal file
17
tests/offset/shape_type_i_c/XY7
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32088_input.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 15
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 2.7281e+06 -v 7.20465e+07
|
||||
|
||||
unifysamedom result_unif result
|
||||
checknbshapes result_unif -wire 104 -face 104 -shell 1 -solid 1
|
||||
|
||||
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
|
17
tests/offset/shape_type_i_c/XZ1
Normal file
17
tests/offset/shape_type_i_c/XZ1
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032307: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" Joint type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32307.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 20
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 1.29992e+07 -v 8.09132e+08
|
||||
|
||||
# number of shapes should not change
|
||||
checknbshapes result -ref [nbshapes s]
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
24
tests/offset/shape_type_i_c/XZ2
Normal file
24
tests/offset/shape_type_i_c/XZ2
Normal file
@@ -0,0 +1,24 @@
|
||||
puts "============================================================================================="
|
||||
puts "0032307: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" Joint type \"Intersection\""
|
||||
puts "============================================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32307.brep] s
|
||||
|
||||
offsetparameter 1e-7 c i r
|
||||
offsetload s 0
|
||||
foreach f [explode s f] {
|
||||
mksurface surf $f
|
||||
regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z
|
||||
if {abs($z) > 1.e-7 || (abs($y) < 1.e-7 && abs($x) > 1.e-7)} {
|
||||
offsetonface $f 20
|
||||
}
|
||||
}
|
||||
offsetperform result
|
||||
|
||||
checkprops result -s 1.20298e+07 -v 7.1394e+08
|
||||
|
||||
# number of shapes should not change
|
||||
checknbshapes result -ref [nbshapes s]
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
@@ -1,4 +1,7 @@
|
||||
puts "TODO CR27414 ALL: Error : The volume of result shape is"
|
||||
#puts "TODO CR27414 ALL: Error : The volume of result shape is"
|
||||
puts "TODO OCC27414 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC27414 ALL: gives an empty result"
|
||||
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
|
||||
|
||||
restore [locate_data_file bug26917_M2_trim16.brep] s
|
||||
|
||||
|
15
tests/pipe/bugs/bug29645
Normal file
15
tests/pipe/bugs/bug29645
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "========"
|
||||
puts "0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug29645_spine.brep] spine
|
||||
restore [locate_data_file bug29645_profile.brep] profile
|
||||
|
||||
mksweep spine
|
||||
addsweep profile
|
||||
buildsweep result -S -C
|
||||
|
||||
puts "TEST COMPLETED"
|
||||
|
||||
|
35
tests/pipe/bugs/bug31147
Normal file
35
tests/pipe/bugs/bug31147
Normal file
@@ -0,0 +1,35 @@
|
||||
puts "============"
|
||||
puts "0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload VISUALIZATION
|
||||
|
||||
restore [locate_data_file bug31147.brep] s
|
||||
explode s e
|
||||
wire spine s_1
|
||||
wire profile s_2
|
||||
|
||||
mksweep spine
|
||||
addsweep profile
|
||||
setsweep -SM 1000
|
||||
setsweep -DM 14
|
||||
buildsweep result -S -C
|
||||
|
||||
set info1 [errorsweep]
|
||||
|
||||
set check [regexp {Tolerance on surfaces = ([0-9\-+Ee.]+)} $info1 str error]
|
||||
|
||||
if { $error > 1.e-4 } {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
vinit
|
||||
vdisplay result
|
||||
vsetdispmode 1
|
||||
vfit
|
||||
|
||||
checkshape result
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
||||
|
||||
puts "TEST COMPLETED"
|
Reference in New Issue
Block a user