mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
16 Commits
V7_8_1
...
CR752-SALO
Author | SHA1 | Date | |
---|---|---|---|
|
29382b6da7 | ||
|
7d1f8442a2 | ||
|
537521203b | ||
|
0dc2c377fc | ||
|
1078e94941 | ||
|
6b26c6d26d | ||
|
dd56857183 | ||
|
2c8eacb996 | ||
|
3b05b748de | ||
|
91e51cb0f2 | ||
|
bb00fe2713 | ||
|
94c00556ea | ||
|
bf67bbf8fe | ||
|
edf111202c | ||
|
bbdcdcdd80 | ||
|
2ecd3a06a6 |
@@ -655,6 +655,12 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
|
||||
// Vertices
|
||||
Standard_Integer nV1, nV2;
|
||||
thePB->Indices(nV1, nV2);
|
||||
|
||||
if (nV1 < 0 || nV2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
|
||||
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
|
||||
// Get the edge
|
||||
|
@@ -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);
|
||||
|
@@ -23,8 +23,10 @@
|
||||
#include <BRepAlgo_Loop.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomLib.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
@@ -160,6 +162,15 @@ void BRepAlgo_Loop::AddConstEdges(const TopTools_ListOfShape& LE)
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetImageVV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_Loop::SetImageVV (const BRepAlgo_Image& theImageVV)
|
||||
{
|
||||
myImageVV = theImageVV;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateClosedEdge
|
||||
@@ -606,6 +617,8 @@ void BRepAlgo_Loop::Perform()
|
||||
TopoDS_Wire NW;
|
||||
Standard_Boolean End;
|
||||
|
||||
UpdateVEmap (MVE);
|
||||
|
||||
TopTools_MapOfShape UsedEdges;
|
||||
|
||||
while (MVE.Extent() > 0) {
|
||||
@@ -924,6 +937,7 @@ void BRepAlgo_Loop::GetVerticesForSubstitute( TopTools_DataMapOfShapeShape& Ver
|
||||
{
|
||||
VerVerMap = myVerticesForSubstitute;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VerticesForSubstitute
|
||||
//purpose :
|
||||
@@ -933,3 +947,123 @@ void BRepAlgo_Loop::VerticesForSubstitute( TopTools_DataMapOfShapeShape& VerVer
|
||||
{
|
||||
myVerticesForSubstitute = VerVerMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateVEmap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_Loop::UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap)
|
||||
{
|
||||
TopTools_IndexedDataMapOfShapeListOfShape VerLver;
|
||||
|
||||
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (theVEmap.FindKey(ii));
|
||||
const TopTools_ListOfShape& aElist = theVEmap(ii);
|
||||
if (aElist.Extent() == 1 && myImageVV.IsImage(aVertex))
|
||||
{
|
||||
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (myImageVV.ImageFrom(aVertex));
|
||||
if (VerLver.Contains(aProVertex))
|
||||
{
|
||||
TopTools_ListOfShape& aVlist = VerLver.ChangeFromKey(aProVertex);
|
||||
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
|
||||
}
|
||||
else
|
||||
{
|
||||
TopTools_ListOfShape aVlist;
|
||||
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
|
||||
VerLver.Add (aProVertex, aVlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (VerLver.IsEmpty())
|
||||
return;
|
||||
|
||||
BRep_Builder aBB;
|
||||
for (Standard_Integer ii = 1; ii <= VerLver.Extent(); ii++)
|
||||
{
|
||||
const TopTools_ListOfShape& aVlist = VerLver(ii);
|
||||
if (aVlist.Extent() == 1)
|
||||
continue;
|
||||
|
||||
Standard_Real aMaxTol = 0.;
|
||||
TColgp_Array1OfPnt Points (1, aVlist.Extent());
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itl (aVlist);
|
||||
Standard_Integer jj = 0;
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
|
||||
aMaxTol = Max (aMaxTol, aTol);
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
|
||||
Points(++jj) = aPnt;
|
||||
}
|
||||
|
||||
gp_Ax2 anAxis;
|
||||
Standard_Boolean IsSingular;
|
||||
GeomLib::AxeOfInertia (Points, anAxis, IsSingular);
|
||||
gp_Pnt aCentre = anAxis.Location();
|
||||
Standard_Real aMaxDist = 0.;
|
||||
for (jj = 1; jj <= Points.Upper(); jj++)
|
||||
{
|
||||
Standard_Real aSqDist = aCentre.SquareDistance (Points(jj));
|
||||
aMaxDist = Max (aMaxDist, aSqDist);
|
||||
}
|
||||
aMaxDist = Sqrt(aMaxDist);
|
||||
aMaxTol = Max (aMaxTol, aMaxDist);
|
||||
|
||||
//Find constant vertex
|
||||
TopoDS_Vertex aConstVertex;
|
||||
for (itl.Initialize(aVlist); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
|
||||
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey(aVertex);
|
||||
const TopoDS_Shape& anEdge = aElist.First();
|
||||
TopTools_ListIteratorOfListOfShape itcedges (myConstEdges);
|
||||
for (; itcedges.More(); itcedges.Next())
|
||||
if (anEdge.IsSame (itcedges.Value()))
|
||||
{
|
||||
aConstVertex = aVertex;
|
||||
break;
|
||||
}
|
||||
if (!aConstVertex.IsNull())
|
||||
break;
|
||||
}
|
||||
if (aConstVertex.IsNull())
|
||||
aConstVertex = TopoDS::Vertex(aVlist.First());
|
||||
aBB.UpdateVertex (aConstVertex, aCentre, aMaxTol);
|
||||
|
||||
for (itl.Initialize(aVlist); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
|
||||
if (aVertex.IsSame(aConstVertex))
|
||||
continue;
|
||||
|
||||
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey (aVertex);
|
||||
TopoDS_Edge anEdge = TopoDS::Edge (aElist.First());
|
||||
anEdge.Orientation(TopAbs_FORWARD);
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices (anEdge, aV1, aV2);
|
||||
TopoDS_Vertex aVertexToRemove = (aV1.IsSame(aVertex))? aV1 : aV2;
|
||||
anEdge.Free(Standard_True);
|
||||
aBB.Remove (anEdge, aVertexToRemove);
|
||||
aBB.Add (anEdge, aConstVertex.Oriented (aVertexToRemove.Orientation()));
|
||||
}
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape Emap;
|
||||
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
|
||||
{
|
||||
const TopTools_ListOfShape& aElist = theVEmap(ii);
|
||||
TopTools_ListIteratorOfListOfShape itl (aElist);
|
||||
for (; itl.More(); itl.Next())
|
||||
Emap.Add (itl.Value());
|
||||
}
|
||||
|
||||
theVEmap.Clear();
|
||||
for (Standard_Integer ii = 1; ii <= Emap.Extent(); ii++)
|
||||
TopExp::MapShapesAndAncestors (Emap(ii), TopAbs_VERTEX, TopAbs_EDGE, theVEmap);
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BRepAlgo_Image.hxx>
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Edge;
|
||||
|
||||
@@ -53,9 +55,15 @@ public:
|
||||
//! Add <LE> as a set of const edges.
|
||||
Standard_EXPORT void AddConstEdges (const TopTools_ListOfShape& LE);
|
||||
|
||||
//! Sets the Image Vertex - Vertex
|
||||
Standard_EXPORT void SetImageVV (const BRepAlgo_Image& theImageVV);
|
||||
|
||||
//! Make loops.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
//! Update VE map according to Image Vertex - Vertex
|
||||
Standard_EXPORT void UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap);
|
||||
|
||||
//! Cut the edge <E> in several edges <NE> on the
|
||||
//! vertices<VonE>.
|
||||
Standard_EXPORT void CutEdge (const TopoDS_Edge& E, const TopTools_ListOfShape& VonE, TopTools_ListOfShape& NE) const;
|
||||
@@ -102,6 +110,7 @@ private:
|
||||
TopTools_ListOfShape myNewFaces;
|
||||
TopTools_DataMapOfShapeListOfShape myCutEdges;
|
||||
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
|
||||
BRepAlgo_Image myImageVV;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -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();
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAlgo_AsDes.hxx>
|
||||
#include <BRepAlgo_Image.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepLib_MakeVertex.hxx>
|
||||
#include <BRepOffset_Analyse.hxx>
|
||||
@@ -78,6 +79,7 @@
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef DRAW
|
||||
@@ -113,27 +115,153 @@ static TopoDS_Vertex CommonVertex(TopoDS_Edge& E1,
|
||||
return V;
|
||||
}
|
||||
|
||||
static Standard_Boolean IsOrientationChanged(TopTools_IndexedMapOfShape& theMap,
|
||||
const TopoDS_Edge& theEdge)
|
||||
static Standard_Integer DefineClosedness(const TopoDS_Face& theFace)
|
||||
{
|
||||
Standard_Boolean IsOrChanged = Standard_False;
|
||||
|
||||
if (!theMap.Contains(theEdge))
|
||||
theMap.Add(theEdge);
|
||||
else
|
||||
TopExp_Explorer anExplo (theFace, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
Standard_Integer anInd = theMap.FindIndex(theEdge);
|
||||
const TopoDS_Shape& anEdge = theMap(anInd);
|
||||
if (theEdge.Orientation() != anEdge.Orientation())
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
|
||||
if (BRepTools::IsReallyClosed(anEdge, theFace))
|
||||
{
|
||||
theMap.Substitute( anInd, theEdge );
|
||||
IsOrChanged = Standard_True;
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
|
||||
gp_Vec2d aTangent = aPCurve->DN(fpar, 1);
|
||||
Standard_Real aCrossProd1 = aTangent ^ gp::DX2d();
|
||||
Standard_Real aCrossProd2 = aTangent ^ gp::DY2d();
|
||||
if (Abs(aCrossProd2) < Abs(aCrossProd1)) //pcurve is parallel to OY
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return IsOrChanged;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void GetEdgesOrientedInFace(const TopoDS_Shape& theShape,
|
||||
const TopoDS_Face& theFace,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes,
|
||||
TopTools_SequenceOfShape& theSeqEdges)
|
||||
{
|
||||
const TopTools_ListOfShape& aEdges = theAsDes->Descendant (theFace);
|
||||
|
||||
TopExp_Explorer anExplo (theShape, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
const TopoDS_Shape& anEdge = anExplo.Current();
|
||||
TopTools_ListIteratorOfListOfShape itl (aEdges);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Shape& anEdgeInFace = itl.Value();
|
||||
if (anEdgeInFace.IsSame(anEdge))
|
||||
{
|
||||
theSeqEdges.Append (anEdgeInFace);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (theSeqEdges.Length() == 1)
|
||||
return;
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aVEmap;
|
||||
for (Standard_Integer ii = 1; ii <= theSeqEdges.Length(); ii++)
|
||||
TopExp::MapShapesAndAncestors (theSeqEdges(ii), TopAbs_VERTEX, TopAbs_EDGE, aVEmap);
|
||||
|
||||
TopoDS_Vertex aFirstVertex;
|
||||
TopoDS_Edge aFirstEdge;
|
||||
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
|
||||
const TopTools_ListOfShape& aElist = aVEmap(ii);
|
||||
if (aElist.Extent() == 1)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aElist.First());
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
|
||||
if (aV1.IsSame(aVertex))
|
||||
{
|
||||
aFirstVertex = aVertex;
|
||||
aFirstEdge = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aFirstEdge.IsNull()) //closed set of edges
|
||||
{
|
||||
//Standard_Real aPeriod = 0.;
|
||||
Standard_Integer IndCoord = DefineClosedness (theFace);
|
||||
/*
|
||||
BRepAdaptor_Surface aBAsurf (theFace, Standard_False);
|
||||
if (IndCoord == 1)
|
||||
aPeriod = aBAsurf.LastUParameter() - aBAsurf.FirstUParameter();
|
||||
else if (IndCoord == 2)
|
||||
aPeriod = aBAsurf.LastVParameter() - aBAsurf.FirstVParameter();
|
||||
*/
|
||||
|
||||
if (IndCoord != 0)
|
||||
{
|
||||
Standard_Real aMaxDelta = 0.;
|
||||
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
|
||||
const TopTools_ListOfShape& aElist = aVEmap(ii);
|
||||
const TopoDS_Edge& anEdge1 = TopoDS::Edge(aElist.First());
|
||||
const TopoDS_Edge& anEdge2 = TopoDS::Edge(aElist.Last());
|
||||
Standard_Real aParam1 = BRep_Tool::Parameter(aVertex, anEdge1);
|
||||
Standard_Real aParam2 = BRep_Tool::Parameter(aVertex, anEdge2);
|
||||
BRepAdaptor_Curve2d aBAcurve1 (anEdge1, theFace);
|
||||
BRepAdaptor_Curve2d aBAcurve2 (anEdge2, theFace);
|
||||
gp_Pnt2d aPnt1 = aBAcurve1.Value(aParam1);
|
||||
gp_Pnt2d aPnt2 = aBAcurve2.Value(aParam2);
|
||||
Standard_Real aDelta = Abs(aPnt1.Coord(IndCoord) - aPnt2.Coord(IndCoord));
|
||||
if (aDelta > aMaxDelta)
|
||||
{
|
||||
aMaxDelta = aDelta;
|
||||
aFirstVertex = aVertex;
|
||||
}
|
||||
}
|
||||
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aFirstVertex);
|
||||
TopTools_ListIteratorOfListOfShape itl (aElist);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
|
||||
if (aV1.IsSame(aFirstVertex))
|
||||
{
|
||||
aFirstEdge = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aNbEdges = theSeqEdges.Length();
|
||||
theSeqEdges.Clear();
|
||||
theSeqEdges.Append (aFirstEdge);
|
||||
TopoDS_Edge anEdge = aFirstEdge;
|
||||
for (;;)
|
||||
{
|
||||
TopoDS_Vertex aLastVertex = TopExp::LastVertex (anEdge, Standard_True); //with orientation
|
||||
if (aLastVertex.IsSame(aFirstVertex))
|
||||
break;
|
||||
|
||||
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aLastVertex);
|
||||
if (aElist.Extent() == 1)
|
||||
break;
|
||||
|
||||
if (aElist.First().IsSame(anEdge))
|
||||
anEdge = TopoDS::Edge(aElist.Last());
|
||||
else
|
||||
anEdge = TopoDS::Edge(aElist.First());
|
||||
|
||||
theSeqEdges.Append (anEdge);
|
||||
if (theSeqEdges.Length() == aNbEdges)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Store
|
||||
@@ -505,7 +633,7 @@ static void EdgeInter(const TopoDS_Face& F,
|
||||
// Vertex storage in DS.
|
||||
//---------------------------------
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolStore = Max(TolStore, 10.*Tol);
|
||||
TolStore = Max (TolStore, Tol);
|
||||
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
|
||||
}
|
||||
}
|
||||
@@ -518,10 +646,13 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
const BRepAdaptor_Surface& BAsurf,
|
||||
const TopoDS_Edge& E1,
|
||||
const TopoDS_Edge& E2,
|
||||
const TopAbs_Orientation theOr1,
|
||||
const TopAbs_Orientation theOr2,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
Standard_Real Tol,
|
||||
Standard_Boolean WithOri,
|
||||
gp_Pnt& Pref,
|
||||
const TopoDS_Vertex& theVref,
|
||||
BRepAlgo_Image& theImageVV,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV,
|
||||
Standard_Boolean& theCoincide)
|
||||
{
|
||||
@@ -567,20 +698,20 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
Standard_Boolean WithDegen = BRep_Tool::Degenerated(E1) || BRep_Tool::Degenerated(E2);
|
||||
|
||||
if (WithDegen)
|
||||
{
|
||||
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
|
||||
TopoDS_Iterator iter( EI[ideg] );
|
||||
if (iter.More())
|
||||
{
|
||||
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
|
||||
TopoDS_Iterator iter( EI[ideg] );
|
||||
if (iter.More())
|
||||
{
|
||||
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
|
||||
DegPoint = BRep_Tool::Pnt(vdeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
BRepAdaptor_Curve CEdeg( EI[ideg], F );
|
||||
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
|
||||
}
|
||||
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
|
||||
DegPoint = BRep_Tool::Pnt(vdeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
BRepAdaptor_Curve CEdeg( EI[ideg], F );
|
||||
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
|
||||
}
|
||||
}
|
||||
//
|
||||
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
|
||||
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
|
||||
@@ -596,107 +727,113 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
|
||||
//
|
||||
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
|
||||
theCoincide = (Inter2d.NbSegments() &&
|
||||
(GAC1.GetType() == GeomAbs_Line) &&
|
||||
(GAC2.GetType() == GeomAbs_Line));
|
||||
(GAC1.GetType() == GeomAbs_Line) &&
|
||||
(GAC2.GetType() == GeomAbs_Line));
|
||||
return;
|
||||
}
|
||||
//
|
||||
for (i = 1; i <= Inter2d.NbPoints(); i++)
|
||||
{
|
||||
gp_Pnt P3d;
|
||||
if (WithDegen)
|
||||
P3d = DegPoint;
|
||||
else
|
||||
{
|
||||
gp_Pnt P3d;
|
||||
if (WithDegen)
|
||||
P3d = DegPoint;
|
||||
else
|
||||
{
|
||||
gp_Pnt2d P2d = Inter2d.Point(i).Value();
|
||||
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
|
||||
}
|
||||
ResPoints.Append( P3d );
|
||||
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
|
||||
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
|
||||
gp_Pnt2d P2d = Inter2d.Point(i).Value();
|
||||
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
|
||||
}
|
||||
ResPoints.Append( P3d );
|
||||
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
|
||||
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
|
||||
}
|
||||
|
||||
for (i = 1; i <= ResPoints.Length(); i++)
|
||||
{
|
||||
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
|
||||
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
|
||||
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
|
||||
{
|
||||
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
|
||||
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
|
||||
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "Inter2d : Solution rejected due to infinite parameter"<<std::endl;
|
||||
std::cout << "Inter2d : Solution rejected due to infinite parameter"<<std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
gp_Pnt P = ResPoints(i); //ponc1.Value();
|
||||
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
|
||||
aNewVertex.Orientation(TopAbs_INTERNAL);
|
||||
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
|
||||
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
|
||||
gp_Pnt P1 = CE1.Value(aT1);
|
||||
gp_Pnt P2 = CE2.Value(aT2);
|
||||
Standard_Real dist1, dist2, dist3;
|
||||
dist1 = P1.Distance(P);
|
||||
dist2 = P2.Distance(P);
|
||||
dist3 = P1.Distance(P2);
|
||||
dist1 = Max( dist1, dist2 );
|
||||
dist1 = Max( dist1, dist3 );
|
||||
B.UpdateVertex( aNewVertex, dist1 );
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
|
||||
{
|
||||
std::cout << "out of limit"<<std::endl;
|
||||
std::cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<std::endl;
|
||||
}
|
||||
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
|
||||
{
|
||||
std::cout << "out of limit"<<std::endl;
|
||||
std::cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<std::endl;
|
||||
}
|
||||
Standard_Real MilTol2 = 1000*Tol*Tol;
|
||||
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
|
||||
{
|
||||
std::cout << "Inter2d : Solution rejected"<<std::endl;
|
||||
std::cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<std::endl;
|
||||
std::cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<std::endl;
|
||||
std::cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<std::endl;
|
||||
std::cout<<"MaxDist = "<<dist1<<std::endl;
|
||||
}
|
||||
#endif
|
||||
//define the orientation of a new vertex
|
||||
TopAbs_Orientation OO1 = TopAbs_REVERSED;
|
||||
TopAbs_Orientation OO2 = TopAbs_REVERSED;
|
||||
if (WithOri)
|
||||
{
|
||||
BRepAdaptor_Curve2d PCE1( E1, F );
|
||||
BRepAdaptor_Curve2d PCE2( E2, F );
|
||||
gp_Pnt2d P2d1, P2d2;
|
||||
gp_Vec2d V1, V2, V1or, V2or;
|
||||
PCE1.D1( aT1, P2d1, V1 );
|
||||
PCE2.D1( aT2, P2d2, V2 );
|
||||
V1or = V1; V2or = V2;
|
||||
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
|
||||
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
|
||||
Standard_Real CrossProd = V2or ^ V1;
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Abs(CrossProd) <= gp::Resolution())
|
||||
std::cout<<std::endl<<"CrossProd = "<<CrossProd<<std::endl;
|
||||
#endif
|
||||
if (CrossProd > 0.)
|
||||
OO1 = TopAbs_FORWARD;
|
||||
CrossProd = V1or ^ V2;
|
||||
if (CrossProd > 0.)
|
||||
OO2 = TopAbs_FORWARD;
|
||||
}
|
||||
LV1.Append( aNewVertex.Oriented(OO1) );
|
||||
LV2.Append( aNewVertex.Oriented(OO2) );
|
||||
continue;
|
||||
}
|
||||
|
||||
gp_Pnt P = ResPoints(i); //ponc1.Value();
|
||||
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
|
||||
aNewVertex.Orientation(TopAbs_INTERNAL);
|
||||
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
|
||||
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
|
||||
gp_Pnt P1 = CE1.Value(aT1);
|
||||
gp_Pnt P2 = CE2.Value(aT2);
|
||||
Standard_Real dist1, dist2, dist3;
|
||||
dist1 = P1.Distance(P);
|
||||
dist2 = P2.Distance(P);
|
||||
dist3 = P1.Distance(P2);
|
||||
dist1 = Max( dist1, dist2 );
|
||||
dist1 = Max( dist1, dist3 );
|
||||
B.UpdateVertex( aNewVertex, dist1 );
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
|
||||
{
|
||||
std::cout << "out of limit"<<std::endl;
|
||||
std::cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<std::endl;
|
||||
}
|
||||
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
|
||||
{
|
||||
std::cout << "out of limit"<<std::endl;
|
||||
std::cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<std::endl;
|
||||
}
|
||||
Standard_Real MilTol2 = 1000*Tol*Tol;
|
||||
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
|
||||
{
|
||||
std::cout << "Inter2d : Solution rejected"<<std::endl;
|
||||
std::cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<std::endl;
|
||||
std::cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<std::endl;
|
||||
std::cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<std::endl;
|
||||
std::cout<<"MaxDist = "<<dist1<<std::endl;
|
||||
}
|
||||
#endif
|
||||
//define the orientation of a new vertex
|
||||
TopAbs_Orientation OO1 = TopAbs_REVERSED;
|
||||
TopAbs_Orientation OO2 = TopAbs_REVERSED;
|
||||
if (WithOri)
|
||||
{
|
||||
BRepAdaptor_Curve2d PCE1( E1, F );
|
||||
BRepAdaptor_Curve2d PCE2( E2, F );
|
||||
gp_Pnt2d P2d1, P2d2;
|
||||
gp_Vec2d V1, V2, V1or, V2or;
|
||||
PCE1.D1( aT1, P2d1, V1 );
|
||||
PCE2.D1( aT2, P2d2, V2 );
|
||||
V1or = V1; V2or = V2;
|
||||
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
|
||||
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
|
||||
Standard_Real CrossProd = V2or ^ V1;
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Abs(CrossProd) <= gp::Resolution())
|
||||
std::cout<<std::endl<<"CrossProd = "<<CrossProd<<std::endl;
|
||||
#endif
|
||||
if (CrossProd > 0.)
|
||||
OO1 = TopAbs_FORWARD;
|
||||
CrossProd = V1or ^ V2;
|
||||
if (CrossProd > 0.)
|
||||
OO2 = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
if (theOr1 != TopAbs_EXTERNAL)
|
||||
OO1 = theOr1;
|
||||
if (theOr2 != TopAbs_EXTERNAL)
|
||||
OO2 = theOr2;
|
||||
|
||||
LV1.Append( aNewVertex.Oriented(OO1) );
|
||||
LV2.Append( aNewVertex.Oriented(OO2) );
|
||||
}
|
||||
|
||||
//----------------------------------
|
||||
// Test at end.
|
||||
@@ -755,7 +892,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
while (j < i) {
|
||||
P1 = BRep_Tool::Pnt(TopoDS::Vertex(it1LV1.Value()));
|
||||
P2 = BRep_Tool::Pnt(TopoDS::Vertex(it2LV1.Value()));
|
||||
if (P1.IsEqual(P2,10*Tol)) {
|
||||
if (P1.IsEqual(P2, Tol)) {
|
||||
LV1.Remove(it1LV1);
|
||||
LV2.Remove(it1LV2);
|
||||
if (AffichPurge) std::cout <<"Doubles removed in EdgeInter."<<std::endl;
|
||||
@@ -775,6 +912,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
////-----------------------------------------------------
|
||||
if(LV1.Extent() > 1) {
|
||||
//std::cout << "IFV - RefEdgeInter: remove vertex" << std::endl;
|
||||
gp_Pnt Pref = BRep_Tool::Pnt(theVref);
|
||||
Standard_Real dmin = RealLast();
|
||||
TopoDS_Vertex Vmin;
|
||||
for (it1LV1.Initialize(LV1); it1LV1.More(); it1LV1.Next()) {
|
||||
@@ -794,10 +932,21 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itl (LV1);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
TopoDS_Shape aNewVertex = itl.Value();
|
||||
aNewVertex.Orientation(TopAbs_FORWARD);
|
||||
if (theImageVV.HasImage (theVref))
|
||||
theImageVV.Add (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
|
||||
else
|
||||
theImageVV.Bind (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
|
||||
}
|
||||
|
||||
////-----------------------------------------------------
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
TolStore = Max(TolStore, 10.*Tol);
|
||||
TolStore = Max (TolStore, Tol);
|
||||
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
|
||||
}
|
||||
}
|
||||
@@ -1406,6 +1555,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const TopoDS_Face& F,
|
||||
const TopTools_IndexedMapOfShape& NewEdges,
|
||||
const Standard_Real Tol,
|
||||
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
{
|
||||
#ifdef DRAW
|
||||
@@ -1441,12 +1591,41 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
|
||||
while (j < i && it2LE.More()) {
|
||||
const TopoDS_Edge& E2 = TopoDS::Edge(it2LE.Value());
|
||||
|
||||
Standard_Boolean ToIntersect = Standard_True;
|
||||
if (theEdgeIntEdges.IsBound(E1))
|
||||
{
|
||||
const TopTools_ListOfShape& aElist = theEdgeIntEdges(E1);
|
||||
TopTools_ListIteratorOfListOfShape itedges (aElist);
|
||||
for (; itedges.More(); itedges.Next())
|
||||
if (E2.IsSame (itedges.Value()))
|
||||
ToIntersect = Standard_False;
|
||||
|
||||
if (ToIntersect)
|
||||
{
|
||||
for (itedges.Initialize(aElist); itedges.More(); itedges.Next())
|
||||
{
|
||||
const TopoDS_Shape& anEdge = itedges.Value();
|
||||
if (theEdgeIntEdges.IsBound(anEdge))
|
||||
{
|
||||
const TopTools_ListOfShape& aElist2 = theEdgeIntEdges(anEdge);
|
||||
TopTools_ListIteratorOfListOfShape itedges2 (aElist2);
|
||||
for (; itedges2.More(); itedges2.Next())
|
||||
if (E2.IsSame (itedges2.Value()))
|
||||
ToIntersect = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Intersections of New edges obtained by intersection
|
||||
// between them and with edges of restrictions
|
||||
//------------------------------------------------------
|
||||
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
|
||||
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
|
||||
if (ToIntersect &&
|
||||
(!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
|
||||
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
|
||||
|
||||
TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD);
|
||||
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True, theDMVV);
|
||||
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
|
||||
@@ -1467,11 +1646,14 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
BRepOffset_Offset& OFI,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
const TopTools_DataMapOfShapeShape& Build,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
TopTools_IndexedMapOfShape& FacesWithVerts,
|
||||
BRepAlgo_Image& theImageVV,
|
||||
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
{
|
||||
|
||||
@@ -1529,8 +1711,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
continue; // Protection from case when explorer does not contain edges.
|
||||
CurE = FirstE = wexp.Current();
|
||||
TopTools_IndexedMapOfShape Edges;
|
||||
Standard_Boolean ToReverse1, ToReverse2;
|
||||
ToReverse1 = IsOrientationChanged(Edges, CurE);
|
||||
|
||||
while (!end) {
|
||||
wexp.Next();
|
||||
if (wexp.More()) {
|
||||
@@ -1541,10 +1722,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
}
|
||||
if (CurE.IsSame(NextE)) continue;
|
||||
|
||||
ToReverse2 = IsOrientationChanged(Edges, NextE);
|
||||
|
||||
TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
|
||||
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
|
||||
|
||||
CurE = Analyse.EdgeReplacement (FI, CurE);
|
||||
NextE = Analyse.EdgeReplacement (FI, NextE);
|
||||
@@ -1559,21 +1737,38 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
TopTools_ListOfShape LV1,LV2;
|
||||
Standard_Boolean DoInter = 1;
|
||||
TopoDS_Shape NE1,NE2;
|
||||
TopTools_SequenceOfShape NE1seq, NE2seq;
|
||||
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
|
||||
|
||||
Standard_Integer aChoice = 0;
|
||||
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
|
||||
aChoice = 1;
|
||||
NE1 = Build(CurE );
|
||||
NE2 = Build(NextE);
|
||||
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
|
||||
GetEdgesOrientedInFace (NE2, FIO, theAsDes, NE2seq);
|
||||
anOr1 = TopAbs_REVERSED;
|
||||
anOr2 = TopAbs_FORWARD;
|
||||
}
|
||||
else if (Build.IsBound(CurE) && MES.IsBound(NEO)) {
|
||||
aChoice = 2;
|
||||
NE1 = Build(CurE);
|
||||
NE2 = MES (NEO);
|
||||
NE2.Orientation (NextE.Orientation());
|
||||
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
|
||||
NE2seq.Append (NE2);
|
||||
anOr1 = TopAbs_REVERSED;
|
||||
anOr2 = TopAbs_FORWARD;
|
||||
}
|
||||
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
|
||||
aChoice = 3;
|
||||
NE1 = Build(NextE);
|
||||
NE2 = MES(CEO);
|
||||
Standard_Boolean Tmp = ToReverse1;
|
||||
ToReverse1 = ToReverse2;
|
||||
ToReverse2 = Tmp;
|
||||
NE2.Orientation (CurE.Orientation());
|
||||
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
|
||||
NE2seq.Append (NE2);
|
||||
anOr1 = TopAbs_FORWARD;
|
||||
anOr2 = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
DoInter = 0;
|
||||
@@ -1583,23 +1778,43 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
// NE1,NE2 can be a compound of Edges.
|
||||
//------------------------------------
|
||||
Standard_Boolean bCoincide;
|
||||
TopExp_Explorer Exp1, Exp2;
|
||||
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
|
||||
TopoDS_Edge aE1 = TopoDS::Edge(Exp1.Current());
|
||||
for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) {
|
||||
TopoDS_Edge aE2 = TopoDS::Edge(Exp2.Current());
|
||||
|
||||
//Correct orientation of edges
|
||||
if (ToReverse1)
|
||||
aE1.Reverse();
|
||||
if (ToReverse2)
|
||||
aE2.Reverse();
|
||||
//////////////////////////////
|
||||
|
||||
RefEdgeInter(FIO, BAsurf, aE1, aE2, AsDes2d,
|
||||
Tol, Standard_True, Pref, theDMVV, bCoincide);
|
||||
}
|
||||
TopoDS_Edge aE1, aE2;
|
||||
if (aChoice == 1 || aChoice == 2)
|
||||
{
|
||||
aE1 = TopoDS::Edge (NE1seq.Last());
|
||||
aE2 = TopoDS::Edge (NE2seq.First());
|
||||
}
|
||||
else // aChoice == 3
|
||||
{
|
||||
aE1 = TopoDS::Edge (NE1seq.First());
|
||||
aE2 = TopoDS::Edge (NE2seq.Last());
|
||||
}
|
||||
|
||||
if (aE1.Orientation() == TopAbs_REVERSED)
|
||||
anOr1 = TopAbs::Reverse(anOr1);
|
||||
if (aE2.Orientation() == TopAbs_REVERSED)
|
||||
anOr2 = TopAbs::Reverse(anOr2);
|
||||
|
||||
RefEdgeInter(FIO, BAsurf, aE1, aE2, anOr1, anOr2, AsDes2d,
|
||||
Tol, Standard_True, Vref, theImageVV, theDMVV, bCoincide);
|
||||
|
||||
if (theEdgeIntEdges.IsBound(aE1))
|
||||
theEdgeIntEdges(aE1).Append(aE2);
|
||||
else
|
||||
{
|
||||
TopTools_ListOfShape aElist;
|
||||
aElist.Append(aE2);
|
||||
theEdgeIntEdges.Bind (aE1, aElist);
|
||||
}
|
||||
if (theEdgeIntEdges.IsBound(aE2))
|
||||
theEdgeIntEdges(aE2).Append(aE1);
|
||||
else
|
||||
{
|
||||
TopTools_ListOfShape aElist;
|
||||
aElist.Append(aE1);
|
||||
theEdgeIntEdges.Bind (aE2, aElist);
|
||||
}
|
||||
|
||||
//
|
||||
// check if some of the offset edges have been
|
||||
// generated out of the common vertex
|
||||
@@ -1622,7 +1837,6 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||
}
|
||||
}
|
||||
CurE = wexp.Current();
|
||||
ToReverse1 = ToReverse2;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
@@ -1682,7 +1896,6 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
|
||||
if (CurE.IsSame(NextE)) continue;
|
||||
//
|
||||
TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
|
||||
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
|
||||
if (!Build.IsBound(Vref)) {
|
||||
CurE = NextE;
|
||||
continue;
|
||||
@@ -1697,6 +1910,7 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
|
||||
TopoDS_Edge NEO = TopoDS::Edge(aLocalShape);
|
||||
//
|
||||
TopoDS_Shape NE1,NE2;
|
||||
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
|
||||
|
||||
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
|
||||
NE1 = Build(CurE );
|
||||
@@ -1729,8 +1943,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
|
||||
// intersection with first edge
|
||||
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
|
||||
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
|
||||
RefEdgeInter(FIO, BAsurf, aE1, aE3, AsDes2d,
|
||||
Tol, Standard_True, Pref, theDMVV, bCoincide);
|
||||
BRepAlgo_Image anEmptyImage;
|
||||
RefEdgeInter(FIO, BAsurf, aE1, aE3, anOr1, anOr2, AsDes2d,
|
||||
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
|
||||
if (bCoincide) {
|
||||
// in case of coincidence trim the edge E3 the same way as E1
|
||||
Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV);
|
||||
@@ -1740,8 +1955,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
|
||||
// intersection with second edge
|
||||
for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
|
||||
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current());
|
||||
RefEdgeInter(FIO, BAsurf, aE2, aE3, AsDes2d,
|
||||
Tol, Standard_True, Pref, theDMVV, bCoincide);
|
||||
BRepAlgo_Image anEmptyImage;
|
||||
RefEdgeInter(FIO, BAsurf, aE2, aE3, anOr1, anOr2, AsDes2d,
|
||||
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
|
||||
if (bCoincide) {
|
||||
// in case of coincidence trim the edge E3 the same way as E2
|
||||
Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV);
|
||||
@@ -1759,8 +1975,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
|
||||
for (Exp1.Next(); Exp1.More(); Exp1.Next()) {
|
||||
const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current());
|
||||
if (aME.Contains(aE3Next)) {
|
||||
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, AsDes2d,
|
||||
Tol, Standard_True, Pref, theDMVV, bCoincide);
|
||||
BRepAlgo_Image anEmptyImage;
|
||||
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, anOr1, anOr2, AsDes2d,
|
||||
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1795,7 +2012,8 @@ static void MakeChain(const TopoDS_Shape& theV,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes)
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes,
|
||||
BRepAlgo_Image& theImageVV)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
TopTools_MapOfShape aMVDone;
|
||||
@@ -1837,6 +2055,11 @@ Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMap
|
||||
}
|
||||
// and replace the vertex
|
||||
theAsDes->Replace(aVOld, aVNew);
|
||||
if (theImageVV.IsImage(aVOld))
|
||||
{
|
||||
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (theImageVV.ImageFrom(aVOld));
|
||||
theImageVV.Add (aProVertex, aVNew.Oriented(TopAbs_FORWARD));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
|
@@ -24,14 +24,17 @@
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
class BRepAlgo_AsDes;
|
||||
class TopoDS_Face;
|
||||
class BRepAlgo_Image;
|
||||
class BRepOffset_Analyse;
|
||||
class BRepOffset_Offset;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
|
||||
|
||||
//! Computes the intersections betwwen edges on a face
|
||||
//! Computes the intersections between edges on a face
|
||||
//! stores result is SD as AsDes from BRepOffset.
|
||||
class BRepOffset_Inter2d
|
||||
{
|
||||
@@ -50,6 +53,7 @@ public:
|
||||
const TopoDS_Face& F,
|
||||
const TopTools_IndexedMapOfShape& NewEdges,
|
||||
const Standard_Real Tol,
|
||||
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
|
||||
//! Computes the intersection between the offset edges of the <FI>.
|
||||
@@ -58,15 +62,18 @@ public:
|
||||
//! have to be fused using the FuseVertices method.
|
||||
//! theDMVV contains the vertices that should be fused.
|
||||
Standard_EXPORT static Standard_Boolean ConnexIntByInt (const TopoDS_Face& FI,
|
||||
BRepOffset_Offset& OFI,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
const TopTools_DataMapOfShapeShape& Build,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
TopTools_IndexedMapOfShape& FacesWithVerts,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
BRepOffset_Offset& OFI,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
const TopTools_DataMapOfShapeShape& Build,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
TopTools_IndexedMapOfShape& FacesWithVerts,
|
||||
BRepAlgo_Image& theImageVV,
|
||||
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
|
||||
//! Computes the intersection between the offset edges generated
|
||||
//! from vertices and stored into AsDes as descendants of the <FI>.
|
||||
@@ -88,7 +95,9 @@ public:
|
||||
//! and updates AsDes by replacing the old vertices
|
||||
//! with the new ones.
|
||||
Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes);
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes,
|
||||
BRepAlgo_Image& theImageVV);
|
||||
|
||||
//! extents the edge
|
||||
Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E,
|
||||
TopoDS_Edge& NE,
|
||||
|
@@ -169,6 +169,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
|
||||
{
|
||||
TopTools_ListOfShape LInt1, LInt2;
|
||||
TopoDS_Edge NullEdge;
|
||||
TopoDS_Face NullFace;
|
||||
|
||||
if (F1.IsSame(F2)) return;
|
||||
if (IsDone(F1,F2)) return;
|
||||
@@ -221,11 +222,11 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
|
||||
if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
|
||||
TopoDS::Face(InitF2),LE,LV)) {
|
||||
if (!LE.IsEmpty()) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,7 +237,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
|
||||
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
|
||||
}
|
||||
else {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
}
|
||||
}
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
@@ -259,6 +260,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopoDS_Face F1,F2;
|
||||
TopoDS_Edge NullEdge;
|
||||
TopoDS_Face NullFace;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// etape 1 : Intersection of faces // corresponding to the initial faces
|
||||
@@ -273,10 +275,13 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
|
||||
//-----------------------------------------------------------
|
||||
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
|
||||
if (Anc.Extent() == 2) {
|
||||
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First());
|
||||
|
||||
const TopoDS_Face& InitF1 = TopoDS::Face(Anc.First());
|
||||
const TopoDS_Face& InitF2 = TopoDS::Face(Anc.Last());
|
||||
F1 = TopoDS::Face(InitOffsetFace.Image(InitF1).First());
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True);
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,InitF1,InitF2);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
@@ -361,7 +366,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
|
||||
if (!TangentFaces) {
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
@@ -371,7 +376,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
|
||||
if (!TangentFaces) {
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
@@ -635,7 +640,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
|
||||
//
|
||||
if (!IsDone(NF1,NF2)) {
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge);
|
||||
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,F1,F2);
|
||||
SetDone(NF1,NF2);
|
||||
if (!LInt1.IsEmpty()) {
|
||||
Store (NF1,NF2,LInt1,LInt2);
|
||||
@@ -1034,7 +1039,7 @@ void BRepOffset_Inter3d::ContextIntByInt
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopTools_ListOfShape LOE;
|
||||
LOE.Append(OE);
|
||||
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge);
|
||||
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,CF,F);
|
||||
SetDone(NF,CF);
|
||||
if (!LInt1.IsEmpty()) {
|
||||
Store (CF,NF,LInt1,LInt2);
|
||||
@@ -1086,6 +1091,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
|
||||
TopoDS_Edge OE;
|
||||
BRep_Builder B;
|
||||
TopoDS_Edge NullEdge;
|
||||
TopoDS_Face NullFace;
|
||||
Standard_Integer j;
|
||||
|
||||
for (j = 1; j <= ContextFaces.Extent(); j++) {
|
||||
@@ -1255,7 +1261,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
|
||||
// If no trace try intersection.
|
||||
//-------------------------------------------------------
|
||||
if (LInt1.IsEmpty()) {
|
||||
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge);
|
||||
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
|
||||
}
|
||||
Store (CF,OF1,LInt1,LInt2);
|
||||
}
|
||||
|
@@ -51,12 +51,14 @@ BRepOffset_MakeLoops::BRepOffset_MakeLoops()
|
||||
|
||||
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image)
|
||||
BRepAlgo_Image& Image,
|
||||
BRepAlgo_Image& theImageVV)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape it(LF);
|
||||
TopTools_ListIteratorOfListOfShape itl,itLCE;
|
||||
BRepAlgo_Loop Loops;
|
||||
Loops.VerticesForSubstitute( myVerVerMap );
|
||||
Loops.SetImageVV (theImageVV);
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(it.Value());
|
||||
|
@@ -39,11 +39,20 @@ public:
|
||||
|
||||
Standard_EXPORT BRepOffset_MakeLoops();
|
||||
|
||||
Standard_EXPORT void Build (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image);
|
||||
Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image,
|
||||
BRepAlgo_Image& theImageVV);
|
||||
|
||||
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext, const BRepOffset_Analyse& Analyse, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image, const Standard_Boolean InSide);
|
||||
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image,
|
||||
const Standard_Boolean InSide);
|
||||
|
||||
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image);
|
||||
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image);
|
||||
|
||||
|
||||
|
||||
|
@@ -591,6 +591,7 @@ BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S,
|
||||
:
|
||||
myOffset (Offset),
|
||||
myTol (Tol),
|
||||
myInitialShape (S),
|
||||
myShape (S),
|
||||
myMode (Mode),
|
||||
myInter (Inter),
|
||||
@@ -623,6 +624,7 @@ void BRepOffset_MakeOffset::Initialize(const TopoDS_Shape& S,
|
||||
const Standard_Boolean RemoveIntEdges)
|
||||
{
|
||||
myOffset = Offset;
|
||||
myInitialShape = S;
|
||||
myShape = S;
|
||||
myTol = Tol;
|
||||
myMode = Mode;
|
||||
@@ -650,9 +652,11 @@ void BRepOffset_MakeOffset::Clear()
|
||||
myInitOffsetFace .Clear();
|
||||
myInitOffsetEdge .Clear();
|
||||
myImageOffset .Clear();
|
||||
myImageVV .Clear();
|
||||
myFaces .Clear();
|
||||
myOriginalFaces .Clear();
|
||||
myFaceOffset .Clear();
|
||||
myEdgeIntEdges .Clear();
|
||||
myAsDes ->Clear();
|
||||
myDone = Standard_False;
|
||||
myGenerated.Clear();
|
||||
@@ -1256,7 +1260,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
{
|
||||
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
|
||||
}
|
||||
//----------------------------------------------
|
||||
// Intersections 2d on caps.
|
||||
@@ -1266,10 +1270,10 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
{
|
||||
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
|
||||
}
|
||||
//
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes);
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV);
|
||||
//-------------------------------
|
||||
// Unwinding of extended Faces.
|
||||
//-------------------------------
|
||||
@@ -1286,7 +1290,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
}
|
||||
}
|
||||
else {
|
||||
myMakeLoops.Build(LFE, AsDes, IMOE);
|
||||
myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV);
|
||||
}
|
||||
//
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -2526,10 +2530,10 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= Modif.Extent(); i++) {
|
||||
const TopoDS_Face& F = TopoDS::Face(Modif(i));
|
||||
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV);
|
||||
}
|
||||
//
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV);
|
||||
//
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichInt2d) {
|
||||
@@ -2569,7 +2573,7 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
|
||||
BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset);
|
||||
}
|
||||
else {
|
||||
myMakeLoops.Build(LF,myAsDes,myImageOffset);
|
||||
myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -3345,7 +3349,7 @@ const BRepAlgo_Image& BRepOffset_MakeOffset::OffsetEdgesFromShapes() const
|
||||
|
||||
const TopTools_IndexedMapOfShape& BRepOffset_MakeOffset::ClosingFaces () const
|
||||
{
|
||||
return myFaces;
|
||||
return myOriginalFaces;
|
||||
}
|
||||
|
||||
|
||||
@@ -3998,8 +4002,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
|
||||
{
|
||||
const TopoDS_Face& aF = TopoDS::Face (it.Value());
|
||||
aTolF = BRep_Tool::Tolerance (aF);
|
||||
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes2d,
|
||||
myOffset, aTolF, myAnalyse, aMFV, aDMVV))
|
||||
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d,
|
||||
myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV))
|
||||
{
|
||||
myError = BRepOffset_CannotExtentEdge;
|
||||
return;
|
||||
@@ -4015,7 +4019,7 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
|
||||
}
|
||||
//
|
||||
// fuse vertices on edges
|
||||
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d))
|
||||
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d, myImageVV))
|
||||
{
|
||||
myError = BRepOffset_CannotFuseVertices;
|
||||
return;
|
||||
@@ -4490,9 +4494,24 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
|
||||
Standard_FALLTHROUGH
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
if (myInitOffsetFace.HasImage (theS))
|
||||
TopoDS_Shape aS = theS;
|
||||
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
|
||||
if (aPlanface)
|
||||
aS = TopoDS::Face(*aPlanface);
|
||||
|
||||
if (!myFaces.Contains (aS) &&
|
||||
myInitOffsetFace.HasImage (aS))
|
||||
{
|
||||
myInitOffsetFace.LastImage (theS, myGenerated);
|
||||
myInitOffsetFace.LastImage (aS, myGenerated);
|
||||
|
||||
if (!myFaces.IsEmpty())
|
||||
{
|
||||
// Reverse generated shapes in case of small solids.
|
||||
// Useful only for faces without influence on others.
|
||||
TopTools_ListIteratorOfListOfShape it(myGenerated);
|
||||
for (; it.More(); it.Next())
|
||||
it.Value().Reverse();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -4524,9 +4543,33 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
|
||||
//function : Modified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape&)
|
||||
const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape& theShape)
|
||||
{
|
||||
myGenerated.Clear();
|
||||
|
||||
if (theShape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
TopoDS_Shape aS = theShape;
|
||||
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
|
||||
if (aPlanface)
|
||||
aS = TopoDS::Face(*aPlanface);
|
||||
|
||||
if (myFaces.Contains (aS) &&
|
||||
myInitOffsetFace.HasImage (aS))
|
||||
{
|
||||
myInitOffsetFace.LastImage (aS, myGenerated);
|
||||
|
||||
if (!myFaces.IsEmpty())
|
||||
{
|
||||
// Reverse generated shapes in case of small solids.
|
||||
// Useful only for faces without influence on others.
|
||||
TopTools_ListIteratorOfListOfShape it(myGenerated);
|
||||
for (; it.More(); it.Next())
|
||||
it.Value().Reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
|
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
const TopoDS_Shape& InitShape() const
|
||||
{
|
||||
return myShape;
|
||||
return myInitialShape;
|
||||
}
|
||||
|
||||
//! returns information about offset state.
|
||||
@@ -231,6 +231,7 @@ private:
|
||||
|
||||
Standard_Real myOffset;
|
||||
Standard_Real myTol;
|
||||
TopoDS_Shape myInitialShape;
|
||||
TopoDS_Shape myShape;
|
||||
TopoDS_Compound myFaceComp;
|
||||
BRepOffset_Mode myMode;
|
||||
@@ -248,8 +249,10 @@ private:
|
||||
BRepAlgo_Image myInitOffsetFace;
|
||||
BRepAlgo_Image myInitOffsetEdge;
|
||||
BRepAlgo_Image myImageOffset;
|
||||
BRepAlgo_Image myImageVV;
|
||||
TopTools_ListOfShape myWalls;
|
||||
Handle(BRepAlgo_AsDes) myAsDes;
|
||||
TopTools_DataMapOfShapeListOfShape myEdgeIntEdges;
|
||||
Standard_Boolean myDone;
|
||||
BRepOffset_Error myError;
|
||||
BRepOffset_MakeLoops myMakeLoops;
|
||||
|
@@ -5678,7 +5678,9 @@ void IntersectFaces(const TopoDS_Shape& theFInv,
|
||||
TopAbs_State aSide = TopAbs_OUT;
|
||||
TopTools_ListOfShape aLInt1, aLInt2;
|
||||
TopoDS_Edge aNullEdge;
|
||||
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide, aNullEdge);
|
||||
TopoDS_Face aNullFace;
|
||||
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide,
|
||||
aNullEdge, aNullFace, aNullFace);
|
||||
//
|
||||
if (aLInt1.IsEmpty()) {
|
||||
return;
|
||||
|
@@ -1401,8 +1401,9 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
TopTools_ListOfShape& L1,
|
||||
TopTools_ListOfShape& L2,
|
||||
const TopAbs_State Side,
|
||||
const TopoDS_Edge& RefEdge,
|
||||
const Standard_Boolean IsRefEdgeDefined)
|
||||
const TopoDS_Edge& RefEdge,
|
||||
const TopoDS_Face& theRefFace1,
|
||||
const TopoDS_Face& theRefFace2)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if (AffichInter) {
|
||||
@@ -1445,7 +1446,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
aPF.Perform();
|
||||
|
||||
TopTools_IndexedMapOfShape TrueEdges;
|
||||
if (IsRefEdgeDefined)
|
||||
if (!RefEdge.IsNull())
|
||||
CheckIntersFF( aPF.PDS(), RefEdge, TrueEdges );
|
||||
|
||||
Standard_Boolean addPCurve1 = 1;
|
||||
@@ -1494,33 +1495,33 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F1)) {
|
||||
Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d();
|
||||
if(!aC3DETrim.IsNull()) {
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge);
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge);
|
||||
}
|
||||
|
||||
if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F2)) {
|
||||
Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d();
|
||||
if(!aC3DETrim.IsNull()) {
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge);
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge);
|
||||
}
|
||||
|
||||
OrientSection (anEdge, F1, F2, O1, O2);
|
||||
@@ -1563,6 +1564,84 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
|
||||
isEl2 = Standard_True;
|
||||
|
||||
if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
|
||||
{
|
||||
//remove excess edges that are out of range
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices (RefEdge, aV1, aV2);
|
||||
if (!aV1.IsSame(aV2)) //only if RefEdge is open
|
||||
{
|
||||
Handle(Geom_Surface) aRefSurf1 = BRep_Tool::Surface (theRefFace1);
|
||||
Handle(Geom_Surface) aRefSurf2 = BRep_Tool::Surface (theRefFace2);
|
||||
if (aRefSurf1->IsUClosed() || aRefSurf1->IsVClosed() ||
|
||||
aRefSurf2->IsUClosed() || aRefSurf2->IsVClosed())
|
||||
{
|
||||
TopoDS_Edge MinAngleEdge;
|
||||
Standard_Real MinAngle = Precision::Infinite();
|
||||
BRepAdaptor_Curve aRefBAcurve (RefEdge);
|
||||
gp_Pnt aRefPnt = aRefBAcurve.Value ((aRefBAcurve.FirstParameter() + aRefBAcurve.LastParameter())/2);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itl (L1);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (itl.Value());
|
||||
|
||||
BRepAdaptor_Curve aBAcurve (anEdge);
|
||||
gp_Pnt aMidPntOnEdge = aBAcurve.Value ((aBAcurve.FirstParameter() + aBAcurve.LastParameter())/2);
|
||||
gp_Vec RefToMid (aRefPnt, aMidPntOnEdge);
|
||||
|
||||
Extrema_ExtPC aProjector (aRefPnt, aBAcurve);
|
||||
if (aProjector.IsDone())
|
||||
{
|
||||
Standard_Integer imin = 0;
|
||||
Standard_Real MinSqDist = Precision::Infinite();
|
||||
for (Standard_Integer ind = 1; ind <= aProjector.NbExt(); ind++)
|
||||
{
|
||||
Standard_Real aSqDist = aProjector.SquareDistance(ind);
|
||||
if (aSqDist < MinSqDist)
|
||||
{
|
||||
MinSqDist = aSqDist;
|
||||
imin = ind;
|
||||
}
|
||||
}
|
||||
if (imin != 0)
|
||||
{
|
||||
gp_Pnt aProjectionOnEdge = aProjector.Point(imin).Value();
|
||||
gp_Vec RefToProj (aRefPnt, aProjectionOnEdge);
|
||||
Standard_Real anAngle = RefToProj.Angle(RefToMid);
|
||||
if (anAngle < MinAngle)
|
||||
{
|
||||
MinAngle = anAngle;
|
||||
MinAngleEdge = anEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MinAngleEdge.IsNull())
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape itlist1 (L1);
|
||||
TopTools_ListIteratorOfListOfShape itlist2 (L2);
|
||||
|
||||
while (itlist1.More())
|
||||
{
|
||||
const TopoDS_Shape& anEdge = itlist1.Value();
|
||||
if (anEdge.IsSame(MinAngleEdge))
|
||||
{
|
||||
itlist1.Next();
|
||||
itlist2.Next();
|
||||
}
|
||||
else
|
||||
{
|
||||
L1.Remove(itlist1);
|
||||
L2.Remove(itlist2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //if closed
|
||||
} //if (!aV1.IsSame(aV2))
|
||||
} //if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
|
||||
|
||||
if (L1.Extent() > 1 && (!isEl1 || !isEl2)) {
|
||||
TopTools_SequenceOfShape eseq;
|
||||
TopTools_SequenceOfShape EdgesForConcat;
|
||||
@@ -1724,7 +1803,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
eseq.Append( aLocalEdgesForConcat(j) );
|
||||
else
|
||||
eseq.Append( AssembledEdge );
|
||||
}
|
||||
} //for (i = 1; i <= wseq.Length(); i++)
|
||||
} //end of else (when TrueEdges is empty)
|
||||
|
||||
if (eseq.Length() < L1.Extent())
|
||||
@@ -3468,7 +3547,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
|
||||
if (ConstShapes.IsBound(E)) ToBuild.UnBind(E);
|
||||
if (ToBuild.IsBound(E)) {
|
||||
EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False);
|
||||
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,Standard_True);
|
||||
TopoDS_Face NullFace;
|
||||
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,NullFace,NullFace);
|
||||
// No intersection, it may happen for example for a chosen (non-offseted) planar face and
|
||||
// its neighbour offseted cylindrical face, if the offset is directed so that
|
||||
// the radius of the cylinder becomes smaller.
|
||||
|
@@ -87,9 +87,10 @@ public:
|
||||
const TopoDS_Face& F2,
|
||||
TopTools_ListOfShape& LInt1,
|
||||
TopTools_ListOfShape& LInt2,
|
||||
const TopAbs_State Side,
|
||||
const TopoDS_Edge& RefEdge,
|
||||
const Standard_Boolean IsRefEdgeDefined = Standard_False);
|
||||
const TopAbs_State Side,
|
||||
const TopoDS_Edge& RefEdge,
|
||||
const TopoDS_Face& RefFace1,
|
||||
const TopoDS_Face& RefFace2);
|
||||
|
||||
//! Find if the edges <Edges> of the face <F2> are on
|
||||
//! the face <F1>.
|
||||
|
@@ -1780,10 +1780,12 @@ void BiTgte_Blend::ComputeCenters()
|
||||
}
|
||||
}
|
||||
}
|
||||
TopTools_DataMapOfShapeListOfShape anEmptyMap;
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol,
|
||||
anEmptyMap,
|
||||
aDMVV);
|
||||
}
|
||||
}
|
||||
@@ -1813,20 +1815,23 @@ void BiTgte_Blend::ComputeCenters()
|
||||
myAsDes->Add(CurOF,CurOE);
|
||||
}
|
||||
|
||||
TopTools_DataMapOfShapeListOfShape anEmptyMap;
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol,
|
||||
anEmptyMap,
|
||||
aDMVV);
|
||||
}
|
||||
//
|
||||
// fuse vertices on edges stored in AsDes
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
|
||||
BRepAlgo_Image anEmptyImage;
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, anEmptyImage);
|
||||
// ------------
|
||||
// unwinding
|
||||
// ------------
|
||||
BRepOffset_MakeLoops MakeLoops;
|
||||
MakeLoops.Build( LOF, myAsDes, myImageOffset );
|
||||
MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage);
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// It is possible to unwind edges at least one ancestor which of
|
||||
|
@@ -208,12 +208,13 @@ Standard_Integer Extrema_FuncExtCS::GetStateNumber()
|
||||
std::cout <<"F(1)= "<<Sol(1)<<" F(2)= "<<Sol(2)<<" F(3)= "<<Sol(3)<<std::endl;
|
||||
#endif
|
||||
//comparison of solution with previous solutions
|
||||
Standard_Real tol2d = Precision::PConfusion() * Precision::PConfusion();
|
||||
Standard_Real tol2d = Precision::SquarePConfusion();
|
||||
Standard_Integer i = 1, nbSol = mySqDist.Length();
|
||||
for( ; i <= nbSol; i++)
|
||||
{
|
||||
Standard_Real aT = myPoint1(i).Parameter();
|
||||
if( (myt - aT) * (myt - aT) <= tol2d )
|
||||
aT -= myt; aT *= aT;
|
||||
if( aT <= tol2d )
|
||||
break;
|
||||
}
|
||||
if (i <= nbSol)
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -38,6 +38,8 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
|
||||
|
||||
const Standard_Real MaxParamVal = 1.0e+10;
|
||||
const Standard_Real aBorderDivisor = 1.0e+4;
|
||||
@@ -304,35 +306,85 @@ 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;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GlobMinGenCS
|
||||
@@ -447,6 +499,7 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
|
||||
anUVsup(i) = theTUVsup(i + 1);
|
||||
}
|
||||
//
|
||||
//
|
||||
math_PSOParticlesPool aParticles(theNbParticles, aNbVar);
|
||||
|
||||
math_Vector aMinUV(1, aNbVar);
|
||||
@@ -517,10 +570,103 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
|
||||
aCT = ElCLib::InPeriod(aCT, theTUVinf(1), theTUVinf(1) + 2. * M_PI);
|
||||
}
|
||||
}
|
||||
|
||||
theTUV(1) = aCT;
|
||||
theTUV(2) = anUV(1);
|
||||
theTUV(3) = anUV(2);
|
||||
|
||||
Standard_Boolean isBadSol = Standard_False;
|
||||
gp_Vec aDU, aDV, aDT;
|
||||
gp_Pnt aPOnS, aPOnC;
|
||||
myS->D1(anUV(1), anUV(2), aPOnS, aDU, aDV);
|
||||
theC.D1(aCT, aPOnC, aDT);
|
||||
Standard_Real aSqDist = aPOnC.SquareDistance(aPOnS);
|
||||
if (aSqDist <= Precision::SquareConfusion())
|
||||
return;
|
||||
|
||||
gp_Vec aN = aDU.Crossed(aDV);
|
||||
if (aN.SquareMagnitude() < Precision::SquareConfusion())
|
||||
return;
|
||||
|
||||
gp_Vec PcPs(aPOnC, aPOnS);
|
||||
|
||||
Standard_Real anAngMin = M_PI_2 - M_PI_2 / 10.;
|
||||
Standard_Real anAngMax = M_PI_2 + M_PI_2 / 10.;
|
||||
|
||||
Standard_Real anAngN = PcPs.Angle(aN);
|
||||
if (anAngN >= anAngMin && anAngN <= anAngMax)
|
||||
{
|
||||
// PcPs is perpendicular to surface normal, it means that
|
||||
// aPOnC can be on surface, but far from aPOnS
|
||||
isBadSol = Standard_True;
|
||||
Standard_Integer iu, iv;
|
||||
for (iu = -1; iu <= 1; ++iu)
|
||||
{
|
||||
Standard_Real u = anUV(1) + iu * aStepSU;
|
||||
u = Max(anUVinf(1), u);
|
||||
u = Min(anUVsup(1), u);
|
||||
for (iv = -1; iv <= 1; ++iv)
|
||||
{
|
||||
Standard_Real v = anUV(2) + iv * aStepSV;
|
||||
v = Max(anUVinf(2), v);
|
||||
v = Min(anUVsup(2), v);
|
||||
myS->D1(u, v, aPOnS, aDU, aDV);
|
||||
if (aPOnC.SquareDistance(aPOnS) < Precision::SquareConfusion())
|
||||
{
|
||||
isBadSol = Standard_False;
|
||||
break;
|
||||
}
|
||||
aN = aDU.Crossed(aDV);
|
||||
if (aN.SquareMagnitude() < Precision::SquareConfusion())
|
||||
{
|
||||
isBadSol = Standard_False;
|
||||
break;
|
||||
}
|
||||
PcPs.SetXYZ(aPOnS.XYZ() - aPOnC.XYZ());
|
||||
anAngN = PcPs.Angle(aN);
|
||||
if (anAngN < anAngMin || anAngN > anAngMax)
|
||||
{
|
||||
isBadSol = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isBadSol)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBadSol)
|
||||
{
|
||||
//Try to precise solution with help of Extrema PS
|
||||
|
||||
math_Vector aF(1, 3);
|
||||
aF(1) = PcPs.Dot(aDT);
|
||||
aF(2) = PcPs.Dot(aDU);
|
||||
aF(3) = PcPs.Dot(aDV);
|
||||
Standard_Real aFF = aF.Norm2();
|
||||
|
||||
Extrema_GenLocateExtPS anExtPS(*myS, mytol2, mytol2);
|
||||
anExtPS.Perform(aPOnC, anUV(1), anUV(2), Standard_False);
|
||||
if (anExtPS.IsDone())
|
||||
{
|
||||
const Extrema_POnSurf& aPmin = anExtPS.Point();
|
||||
aPmin.Parameter(anUV(1), anUV(2));
|
||||
math_Vector aTUV = theTUV;
|
||||
aTUV(2) = anUV(1);
|
||||
aTUV(3) = anUV(2);
|
||||
myF.Value(aTUV, aF);
|
||||
Standard_Real aFF1 = aF.Norm2();
|
||||
|
||||
if (anExtPS.SquareDistance() < aSqDist && aFF1 <= 1.1 * aFF)
|
||||
{
|
||||
theTUV(2) = aTUV(2);
|
||||
theTUV(3) = aTUV(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GlobMinCQuadric
|
||||
|
@@ -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>
|
||||
@@ -50,8 +53,10 @@
|
||||
#include <IntPatch_ImpImpIntersection.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <ShapeAnalysis_WireOrder.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
#include <ShapeBuild_Edge.hxx>
|
||||
#include <ShapeBuild_ReShape.hxx>
|
||||
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
|
||||
#include <ShapeFix_Edge.hxx>
|
||||
#include <ShapeFix_Face.hxx>
|
||||
#include <ShapeFix_Shell.hxx>
|
||||
@@ -67,6 +72,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 +102,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 +140,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 +1483,361 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
||||
return ResEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnionPCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape& theChain,
|
||||
TopoDS_Edge& theEdge)
|
||||
{
|
||||
Standard_Real aFirst3d, aLast3d;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aFirst3d, aLast3d);
|
||||
Standard_Real aTolEdge = BRep_Tool::Tolerance(theEdge);
|
||||
Standard_Real aMaxTol = aTolEdge;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
//Check the results for consistency
|
||||
Standard_Boolean IsBadRange = Standard_False;
|
||||
Standard_Real aRange3d = aLast3d - aFirst3d;
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
Standard_Real aRange = ResLasts(ii) - ResFirsts(ii);
|
||||
if (Abs (aRange3d - aRange) > aMaxTol)
|
||||
IsBadRange = Standard_True;
|
||||
}
|
||||
|
||||
if (IsBadRange)
|
||||
{
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceSeq(ii));
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace);
|
||||
Handle(ShapeAnalysis_Surface) aSAS = new ShapeAnalysis_Surface (aSurf);
|
||||
ShapeConstruct_ProjectCurveOnSurface aToolProj;
|
||||
aToolProj.Init (aSAS, Precision::Confusion());
|
||||
Handle(Geom2d_Curve) aNewPCurve;
|
||||
if (aToolProj.Perform(aCurve, aFirst3d, aLast3d, aNewPCurve))
|
||||
ResPCurves(ii) = aNewPCurve;
|
||||
else
|
||||
{
|
||||
//Reparametrize pcurve
|
||||
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 (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
ResFirsts(ii) = aFirst3d;
|
||||
ResLasts(ii) = aLast3d;
|
||||
}
|
||||
}
|
||||
|
||||
//Reparametrize 3d curve if needed
|
||||
if (!ResPCurves.IsEmpty())
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(1)) > aMaxTol ||
|
||||
Abs (aLast3d - ResLasts(1)) > aMaxTol)
|
||||
{
|
||||
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 (aFirst3d);
|
||||
gp_Vec anOffset = -aDir;
|
||||
anOffset *= ResFirsts(1);
|
||||
aPnt.Translate (anOffset);
|
||||
Handle(Geom_Line) aLine = new Geom_Line (aPnt, aDir);
|
||||
aBuilder.UpdateEdge (theEdge, aLine, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
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 = aFirst3d - ResFirsts(1);
|
||||
aPosition.Rotate (anAxis, anOffset);
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle (aPosition, aRadius);
|
||||
aBuilder.UpdateEdge (theEdge, aCircle, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(ii)) > Precision::Confusion() ||
|
||||
Abs (aLast3d - 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 (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer j = 1; j <= ResPCurves.Length(); j++)
|
||||
{
|
||||
aBuilder.UpdateEdge(theEdge, ResPCurves(j), TopoDS::Face(aFaceSeq(j)), aTolEdge);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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 +1903,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 +1918,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 +1946,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 +1965,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 +1976,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 +2021,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 +2080,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 +2293,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 +2377,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 +2388,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 +2399,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 +2511,8 @@ void ShapeUpgrade_UnifySameDomain::Initialize(const TopoDS_Shape& aShape,
|
||||
myContext->Clear();
|
||||
myKeepShapes.Clear();
|
||||
myFacePlaneMap.Clear();
|
||||
myEFmap.Clear();
|
||||
myFaceNewFace.Clear();
|
||||
myHistory->Clear();
|
||||
}
|
||||
|
||||
@@ -2680,6 +3050,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 +3132,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 +3282,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 +3350,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 +3362,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 +3398,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 +3437,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 +3524,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
|
||||
//=======================================================================
|
||||
void ShapeUpgrade_UnifySameDomain::Build()
|
||||
{
|
||||
TopExp::MapShapesAndAncestors(myInitShape, TopAbs_EDGE, TopAbs_FACE, myEFmap);
|
||||
|
||||
if (myUnifyFaces)
|
||||
UnifyFaces();
|
||||
if (myUnifyEdges)
|
||||
@@ -3233,3 +3619,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,19 +35,20 @@
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 5
|
||||
#define OCC_VERSION_MAINTENANCE 0
|
||||
#define OCC_VERSION_MAINTENANCE 2
|
||||
|
||||
//! 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.:
|
||||
//! - "dev" for development version between releases
|
||||
//! - "beta..." or "rc..." for beta releases or release candidates
|
||||
//! - "project..." for version containing project-specific fixes
|
||||
//#define OCC_VERSION_DEVELOPMENT "beta"
|
||||
//#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
#define OCC_VERSION_SERVICEPACK 1
|
||||
|
||||
// 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.0"
|
||||
#define OCC_VERSION_COMPLETE "7.5.2"
|
||||
|
||||
//! 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
|
18
tests/bugs/heal/bug32332_1
Normal file
18
tests/bugs/heal/bug32332_1
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "=========================================================="
|
||||
puts "OCC32332: Incorrect result of ShapeUpgrade_UnifySameDomain"
|
||||
puts "=========================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32332_1.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -wire 4 -edge 9 -vertex 6
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 2.e-7} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
18
tests/bugs/heal/bug32332_2
Normal file
18
tests/bugs/heal/bug32332_2
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "=========================================================="
|
||||
puts "OCC32332: Incorrect result of ShapeUpgrade_UnifySameDomain"
|
||||
puts "=========================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32332_2.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -wire 4 -edge 12 -vertex 8
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 2.e-7} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
@@ -1,4 +1,8 @@
|
||||
puts "TODO OCC25925 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC25925 ALL: ERROR. offsetperform operation not done."
|
||||
puts "TODO OCC25925 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC25925 ALL: Faulty OCC5805 : result is not Closed shape"
|
||||
puts "TODO OCC25925 ALL: TEST INCOMPLETE"
|
||||
puts "TODO OCC25925 ALL: Tcl Exception: Error : command \\\"nbshapes result\\\" gives an empty result"
|
||||
|
||||
puts "============"
|
||||
puts "OCC5805"
|
||||
@@ -32,7 +36,7 @@ if [catch { thrusections s ${issolid} ${isruled} UpCover BottomCover } catch_res
|
||||
|
||||
set distance -0.001
|
||||
catch { OFFSETSHAPE $distance {s_2} $calcul $type }
|
||||
# Bad result
|
||||
# Null result
|
||||
|
||||
checkprops result -s 358.795
|
||||
|
||||
@@ -48,6 +52,6 @@ if {$index == -1} {
|
||||
|
||||
}
|
||||
|
||||
checkshape result
|
||||
checknbshapes result -t -wire 5 -face 5 -shell 2 -solid 1
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -1,6 +1,6 @@
|
||||
puts "TODO OCC23068 ALL: Error : is WRONG because number of"
|
||||
puts "TODO OCC23068 ALL: Error : The area of result shape is"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC25925 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC25925 ALL: TEST INCOMPLETE"
|
||||
puts "TODO OCC25925 ALL: Tcl Exception: Error : command \\\"nbshapes result\\\" gives an empty result"
|
||||
|
||||
puts "============"
|
||||
puts "OCC5805"
|
||||
@@ -36,9 +36,7 @@ set distance -0.001
|
||||
catch { OFFSETSHAPE $distance {} $calcul $type }
|
||||
# Null result
|
||||
|
||||
|
||||
checkprops result -s 495.635
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -vertex 2 -edge 3 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 0 -shape 13
|
||||
|
||||
@@ -54,5 +52,4 @@ if {$index == -1} {
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -1,4 +1,6 @@
|
||||
puts "TODO OCC25925 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC25925 ALL: Faulty OCC5805 : result is not Closed shape"
|
||||
puts "TODO OCC25925 ALL: ERROR. offsetperform operation not done."
|
||||
puts "TODO OCC25925 ALL: Error: The command cannot be built"
|
||||
|
||||
puts "============"
|
||||
puts "OCC5805"
|
||||
@@ -32,11 +34,10 @@ if [catch { thrusections s ${issolid} ${isruled} UpCover BottomCover } catch_res
|
||||
|
||||
set distance -0.001
|
||||
catch { OFFSETSHAPE $distance {s_2} $calcul $type }
|
||||
# Bad result
|
||||
# Null result
|
||||
|
||||
|
||||
checkprops result -s 495.635
|
||||
checkshape result
|
||||
|
||||
set index [lsearch [whatis s] Closed]
|
||||
if {$index == -1} {
|
||||
@@ -50,5 +51,4 @@ if {$index == -1} {
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -19,16 +19,22 @@ 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]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
||||
|
@@ -19,16 +19,22 @@ 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]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
||||
|
43
tests/bugs/modalg_7/bug31735_3
Normal file
43
tests/bugs/modalg_7/bug31735_3
Normal file
@@ -0,0 +1,43 @@
|
||||
puts "======================================================================"
|
||||
puts "OCC31735: BRepOffset_MakeOffset works slowly and produces wrong result"
|
||||
puts "======================================================================"
|
||||
puts ""
|
||||
|
||||
setfillhistory 1
|
||||
|
||||
restore [locate_data_file bug31735_1.brep] a
|
||||
|
||||
offsetparameter 1e-7 c i
|
||||
offsetload a 0.02
|
||||
offsetperform result
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -t -wire 28 -face 28 -shell 1 -solid 1
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 0.001001} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
savehistory hh
|
||||
|
||||
explode a f
|
||||
generated gf hh a_2
|
||||
checkprops gf -s 0.582567
|
||||
|
||||
explode a_2 e
|
||||
generated ge hh a_2_3
|
||||
checkprops ge -l 0.440027
|
||||
|
||||
explode a_2_3
|
||||
generated gv hh a_2_3_1
|
||||
|
||||
axo
|
||||
donly a_2 a_2_3 a_2_3_1 result gf ge gv
|
||||
fit
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||
|
||||
puts "TEST COMPLETED"
|
41
tests/bugs/modalg_7/bug31735_4
Normal file
41
tests/bugs/modalg_7/bug31735_4
Normal file
@@ -0,0 +1,41 @@
|
||||
puts "======================================================================"
|
||||
puts "OCC31735: BRepOffset_MakeOffset works slowly and produces wrong result"
|
||||
puts "======================================================================"
|
||||
puts ""
|
||||
|
||||
setfillhistory 1
|
||||
|
||||
restore [locate_data_file bug31735_1.brep] a
|
||||
explode a f
|
||||
|
||||
offsetparameter 1e-7 c i
|
||||
offsetload a -0.02 a_1 a_2 a_3 a_4 a_10 a_11 a_12 a_15
|
||||
offsetperform result
|
||||
|
||||
checknbshapes result -t -wire 49 -face 49 -shell 1 -solid 1
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 0.001001} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
savehistory hh
|
||||
|
||||
generated gf6 hh a_6
|
||||
checkprops gf6 -s 0.255127
|
||||
|
||||
modified mf2 hh a_2
|
||||
checkprops mf2 -s 0.0270215
|
||||
|
||||
if {[regexp "Not deleted" [isdeleted hh a_1]]} {
|
||||
puts "Error: History information is wrong"
|
||||
}
|
||||
|
||||
axo
|
||||
donly result gf6 mf2
|
||||
fit
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||
|
||||
puts "TEST COMPLETED"
|
15
tests/bugs/modalg_7/bug31845_1
Normal file
15
tests/bugs/modalg_7/bug31845_1
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_1.brep] a
|
||||
|
||||
offsetparameter 1e-7 c i
|
||||
offsetload a 0.2
|
||||
offsetperform result
|
||||
|
||||
checkshape result
|
||||
checkprops result -s 271.847
|
||||
checknbshapes result -t -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
15
tests/bugs/modalg_7/bug31845_2
Normal file
15
tests/bugs/modalg_7/bug31845_2
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_1.brep] a
|
||||
|
||||
offsetparameter 1e-7 c i
|
||||
offsetload a -0.2
|
||||
offsetperform result
|
||||
|
||||
checkshape result
|
||||
checkprops result -s 210.825
|
||||
checknbshapes result -t -edge 12 -wire 6 -face 6 -shell 1 -solid 1
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
16
tests/bugs/modalg_7/bug31845_3
Normal file
16
tests/bugs/modalg_7/bug31845_3
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_1.brep] a
|
||||
explode a f
|
||||
|
||||
offsetparameter 1e-7 p i
|
||||
offsetload a 0.2 a_5 a_6
|
||||
offsetperform result
|
||||
|
||||
checkshape result
|
||||
checkprops result -s 423.33
|
||||
checknbshapes result -t -edge 24 -wire 12 -face 10 -shell 1 -solid 1
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
17
tests/bugs/modalg_7/bug31845_4
Normal file
17
tests/bugs/modalg_7/bug31845_4
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_1.brep] a
|
||||
|
||||
explode a f
|
||||
|
||||
offsetparameter 1e-7 p i
|
||||
offsetload a -0.2 a_5 a_6
|
||||
offsetperform result
|
||||
|
||||
checkshape result
|
||||
checkprops result -s 388.879
|
||||
checknbshapes result -t -edge 24 -wire 12 -face 10 -shell 1 -solid 1
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
14
tests/bugs/modalg_7/bug31845_f
Normal file
14
tests/bugs/modalg_7/bug31845_f
Normal file
@@ -0,0 +1,14 @@
|
||||
puts "TODO OCC31845 All: ERROR. offsetperform operation not done."
|
||||
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_f.brep] a
|
||||
explode a f
|
||||
|
||||
offsetparameter 1e-7 p i
|
||||
offsetload a 0.001 a_4 a_5
|
||||
offsetperform result
|
||||
|
16
tests/bugs/modalg_7/bug31845_h
Normal file
16
tests/bugs/modalg_7/bug31845_h
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "TODO OCC31845 All: ERROR: null result"
|
||||
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_h.brep] a
|
||||
|
||||
offsetparameter 1e-7 p i
|
||||
offsetload a -0.01
|
||||
offsetperform result
|
||||
|
||||
if {[llength [whatis result]] < 4} {
|
||||
puts "ERROR: null result"
|
||||
}
|
13
tests/bugs/modalg_7/bug31845_i
Normal file
13
tests/bugs/modalg_7/bug31845_i
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "TODO OCC31845 All: ERROR. offsetperform operation not done."
|
||||
|
||||
puts "============================================"
|
||||
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug31845_h.brep] a
|
||||
explode a f
|
||||
|
||||
offsetparameter 1e-7 p i
|
||||
offsetload a 0.001 a_3 a_4
|
||||
offsetperform result
|
46
tests/bugs/modalg_7/bug31912
Normal file
46
tests/bugs/modalg_7/bug31912
Normal file
@@ -0,0 +1,46 @@
|
||||
puts "======================================================="
|
||||
puts "0031912: Modeling Algorithms - Boolean Cut can't build resulting shape"
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
|
||||
pload DATAEXCHANGE
|
||||
|
||||
stepread [locate_data_file bug31912_s.stp] s *
|
||||
stepread [locate_data_file bug31912_b.stp] b *
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s_1
|
||||
baddtools b_1
|
||||
bfillds
|
||||
|
||||
bbop r0 0
|
||||
bbop r1 1
|
||||
bbop r2 2
|
||||
bbop r3 3
|
||||
bbop r4 4
|
||||
bbuild rgf
|
||||
|
||||
foreach r {r0 r1 r2 r3 r4 rgf} {
|
||||
checkshape $r
|
||||
}
|
||||
|
||||
checknbshapes r0 -wire 6 -face 6 -shell 1 -solid 1 -t
|
||||
checkprops r0 -s 279207 -v 5.32814e+06
|
||||
|
||||
checknbshapes r1 -wire 12 -face 12 -shell 1 -solid 1 -t
|
||||
checkprops r1 -s 4.93771e+06 -v 1.56185e+08
|
||||
|
||||
checknbshapes r2 -wire 8 -face 8 -shell 1 -solid 1 -t
|
||||
checkprops r2 -s 4.37427e+06 -v 1.34873e+08
|
||||
|
||||
checknbshapes r3 -wire 6 -face 6 -shell 1 -solid 1 -t
|
||||
checkprops r3 -s 571214 -v 1.59844e+07
|
||||
|
||||
checkprops r4 -l 3810.09
|
||||
checksection r4 -r 4
|
||||
|
||||
checknbshapes rgf -wire 16 -face 16 -shell 3 -solid 3 -t
|
||||
checkprops rgf -s 5.22469e+06 -v 1.56185e+08
|
||||
|
||||
checkview -display rgf -2d -path ${imagedir}/${test_image}.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
|
15
tests/bugs/moddata_3/bug32058
Normal file
15
tests/bugs/moddata_3/bug32058
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "========="
|
||||
puts "0032058: Modeling Data - Extrema curve-surface gives wrong result for planar surface of revolunion and circle"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
|
||||
restore [locate_data_file bug32058_c] c
|
||||
restore [locate_data_file bug32058_s] s
|
||||
|
||||
extrema c s
|
||||
checklength ext_1 -l 2.3437142008433856e-13
|
||||
|
||||
smallview
|
||||
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,3 +1,5 @@
|
||||
puts "TODO OCC26030 ALL: Error : The offset cannot be built"
|
||||
|
||||
puts "========"
|
||||
puts "OCC26288"
|
||||
puts "========"
|
0
tests/bugs/modalg_4/bug5806 → tests/offset/bugs/bug5806
Executable file → Normal file
0
tests/bugs/modalg_4/bug5806 → tests/offset/bugs/bug5806
Executable file → Normal file
@@ -1,7 +1,6 @@
|
||||
puts "TODO OCC24156 MacOS: An exception was caught"
|
||||
puts "TODO OCC24156 MacOS: TEST INCOMPLETE"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC23068 ALL: Error : The area of face result_3 of the resulting shape is negative."
|
||||
puts "TODO OCC23068 ALL: Error: bsection of the result and s is not equal to zero."
|
||||
|
||||
ellipse w1 0 0 0 15 10
|
||||
mkedge w1 w1 0 pi/2
|
||||
|
@@ -1,5 +1,4 @@
|
||||
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
|
||||
puts "TODO OCC27414 ALL: the resulting shape is negative"
|
||||
|
||||
restore [locate_data_file bug26917_dom-8092.new_with_faces.brep] c
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
|
||||
puts "TODO OCC27414 ALL: the resulting shape is negative"
|
||||
|
||||
restore [locate_data_file bug26917_dom-8092.new_trim2_with_faces.brep] c
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
|
||||
puts "TODO OCC27414 ALL: the resulting shape is negative"
|
||||
|
||||
restore [locate_data_file bug26917_dom-8092.new_trim4_with_faces.brep] c
|
||||
|
||||
|
Reference in New Issue
Block a user