mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
Patch for HYDRO.
This commit is contained in:
parent
8b1ad7e012
commit
3373e9af3a
@ -735,28 +735,12 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(theType == TopAbs_EDGE) {
|
else if(theType == TopAbs_EDGE) {
|
||||||
Standard_Integer aDiscretize = 30;
|
|
||||||
Standard_Real aDeflection = 0.01;
|
|
||||||
const TopoDS_Edge& aE1 = *(TopoDS_Edge*)&(aS1);
|
const TopoDS_Edge& aE1 = *(TopoDS_Edge*)&(aS1);
|
||||||
const TopoDS_Edge& aE2 = *(TopoDS_Edge*)&(aS2);
|
const TopoDS_Edge& aE2 = *(TopoDS_Edge*)&(aS2);
|
||||||
|
//
|
||||||
IntTools_EdgeEdge aEE;
|
IntTools_EdgeEdge aEE(aE1, aE2);
|
||||||
aEE.SetEdge1 (aE1);
|
//
|
||||||
aEE.SetEdge2 (aE2);
|
|
||||||
aEE.SetTolerance1 (BRep_Tool::Tolerance(aE1));
|
|
||||||
aEE.SetTolerance2 (BRep_Tool::Tolerance(aE2));
|
|
||||||
aEE.SetDiscretize (aDiscretize);
|
|
||||||
aEE.SetDeflection (aDeflection);
|
|
||||||
|
|
||||||
Standard_Real f = 0., l = 0.;
|
|
||||||
BRep_Tool::Range(aE1, f, l);
|
|
||||||
aEE.SetRange1(f, l);
|
|
||||||
|
|
||||||
BRep_Tool::Range(aE2, f, l);
|
|
||||||
aEE.SetRange2(f, l);
|
|
||||||
|
|
||||||
aEE.Perform();
|
aEE.Perform();
|
||||||
|
|
||||||
if (aEE.IsDone()) {
|
if (aEE.IsDone()) {
|
||||||
const IntTools_SequenceOfCommonPrts& aCPrts = aEE.CommonParts();
|
const IntTools_SequenceOfCommonPrts& aCPrts = aEE.CommonParts();
|
||||||
Standard_Integer ii = 0;
|
Standard_Integer ii = 0;
|
||||||
|
@ -69,17 +69,14 @@
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOPAlgo_PaveFiller::PerformEE()
|
void BOPAlgo_PaveFiller::PerformEE()
|
||||||
{
|
{
|
||||||
Standard_Boolean bJustAdd, bOrder;
|
Standard_Boolean bJustAdd;
|
||||||
Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize;
|
Standard_Integer i, iX, iSize, nE1, nE2;
|
||||||
Standard_Integer aNbCPrts, nWhat, nWith;
|
Standard_Integer aNbCPrts;
|
||||||
Standard_Real aTS11, aTS12, aTS21, aTS22,
|
Standard_Real aTS11, aTS12, aTS21, aTS22,
|
||||||
aT11, aT12, aT21, aT22;
|
aT11, aT12, aT21, aT22;
|
||||||
Standard_Real aTolE1, aTolE2, aDeflection;
|
|
||||||
TopAbs_ShapeEnum aType;
|
TopAbs_ShapeEnum aType;
|
||||||
TopoDS_Edge aEWhat, aEWith;
|
|
||||||
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
|
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
|
||||||
Handle(NCollection_IncAllocator) aAllocator;
|
Handle(NCollection_IncAllocator) aAllocator;
|
||||||
Handle(BOPDS_PaveBlock) aPBn1, aPBn2;
|
|
||||||
BOPDS_MapOfPaveBlock aMPBToUpdate;
|
BOPDS_MapOfPaveBlock aMPBToUpdate;
|
||||||
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
|
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
|
||||||
//
|
//
|
||||||
@ -96,9 +93,6 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
|
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
|
||||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
|
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
|
||||||
//
|
//
|
||||||
aDiscretize=30;
|
|
||||||
aDeflection=0.01;
|
|
||||||
//
|
|
||||||
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
|
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
|
||||||
aEEs.SetStartSize(iSize);
|
aEEs.SetStartSize(iSize);
|
||||||
aEEs.SetIncrement(iSize);
|
aEEs.SetIncrement(iSize);
|
||||||
@ -122,9 +116,6 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.Shape()));
|
const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.Shape()));
|
||||||
const TopoDS_Edge& aE2=(*(TopoDS_Edge *)(&aSIE2.Shape()));
|
const TopoDS_Edge& aE2=(*(TopoDS_Edge *)(&aSIE2.Shape()));
|
||||||
//
|
//
|
||||||
aTolE1=BRep_Tool::Tolerance(aE1);
|
|
||||||
aTolE2=BRep_Tool::Tolerance(aE2);
|
|
||||||
//
|
|
||||||
BOPDS_ListOfPaveBlock& aLPB1=myDS->ChangePaveBlocks(nE1);
|
BOPDS_ListOfPaveBlock& aLPB1=myDS->ChangePaveBlocks(nE1);
|
||||||
BOPDS_ListOfPaveBlock& aLPB2=myDS->ChangePaveBlocks(nE2);
|
BOPDS_ListOfPaveBlock& aLPB2=myDS->ChangePaveBlocks(nE2);
|
||||||
//
|
//
|
||||||
@ -158,75 +149,23 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// -----------f
|
IntTools_EdgeEdge anEdgeEdge;
|
||||||
//DEBft
|
|
||||||
//printf(" nE1=%d nE2=%d\n", nE1, nE2);
|
|
||||||
//
|
|
||||||
IntTools_EdgeEdge aEdgeEdge;
|
|
||||||
//
|
|
||||||
aEdgeEdge.SetEdge1 (aE1);
|
|
||||||
aEdgeEdge.SetEdge2 (aE2);
|
|
||||||
aEdgeEdge.SetTolerance1 (aTolE1);
|
|
||||||
aEdgeEdge.SetTolerance2 (aTolE2);
|
|
||||||
aEdgeEdge.SetDiscretize (aDiscretize);
|
|
||||||
aEdgeEdge.SetDeflection (aDeflection);
|
|
||||||
//
|
|
||||||
IntTools_Range aSR1(aTS11, aTS12);
|
|
||||||
IntTools_Range aSR2(aTS21, aTS22);
|
|
||||||
IntTools_Range anewSR1 = aSR1;
|
|
||||||
IntTools_Range anewSR2 = aSR2;
|
|
||||||
//
|
|
||||||
BOPTools_AlgoTools::CorrectRange (aE1, aE2, aSR1, anewSR1);
|
|
||||||
BOPTools_AlgoTools::CorrectRange (aE2, aE1, aSR2, anewSR2);
|
|
||||||
//
|
//
|
||||||
aPB1->Range(aT11, aT12);
|
aPB1->Range(aT11, aT12);
|
||||||
aPB2->Range(aT21, aT22);
|
aPB2->Range(aT21, aT22);
|
||||||
IntTools_Range aPBRange1(aT11, aT12), aPBRange2(aT21, aT22);
|
|
||||||
//
|
//
|
||||||
IntTools_Range aPBR1 = aPBRange1;
|
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
|
||||||
IntTools_Range aPBR2 = aPBRange2;
|
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
|
||||||
BOPTools_AlgoTools::CorrectRange (aE1, aE2, aPBR1, aPBRange1);
|
|
||||||
BOPTools_AlgoTools::CorrectRange (aE2, aE1, aPBR2, aPBRange2);
|
|
||||||
//
|
//
|
||||||
aEdgeEdge.SetRange1(aPBRange1);
|
anEdgeEdge.Perform();
|
||||||
aEdgeEdge.SetRange2(aPBRange2);
|
if (!anEdgeEdge.IsDone()) {
|
||||||
//
|
|
||||||
aEdgeEdge.Perform();
|
|
||||||
if (!aEdgeEdge.IsDone()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
bOrder=aEdgeEdge.Order();
|
IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
|
||||||
if (!bOrder) {
|
aR21(aT21, aTS21), aR22(aTS22, aT22);
|
||||||
aEWhat=aE1;
|
|
||||||
aEWith=aE2;
|
|
||||||
nWhat=nE1;
|
|
||||||
nWith=nE2;
|
|
||||||
aSR1=anewSR1;
|
|
||||||
aSR2=anewSR2;
|
|
||||||
aPBR1=aPBRange1;
|
|
||||||
aPBR2=aPBRange2;
|
|
||||||
aPBn1=aPB1;
|
|
||||||
aPBn2=aPB2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nWhat=nE2;
|
|
||||||
nWith=nE1;
|
|
||||||
aEWhat=aE2;
|
|
||||||
aEWith=aE1;
|
|
||||||
aSR1=anewSR2;
|
|
||||||
aSR2=anewSR1;
|
|
||||||
aPBR1=aPBRange2;
|
|
||||||
aPBR2=aPBRange1;
|
|
||||||
aPBn1=aPB2;
|
|
||||||
aPBn2=aPB1;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
IntTools_Range aR11(aPBR1.First(), aSR1.First()), aR12(aSR1.Last(), aPBR1.Last()),
|
|
||||||
aR21(aPBR2.First(), aSR2.First()), aR22(aSR2.Last(), aPBR2.Last());
|
|
||||||
//
|
|
||||||
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeEdge.CommonParts();
|
|
||||||
//
|
//
|
||||||
|
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
|
||||||
aNbCPrts=aCPrts.Length();
|
aNbCPrts=aCPrts.Length();
|
||||||
for (i=1; i<=aNbCPrts; ++i) {
|
for (i=1; i<=aNbCPrts; ++i) {
|
||||||
const IntTools_CommonPrt& aCPart=aCPrts(i);
|
const IntTools_CommonPrt& aCPart=aCPrts(i);
|
||||||
@ -237,18 +176,25 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
Standard_Integer nV[4], j;
|
Standard_Integer nV[4], j;
|
||||||
Standard_Real aT1, aT2, aTol;
|
Standard_Real aT1, aT2, aTol;
|
||||||
TopoDS_Vertex aVnew;
|
TopoDS_Vertex aVnew;
|
||||||
|
IntTools_Range aCR1, aCR2;
|
||||||
//
|
//
|
||||||
BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
|
BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
|
||||||
aTol=Precision::Confusion();
|
aTol = Precision::Confusion();
|
||||||
|
aCR1 = aCPart.Range1();
|
||||||
|
aCR2 = aCPart.Ranges2()(1);
|
||||||
//
|
//
|
||||||
//decide to keep the pave or not
|
//decide to keep the pave or not
|
||||||
bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol);
|
bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) ||
|
||||||
bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol);
|
BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
|
||||||
bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol);
|
bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol) ||
|
||||||
bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol);
|
BOPInt_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
|
||||||
|
bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol) ||
|
||||||
|
BOPInt_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
|
||||||
|
bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol) ||
|
||||||
|
BOPInt_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
|
||||||
//
|
//
|
||||||
aPBn1->Indices(nV[0], nV[1]);
|
aPB1->Indices(nV[0], nV[1]);
|
||||||
aPBn2->Indices(nV[2], nV[3]);
|
aPB2->Indices(nV[2], nV[3]);
|
||||||
//
|
//
|
||||||
if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) ||
|
if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) ||
|
||||||
(bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) {
|
(bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) {
|
||||||
@ -259,7 +205,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
for (j = 0; j < 4; ++j) {
|
for (j = 0; j < 4; ++j) {
|
||||||
if (bIsOnPave[j]) {
|
if (bIsOnPave[j]) {
|
||||||
//add interf VE(nV[j], nE)
|
//add interf VE(nV[j], nE)
|
||||||
Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPBn2 : aPBn1;
|
Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
|
||||||
ForceInterfVE(nV[j], aPB, aMPBToUpdate);
|
ForceInterfVE(nV[j], aPB, aMPBToUpdate);
|
||||||
bFlag = Standard_True;
|
bFlag = Standard_True;
|
||||||
break;
|
break;
|
||||||
@ -269,7 +215,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BOPTools_AlgoTools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aVnew);
|
BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
|
||||||
// <-LXBR
|
// <-LXBR
|
||||||
{
|
{
|
||||||
Standard_Integer nVS[2], iFound, k;
|
Standard_Integer nVS[2], iFound, k;
|
||||||
@ -316,10 +262,10 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
// 1
|
// 1
|
||||||
iX=aEEs.Append()-1;
|
iX=aEEs.Append()-1;
|
||||||
BOPDS_InterfEE& aEE=aEEs(iX);
|
BOPDS_InterfEE& aEE=aEEs(iX);
|
||||||
aEE.SetIndices(nWhat, nWith);
|
aEE.SetIndices(nE1, nE2);
|
||||||
aEE.SetCommonPart(aCPart);
|
aEE.SetCommonPart(aCPart);
|
||||||
// 2
|
// 2
|
||||||
myDS->AddInterf(nWhat, nWith);
|
myDS->AddInterf(nE1, nE2);
|
||||||
//
|
//
|
||||||
BOPDS_CoupleOfPaveBlocks aCPB;
|
BOPDS_CoupleOfPaveBlocks aCPB;
|
||||||
//
|
//
|
||||||
@ -342,10 +288,10 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
// 1
|
// 1
|
||||||
iX=aEEs.Append()-1;
|
iX=aEEs.Append()-1;
|
||||||
BOPDS_InterfEE& aEE=aEEs(iX);
|
BOPDS_InterfEE& aEE=aEEs(iX);
|
||||||
aEE.SetIndices(nWhat, nWith);
|
aEE.SetIndices(nE1, nE2);
|
||||||
aEE.SetCommonPart(aCPart);
|
aEE.SetCommonPart(aCPart);
|
||||||
// 2
|
// 2
|
||||||
myDS->AddInterf(nWhat, nWith);
|
myDS->AddInterf(nE1, nE2);
|
||||||
//
|
//
|
||||||
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
|
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
|
||||||
}//case TopAbs_EDGE
|
}//case TopAbs_EDGE
|
||||||
|
@ -1399,12 +1399,12 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
|
|||||||
aType1=aGAS1.GetType();
|
aType1=aGAS1.GetType();
|
||||||
aType2=aGAS2.GetType();
|
aType2=aGAS2.GetType();
|
||||||
//
|
//
|
||||||
if (aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
//if (aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||||
GeomAbs_CurveType aTypeC;
|
GeomAbs_CurveType aTypeC;
|
||||||
//
|
//
|
||||||
const IntTools_Curve& aIC=aNC.Curve();
|
const IntTools_Curve& aIC=aNC.Curve();
|
||||||
aTypeC=aIC.Type();
|
aTypeC=aIC.Type();
|
||||||
if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||||
Handle(Geom2d_Curve) aC2D[2];
|
Handle(Geom2d_Curve) aC2D[2];
|
||||||
//
|
//
|
||||||
aC2D[0]=aIC.FirstCurve2d();
|
aC2D[0]=aIC.FirstCurve2d();
|
||||||
@ -1457,8 +1457,8 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
|
|||||||
}
|
}
|
||||||
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
||||||
}
|
}
|
||||||
}//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
//}//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||||
}//if(aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
//}//if(aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -157,6 +157,7 @@ static Standard_Boolean PlaneOfWire (const TopoDS_Wire& W, gp_Pln& P)
|
|||||||
}
|
}
|
||||||
TopoDS_Edge Edge = TopoDS::Edge(anExp.Current());
|
TopoDS_Edge Edge = TopoDS::Edge(anExp.Current());
|
||||||
Standard_Real first, last;
|
Standard_Real first, last;
|
||||||
|
TopLoc_Location loc;
|
||||||
Handle(Geom_Curve) curv = BRep_Tool::Curve(Edge, first, last);
|
Handle(Geom_Curve) curv = BRep_Tool::Curve(Edge, first, last);
|
||||||
if (wClosed) {
|
if (wClosed) {
|
||||||
GeomAdaptor_Curve AdC;
|
GeomAdaptor_Curve AdC;
|
||||||
|
@ -1700,7 +1700,7 @@ const
|
|||||||
|
|
||||||
for (TopoDS_Iterator IteW(IteF.Value()); IteW.More(); IteW.Next()) {
|
for (TopoDS_Iterator IteW(IteF.Value()); IteW.More(); IteW.Next()) {
|
||||||
|
|
||||||
TopoDS_Edge E = TopoDS::Edge(IteW.Value());
|
const TopoDS_Edge& E = TopoDS::Edge(IteW.Value());
|
||||||
EdgeVertices(E,V1,V2);
|
EdgeVertices(E,V1,V2);
|
||||||
MapSpine.Bind(V1,V1);
|
MapSpine.Bind(V1,V1);
|
||||||
MapSpine.Bind(V2,V2);
|
MapSpine.Bind(V2,V2);
|
||||||
|
@ -106,6 +106,19 @@ is
|
|||||||
|
|
||||||
---Level: Public
|
---Level: Public
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- Methods to set parameters for approximation
|
||||||
|
-- ============================================
|
||||||
|
SetMaxDegree(me : mutable;
|
||||||
|
NewMaxDegree : Integer from Standard);
|
||||||
|
---Purpose: Define the maximum V degree of resulting surface
|
||||||
|
|
||||||
|
SetMaxSegments(me : mutable;
|
||||||
|
NewMaxSegments : Integer from Standard);
|
||||||
|
---Purpose: Define the maximum number of spans in V-direction
|
||||||
|
-- on resulting surface
|
||||||
|
|
||||||
SetForceApproxC1(me : mutable;
|
SetForceApproxC1(me : mutable;
|
||||||
ForceApproxC1 : Boolean from Standard);
|
ForceApproxC1 : Boolean from Standard);
|
||||||
---Purpose: Set the flag that indicates attempt to approximate
|
---Purpose: Set the flag that indicates attempt to approximate
|
||||||
@ -280,6 +293,8 @@ fields
|
|||||||
myBoundTol : Real;
|
myBoundTol : Real;
|
||||||
myTolAngular : Real;
|
myTolAngular : Real;
|
||||||
angmin, angmax : Real;
|
angmin, angmax : Real;
|
||||||
|
myMaxDegree : Integer;
|
||||||
|
myMaxSegments : Integer;
|
||||||
myForceApproxC1 : Boolean;
|
myForceApproxC1 : Boolean;
|
||||||
|
|
||||||
myLaw : Function from Law;
|
myLaw : Function from Law;
|
||||||
|
@ -226,6 +226,9 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
|||||||
myLaw.Nullify();
|
myLaw.Nullify();
|
||||||
SetTolerance();
|
SetTolerance();
|
||||||
|
|
||||||
|
myMaxDegree = 11;
|
||||||
|
myMaxSegments = 30;
|
||||||
|
|
||||||
// Attention to closed non-declared wire !
|
// Attention to closed non-declared wire !
|
||||||
if (!mySpine.Closed()) {
|
if (!mySpine.Closed()) {
|
||||||
TopoDS_Vertex Vf, Vl;
|
TopoDS_Vertex Vf, Vl;
|
||||||
@ -414,6 +417,25 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
|||||||
mySection.Nullify(); //It is required to relocalize the sections.
|
mySection.Nullify(); //It is required to relocalize the sections.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetMaxDegree
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BRepFill_PipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
|
||||||
|
{
|
||||||
|
myMaxDegree = NewMaxDegree;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetMaxSegments
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BRepFill_PipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
|
||||||
|
{
|
||||||
|
myMaxSegments = NewMaxSegments;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetForceApproxC1
|
//function : SetForceApproxC1
|
||||||
//purpose : Set the flag that indicates attempt to approximate
|
//purpose : Set the flag that indicates attempt to approximate
|
||||||
@ -742,7 +764,8 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
|
|||||||
theContinuity = GeomAbs_C0;
|
theContinuity = GeomAbs_C0;
|
||||||
TopTools_MapOfShape Dummy;
|
TopTools_MapOfShape Dummy;
|
||||||
BRepFill_DataMapOfShapeHArray2OfShape Dummy2;
|
BRepFill_DataMapOfShapeHArray2OfShape Dummy2;
|
||||||
MkSw.Build(Dummy, Dummy2, myTransition, theContinuity);
|
MkSw.Build(Dummy, Dummy2, myTransition, theContinuity,
|
||||||
|
GeomFill_Location, myMaxDegree, myMaxSegments);
|
||||||
|
|
||||||
myStatus = myLocation->GetStatus();
|
myStatus = myLocation->GetStatus();
|
||||||
Ok = (MkSw.IsDone() && (myStatus == GeomFill_PipeOk));
|
Ok = (MkSw.IsDone() && (myStatus == GeomFill_PipeOk));
|
||||||
|
@ -212,12 +212,28 @@ is
|
|||||||
-- - boundary tolerance BoundTol
|
-- - boundary tolerance BoundTol
|
||||||
-- - angular tolerance TolAngular.
|
-- - angular tolerance TolAngular.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- Methods to set parameters for approximation
|
||||||
|
-- ============================================
|
||||||
|
SetMaxDegree(me : in out;
|
||||||
|
NewMaxDegree : Integer from Standard);
|
||||||
|
---Purpose: Define the maximum V degree of resulting surface
|
||||||
|
|
||||||
|
SetMaxSegments(me : in out;
|
||||||
|
NewMaxSegments : Integer from Standard);
|
||||||
|
---Purpose: Define the maximum number of spans in V-direction
|
||||||
|
-- on resulting surface
|
||||||
|
|
||||||
SetForceApproxC1(me : in out;
|
SetForceApproxC1(me : in out;
|
||||||
ForceApproxC1 : Boolean from Standard);
|
ForceApproxC1 : Boolean from Standard);
|
||||||
---Purpose: Set the flag that indicates attempt to approximate
|
---Purpose: Set the flag that indicates attempt to approximate
|
||||||
-- a C1-continuous surface if a swept surface proved
|
-- a C1-continuous surface if a swept surface proved
|
||||||
-- to be C0.
|
-- to be C0.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SetTransitionMode(me : in out;
|
SetTransitionMode(me : in out;
|
||||||
Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed)
|
Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed)
|
||||||
---Purpose: Sets the transition mode to manage discontinuities on
|
---Purpose: Sets the transition mode to manage discontinuities on
|
||||||
|
@ -200,6 +200,24 @@ void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
|
|||||||
myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
|
myPipe->SetTolerance(Tol3d, BoundTol, TolAngular);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetMaxDegree
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BRepOffsetAPI_MakePipeShell::SetMaxDegree(const Standard_Integer NewMaxDegree)
|
||||||
|
{
|
||||||
|
myPipe->SetMaxDegree(NewMaxDegree);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetMaxSegments
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSegments)
|
||||||
|
{
|
||||||
|
myPipe->SetMaxSegments(NewMaxSegments);
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetForceApproxC1
|
//function : SetForceApproxC1
|
||||||
//purpose : Set the flag that indicates attempt to approximate
|
//purpose : Set the flag that indicates attempt to approximate
|
||||||
|
@ -1 +0,0 @@
|
|||||||
IntTools_EdgeEdge_1.cxx
|
|
@ -87,10 +87,6 @@ is
|
|||||||
---Purpose: class provides computing ranges of parameters
|
---Purpose: class provides computing ranges of parameters
|
||||||
--- of edge/face intersection.
|
--- of edge/face intersection.
|
||||||
|
|
||||||
class BeanBeanIntersector;
|
|
||||||
---Purpose: class provides computing ranges of parameters
|
|
||||||
--- of edge/edge intersection.
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
class Curve;
|
class Curve;
|
||||||
---Purpose: class is a container of
|
---Purpose: class is a container of
|
||||||
|
@ -1,176 +0,0 @@
|
|||||||
-- Created on: 2001-07-06
|
|
||||||
-- Created by: Michael KLOKOV
|
|
||||||
-- Copyright (c) 2001-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and / or modify it
|
|
||||||
-- under the terms of the GNU Lesser General Public version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class BeanBeanIntersector from IntTools
|
|
||||||
|
|
||||||
---Purpose: The class BeanBeanIntersector computes ranges of parameters on
|
|
||||||
--- the curve of a first bean (part of edge) that bounds the parts of bean which
|
|
||||||
--- are on the other bean according to tolerance of edges.
|
|
||||||
|
|
||||||
uses
|
|
||||||
SequenceOfRoots from IntTools,
|
|
||||||
MarkedRangeSet from IntTools,
|
|
||||||
SequenceOfRanges from IntTools,
|
|
||||||
Range from IntTools,
|
|
||||||
ExtCC from Extrema,
|
|
||||||
ProjectPointOnCurve from GeomAPI,
|
|
||||||
Edge from TopoDS,
|
|
||||||
Curve from BRepAdaptor,
|
|
||||||
Curve from Geom
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
Create returns BeanBeanIntersector from IntTools;
|
|
||||||
|
|
||||||
Create(theEdge1: Edge from TopoDS;
|
|
||||||
theEdge2: Edge from TopoDS)
|
|
||||||
returns BeanBeanIntersector from IntTools;
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
Create(theCurve1 : Curve from BRepAdaptor;
|
|
||||||
theCurve2 : Curve from BRepAdaptor;
|
|
||||||
theBeanTolerance1: Real from Standard;
|
|
||||||
theBeanTolerance2: Real from Standard)
|
|
||||||
returns BeanBeanIntersector from IntTools;
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
Create(theCurve1 : Curve from BRepAdaptor;
|
|
||||||
theCurve2 : Curve from BRepAdaptor;
|
|
||||||
theFirstParOnCurve1: Real from Standard;
|
|
||||||
theLastParOnCurve1 : Real from Standard;
|
|
||||||
theFirstParOnCurve2: Real from Standard;
|
|
||||||
theLastParOnCurve2 : Real from Standard;
|
|
||||||
theBeanTolerance1 : Real from Standard;
|
|
||||||
theBeanTolerance2 : Real from Standard)
|
|
||||||
returns BeanBeanIntersector from IntTools;
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
Init(me: in out;theEdge1: Edge from TopoDS;
|
|
||||||
theEdge2: Edge from TopoDS);
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Init(me: in out;theCurve1 : Curve from BRepAdaptor;
|
|
||||||
theCurve2 : Curve from BRepAdaptor;
|
|
||||||
theBeanTolerance1: Real from Standard;
|
|
||||||
theBeanTolerance2: Real from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
Init(me: in out;theCurve1 : Curve from BRepAdaptor;
|
|
||||||
theCurve2 : Curve from BRepAdaptor;
|
|
||||||
theFirstParOnCurve1: Real from Standard;
|
|
||||||
theLastParOnCurve1 : Real from Standard;
|
|
||||||
theFirstParOnCurve2: Real from Standard;
|
|
||||||
theLastParOnCurve2 : Real from Standard;
|
|
||||||
theBeanTolerance1 : Real from Standard;
|
|
||||||
theBeanTolerance2 : Real from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Initializes the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
SetBeanParameters(me: in out;IsFirstBean : Boolean from Standard;
|
|
||||||
theFirstParOnCurve: Real from Standard;
|
|
||||||
theLastParOnCurve : Real from Standard);
|
|
||||||
---Purpose:
|
|
||||||
--- Sets bounding parameters for first bean if IsFirstBean is true
|
|
||||||
--- and for second bean if IsFirstBean is false
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
Perform(me: in out);
|
|
||||||
---Purpose:
|
|
||||||
--- Launches the algorithm
|
|
||||||
---
|
|
||||||
|
|
||||||
IsDone(me) returns Boolean from Standard;
|
|
||||||
---C++: inline
|
|
||||||
---Purpose:
|
|
||||||
--- Returns true if the computations was successfull
|
|
||||||
--- otherwise returns false
|
|
||||||
|
|
||||||
Result(me)
|
|
||||||
returns SequenceOfRanges from IntTools;
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
Result(me; theResults: out SequenceOfRanges from IntTools);
|
|
||||||
|
|
||||||
|
|
||||||
-- private
|
|
||||||
|
|
||||||
ComputeRoughIntersection(me: in out)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
FastComputeIntersection(me: in out)
|
|
||||||
returns Boolean from Standard is private;
|
|
||||||
|
|
||||||
ComputeUsingExtrema(me: in out; theRange2: Range from IntTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
ComputeNearRangeBoundaries(me: in out; theRange2: Range from IntTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
|
|
||||||
theParameter : Real from Standard;
|
|
||||||
theIndex : Integer from Standard;
|
|
||||||
theParameter2 : Real from Standard;
|
|
||||||
theRange2 : Range from IntTools)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
Distance(me: in out; theArg : Real from Standard;
|
|
||||||
theArgOnOtherBean: out Real from Standard)
|
|
||||||
returns Real from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
-- sources
|
|
||||||
myCurve1 : Curve from BRepAdaptor;
|
|
||||||
myCurve2 : Curve from BRepAdaptor;
|
|
||||||
myTrsfCurve1 : Curve from Geom;
|
|
||||||
myTrsfCurve2 : Curve from Geom;
|
|
||||||
|
|
||||||
myFirstParameter1 : Real from Standard;
|
|
||||||
myLastParameter1 : Real from Standard;
|
|
||||||
myFirstParameter2 : Real from Standard;
|
|
||||||
myLastParameter2 : Real from Standard;
|
|
||||||
|
|
||||||
myBeanTolerance1 : Real from Standard;
|
|
||||||
myBeanTolerance2 : Real from Standard;
|
|
||||||
|
|
||||||
myCurveResolution1: Real from Standard;
|
|
||||||
myCriteria : Real from Standard;
|
|
||||||
|
|
||||||
-- tools
|
|
||||||
myProjector : ProjectPointOnCurve from GeomAPI;
|
|
||||||
myRangeManager : MarkedRangeSet from IntTools;
|
|
||||||
myDeflection : Real from Standard;
|
|
||||||
|
|
||||||
-- results
|
|
||||||
myResults : SequenceOfRanges from IntTools;
|
|
||||||
|
|
||||||
myIsDone : Boolean from Standard;
|
|
||||||
|
|
||||||
end BeanBeanIntersector from IntTools;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and / or modify it
|
|
||||||
// under the terms of the GNU Lesser General Public version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
inline Standard_Boolean IntTools_BeanBeanIntersector::IsDone() const
|
|
||||||
{
|
|
||||||
return myIsDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
-- Created on: 2000-10-26
|
-- Created by: Eugeny MALTCHIKOV
|
||||||
-- Created by: Peter KURNEV
|
-- Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
-- Copyright (c) 2000-2014 OPEN CASCADE SAS
|
|
||||||
--
|
--
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
-- This file is part of Open CASCADE Technology software library.
|
||||||
--
|
--
|
||||||
@ -14,298 +13,221 @@
|
|||||||
-- commercial license or contractual agreement.
|
-- commercial license or contractual agreement.
|
||||||
|
|
||||||
class EdgeEdge from IntTools
|
class EdgeEdge from IntTools
|
||||||
|
---Purpose:
|
||||||
|
-- The class provides Edge/Edge intersection algorithm
|
||||||
|
-- based on the intersection between edges bounding boxes.
|
||||||
|
|
||||||
---Purpose: The class provides Edge/Edge algorithm to determine
|
|
||||||
-- common parts between two edges in 3-d space.
|
|
||||||
-- Common parts can be : Vertices or Edges.
|
|
||||||
---
|
|
||||||
uses
|
uses
|
||||||
|
Real from Standard,
|
||||||
|
Box from Bnd,
|
||||||
|
Range from IntTools,
|
||||||
Edge from TopoDS,
|
Edge from TopoDS,
|
||||||
|
Curve from Geom,
|
||||||
Curve from BRepAdaptor,
|
Curve from BRepAdaptor,
|
||||||
SequenceOfRoots from IntTools,
|
ShapeEnum from TopAbs,
|
||||||
SequenceOfRanges from IntTools,
|
SequenceOfRanges from IntTools,
|
||||||
CArray1OfReal from IntTools,
|
SequenceOfCommonPrts from IntTools
|
||||||
CommonPrt from IntTools,
|
|
||||||
SequenceOfCommonPrts from IntTools,
|
|
||||||
Range from IntTools
|
|
||||||
--raises
|
|
||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
Create
|
Create
|
||||||
returns EdgeEdge from IntTools;
|
returns EdgeEdge from IntTools;
|
||||||
|
---C++: alias "~IntTools_EdgeEdge();"
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Empty constructor
|
-- Empty contructor
|
||||||
---
|
|
||||||
|
|
||||||
SetEdge1 (me:out;
|
Create (
|
||||||
anEdge:Edge from TopoDS);
|
theEdge1 : Edge from TopoDS;
|
||||||
|
theEdge2 : Edge from TopoDS)
|
||||||
|
returns EdgeEdge from IntTools;
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the first edge
|
-- Contructor
|
||||||
---
|
|
||||||
|
|
||||||
SetTolerance1 (me:out;
|
Create (
|
||||||
aTolEdge1:Real from Standard);
|
theEdge1 : Edge from TopoDS;
|
||||||
|
aT11, aT12 : Real from Standard;
|
||||||
|
theEdge2 : Edge from TopoDS;
|
||||||
|
aT21, aT22 : Real from Standard)
|
||||||
|
returns EdgeEdge from IntTools;
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the value of tolerance pipe for the first edge
|
-- Contructor
|
||||||
---
|
|
||||||
|
|
||||||
SetEdge2 (me:out;
|
SetEdge1(me:out;
|
||||||
anEdge:Edge from TopoDS);
|
theEdge : Edge from TopoDS);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the second edge
|
-- Sets the first edge
|
||||||
---
|
|
||||||
|
|
||||||
SetTolerance2 (me:out;
|
SetEdge1(me:out;
|
||||||
aTolEdge2:Real from Standard);
|
theEdge : Edge from TopoDS;
|
||||||
|
aT1, aT2 : Real from Standard);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the value of tolerance pipe for the first edge
|
-- Sets the first edge and its range
|
||||||
---
|
|
||||||
|
|
||||||
SetDiscretize (me:out;
|
SetRange1(me:out;
|
||||||
aDiscret:Integer from Standard);
|
theRange1 : Range from IntTools);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the number of division for the shortest
|
-- Sets the range for the first edge
|
||||||
--- edge among the two. The deflection is not taken
|
|
||||||
--- into account
|
|
||||||
---
|
|
||||||
|
|
||||||
SetDeflection (me:out;
|
SetRange1(me:out;
|
||||||
aDeflection:Real from Standard);
|
aT1, aT2 : Real from Standard);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the value of maximum reative deflection between
|
-- Sets the range for the first edge
|
||||||
--- the two nearest points on a curve.
|
|
||||||
---
|
|
||||||
|
|
||||||
SetEpsilonT (me:out;
|
SetEdge2(me:out;
|
||||||
anEpsT:Real from Standard);
|
theEdge : Edge from TopoDS);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the criteria of equality of two arguments,
|
-- Sets the second edge
|
||||||
--- i.e. |t2-t1|<anEpsT will mean that t2=t1
|
|
||||||
---
|
|
||||||
|
|
||||||
SetEpsilonNull (me:out;
|
SetEdge2(me:out;
|
||||||
anEpsNull:Real from Standard);
|
theEdge : Edge from TopoDS;
|
||||||
|
aT1, aT2 : Real from Standard);
|
||||||
|
---C++: inline
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- Sets the criteria of equality of two functions' values
|
-- Sets the first edge and its range
|
||||||
--- i.e. |f(t2)-f(t1)|<anEpsNull will mean that f(t2)=f(t1)
|
|
||||||
---
|
|
||||||
|
|
||||||
SetRange1 (me:out;
|
SetRange2(me:out;
|
||||||
aRange:Range from IntTools);
|
theRange : Range from IntTools);
|
||||||
|
---C++: inline
|
||||||
|
---Purpose:
|
||||||
|
-- Sets the range for the second edge
|
||||||
|
|
||||||
SetRange2 (me:out;
|
SetRange2(me:out;
|
||||||
aRange:Range from IntTools);
|
aT1, aT2 : Real from Standard);
|
||||||
|
---C++: inline
|
||||||
|
---Purpose:
|
||||||
|
-- Sets the range for the second edge
|
||||||
|
|
||||||
SetRange1 (me:out;
|
CheckData(me:out)
|
||||||
aFirst, aLast:Real from Standard);
|
is protected;
|
||||||
|
---C++: inline
|
||||||
|
---Purpose:
|
||||||
|
-- Checks the data
|
||||||
|
|
||||||
SetRange2 (me:out;
|
Prepare(me:out)
|
||||||
aFirst, aLast:Real from Standard);
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Prepares the data
|
||||||
|
|
||||||
Perform(me:out);
|
Perform(me:out);
|
||||||
---Purpose:
|
---Purpose:
|
||||||
--- The main method of the algorithm to determine
|
-- Performs the intersection between edges
|
||||||
--- common parts between two edges in 3-d space
|
|
||||||
---
|
|
||||||
|
|
||||||
IsDone (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- True if the common parts are found
|
|
||||||
---
|
|
||||||
|
|
||||||
Order (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose:
|
|
||||||
--- False if the common parts are coherented with Edge1, Edge2
|
|
||||||
---
|
|
||||||
|
|
||||||
ErrorStatus(me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose: Returns the number that corresponds to the error.
|
|
||||||
--- The list of error-codes is in ...cxx file
|
|
||||||
---
|
|
||||||
|
|
||||||
CommonParts(me)
|
|
||||||
returns SequenceOfCommonPrts from IntTools;
|
|
||||||
---C++: return const&
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the common parts (Output)
|
|
||||||
---
|
|
||||||
|
|
||||||
Range1 (me)
|
|
||||||
returns Range from IntTools;
|
|
||||||
---C++: return const&
|
|
||||||
|
|
||||||
Range2 (me)
|
|
||||||
returns Range from IntTools;
|
|
||||||
---C++: return const&
|
|
||||||
|
|
||||||
-----------------------------------------------------
|
|
||||||
-- Block of protected methods of the algorithm --
|
|
||||||
-----------------------------------------------------
|
|
||||||
|
|
||||||
CheckData (me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Fool-proof chechking the input data.
|
|
||||||
--- The following data is not available
|
|
||||||
--- * Degenerated edges is not available;
|
|
||||||
--- * Egdes, that don't contain 3d-curve.
|
|
||||||
---
|
|
||||||
|
|
||||||
Prepare (me:out)
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Preparing the main fields for the algorithm
|
|
||||||
--- * From-Curve (myCFrom,myTminFrom,myTmaxFrom),
|
|
||||||
--- * To -Curve (myCTo ,myTminTo ,myTmaxTo ),
|
|
||||||
--- * myCreiteria=myTol1+myTol2 ,
|
|
||||||
--- * myProjectableRanges.
|
|
||||||
---
|
|
||||||
|
|
||||||
IsProjectable (me;
|
|
||||||
t:Real from Standard)
|
|
||||||
returns Integer from Standard
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Returns the flag 1 if it is possible to project
|
|
||||||
--- the point from the From-Curve at the parameter t
|
|
||||||
--- to the To-Curve.
|
|
||||||
--- Othrwise it returns 0.
|
|
||||||
---
|
|
||||||
FindRangeOnCurve2 (me:out;
|
|
||||||
aCP:out CommonPrt from IntTools)
|
|
||||||
returns Integer from Standard
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Find the range on the curve Curve-To that corresponds
|
|
||||||
--- to the given range on the curve Curve-From.
|
|
||||||
---
|
|
||||||
|
|
||||||
GetParameterOnCurve2 (me;
|
|
||||||
aT1:Real from Standard;
|
|
||||||
aT2:out Real from Standard)
|
|
||||||
returns Integer from Standard
|
|
||||||
is protected ;
|
|
||||||
---Purpose:
|
|
||||||
--- Find the value of the parameter on the curve Curve-To
|
|
||||||
--- that corresponds to the given parameter on the curve
|
|
||||||
--- Curve-From.
|
|
||||||
---
|
|
||||||
|
|
||||||
TreatVertexType(me:out;
|
|
||||||
am1, am2:Real from Standard;
|
|
||||||
aCP:out CommonPrt from IntTools)
|
|
||||||
returns Integer from Standard
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
IsIntersection (me:out;
|
|
||||||
t1 : Real from Standard;
|
|
||||||
t2 : Real from Standard)
|
|
||||||
is protected ;
|
|
||||||
|
|
||||||
|
|
||||||
FindDerivativeRoot (me:out;
|
|
||||||
t,f:CArray1OfReal from IntTools)
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
FindSimpleRoot (me:out;
|
|
||||||
IP:Integer from Standard;
|
|
||||||
ta, tb, fA:Real from Standard)
|
|
||||||
returns Real from Standard
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Find the Root of the function on given interval
|
|
||||||
--- of the argument [ta,tb] using bisection method .
|
|
||||||
--- IP - a flag;
|
|
||||||
--- =1 - use DistanceFunction;
|
|
||||||
--- =2 - use DerivativeFunction;
|
|
||||||
---
|
|
||||||
|
|
||||||
DistanceFunction (me:out;
|
|
||||||
t:Real from Standard)
|
|
||||||
returns Real from Standard
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Calculates the DistanceFunction D(t).
|
|
||||||
--- D(t)=D1(t) - myCriteria;
|
|
||||||
--- where
|
|
||||||
--- D1(t) - the lower distance between a point from
|
|
||||||
--- the From-Curve at parameter t and
|
|
||||||
--- projection point of this point on To-Curve;
|
|
||||||
--- myCriteria=myTol1+myTol2.
|
|
||||||
---
|
|
||||||
|
|
||||||
DerivativeFunction (me:out;
|
|
||||||
t:Real from Standard)
|
|
||||||
returns Real from Standard
|
|
||||||
is protected;
|
|
||||||
---Purpose:
|
|
||||||
--- Calculates the first derivative of
|
|
||||||
--- the DistanceFunction D(t).
|
|
||||||
---
|
|
||||||
|
|
||||||
CheckTouch(me: out;
|
|
||||||
aCP: CommonPrt from IntTools;
|
|
||||||
t1 : out Real from Standard;
|
|
||||||
t2 : out Real from Standard)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
CheckTouchVertex(me;
|
|
||||||
aCP: CommonPrt from IntTools;
|
|
||||||
t1 : out Real from Standard;
|
|
||||||
t2 : out Real from Standard)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is protected;
|
|
||||||
|
|
||||||
|
|
||||||
ComputeLineLine(me:out)
|
ComputeLineLine(me:out)
|
||||||
is protected;
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Computes Line/Line intersection.
|
||||||
|
|
||||||
--modified by NIZNHY-PKV Mon Oct 31 12:16:55 2011f
|
FindRoughRanges(me:out;
|
||||||
IsSameCurves(me:out)
|
theR1, theR2 : Range from IntTools;
|
||||||
|
theSegments1 : out SequenceOfRanges from IntTools)
|
||||||
|
returns Integer from Standard
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Looking for the rough intersection ranges
|
||||||
|
|
||||||
|
FindSolutions(me:out;
|
||||||
|
theR1, theR2 : Range from IntTools;
|
||||||
|
theRanges1 : out SequenceOfRanges from IntTools;
|
||||||
|
theRanges2 : out SequenceOfRanges from IntTools)
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Looking fot the exact intersection ranges
|
||||||
|
|
||||||
|
MergeSolutions(me:out;
|
||||||
|
theRanges1, theRanges2 : SequenceOfRanges from IntTools)
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Merges found solutions
|
||||||
|
|
||||||
|
FindParameters(myclass;
|
||||||
|
theBAC : Curve from BRepAdaptor;
|
||||||
|
aT1,aT2 : Real from Standard;
|
||||||
|
theRes : Real from Standard;
|
||||||
|
theCBox : Box from Bnd;
|
||||||
|
aTB1,aTB2 : out Real from Standard)
|
||||||
returns Boolean from Standard
|
returns Boolean from Standard
|
||||||
is protected;
|
is protected;
|
||||||
--modified by NIZNHY-PKV Mon Oct 31 12:16:59 2011t
|
---Purpose:
|
||||||
|
-- Looking for the range of the edge whick is in the box
|
||||||
|
|
||||||
|
CheckCoincidence(me:out;
|
||||||
|
aT11, aT12 : Real from Standard;
|
||||||
|
aT21, aT22 : Real from Standard;
|
||||||
|
theCriteria : Real from Standard;
|
||||||
|
theCurveRes1: Real from Standard)
|
||||||
|
returns Integer from Standard
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Checks if edges coincide on the ranges
|
||||||
|
|
||||||
|
AddSolution(me:out;
|
||||||
|
aT11, aT12, aT21, aT22 : Real from Standard;
|
||||||
|
theType : ShapeEnum from TopAbs)
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Adds common part of the given type to myCommonParts
|
||||||
|
|
||||||
|
FindBestSolution(me:out;
|
||||||
|
aT11, aT12, aT21, aT22 : Real from Standard;
|
||||||
|
aT1, aT2 : out Real from Standard)
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Looking for the minimal distance between edges on the ranges
|
||||||
|
|
||||||
|
IsIntersection(me:out;
|
||||||
|
aT11, aT12 : Real from Standard;
|
||||||
|
aT21, aT22 : Real from Standard)
|
||||||
|
returns Boolean from Standard
|
||||||
|
is protected;
|
||||||
|
---Purpose:
|
||||||
|
-- Checks is there an intersection between edges on the given ranges
|
||||||
|
-- (for nearly conicident edges)
|
||||||
|
|
||||||
|
IsDone(me)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---C++: inline
|
||||||
|
---Purpose:
|
||||||
|
-- Returns TRUE if common part(s) is(are) found
|
||||||
|
|
||||||
|
CommonParts(me)
|
||||||
|
returns SequenceOfCommonPrts from IntTools;
|
||||||
|
---C++: inline
|
||||||
|
---C++: return const&
|
||||||
|
---Purpose:
|
||||||
|
-- Returns common parts
|
||||||
|
|
||||||
fields
|
fields
|
||||||
-- Data
|
-- source data
|
||||||
myEdge1 : Edge from TopoDS;
|
myEdge1 : Edge from TopoDS is protected;
|
||||||
myEdge2 : Edge from TopoDS;
|
myEdge2 : Edge from TopoDS is protected;
|
||||||
myTol1 : Real from Standard;
|
|
||||||
myTol2 : Real from Standard;
|
|
||||||
|
|
||||||
myDiscret : Integer from Standard;
|
myGeom1 : Curve from Geom is protected;
|
||||||
|
myGeom2 : Curve from Geom is protected;
|
||||||
|
|
||||||
myEpsT : Real from Standard;
|
myCurve1 : Curve from BRepAdaptor is protected;
|
||||||
myEpsNull : Real from Standard;
|
myCurve2 : Curve from BRepAdaptor is protected;
|
||||||
myDeflection : Real from Standard;
|
|
||||||
|
|
||||||
-- data curves
|
myTol1 : Real from Standard is protected;
|
||||||
myCFrom : Curve from BRepAdaptor;
|
myTol2 : Real from Standard is protected;
|
||||||
myTminFrom : Real from Standard;
|
myTol : Real from Standard is protected;
|
||||||
myTmaxFrom : Real from Standard;
|
|
||||||
myTolFrom : Real from Standard;
|
|
||||||
|
|
||||||
myCTo : Curve from BRepAdaptor;
|
myRes1 : Real from Standard is protected;
|
||||||
myTminTo : Real from Standard;
|
myRes2 : Real from Standard is protected;
|
||||||
myTmaxTo : Real from Standard;
|
|
||||||
myTolTo : Real from Standard;
|
|
||||||
|
|
||||||
myCriteria : Real from Standard;
|
myRange1 : Range from IntTools is protected;
|
||||||
|
myRange2 : Range from IntTools is protected;
|
||||||
|
|
||||||
myIsDone : Boolean from Standard;
|
-- results
|
||||||
myErrorStatus : Integer from Standard;
|
mySwap : Boolean from Standard is protected;
|
||||||
|
myErrorStatus : Integer from Standard is protected;
|
||||||
--- internal members
|
myCommonParts : SequenceOfCommonPrts from IntTools is protected;
|
||||||
mySeqOfCommonPrts : SequenceOfCommonPrts from IntTools;
|
|
||||||
myOrder : Boolean from Standard; -- 0-strait; 1-reversed
|
|
||||||
myPar1 : Real from Standard;
|
|
||||||
myParallel : Boolean from Standard;
|
|
||||||
myRange1 : Range from IntTools;
|
|
||||||
myRange2 : Range from IntTools;
|
|
||||||
|
|
||||||
end EdgeEdge;
|
end EdgeEdge;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
197
src/IntTools/IntTools_EdgeEdge.lxx
Normal file
197
src/IntTools/IntTools_EdgeEdge.lxx
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
// Created by: Eugeny MALTCHIKOV
|
||||||
|
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and / or modify it
|
||||||
|
// under the terms of the GNU Lesser General Public version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <Precision.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IntTools_EdgeEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline IntTools_EdgeEdge::IntTools_EdgeEdge()
|
||||||
|
:
|
||||||
|
myTol1(0.),
|
||||||
|
myTol2(0.),
|
||||||
|
myTol(0.),
|
||||||
|
myRes1(0.),
|
||||||
|
myRes2(0.),
|
||||||
|
myRange1(0., 0.),
|
||||||
|
myRange2(0., 0.),
|
||||||
|
mySwap(Standard_False),
|
||||||
|
myErrorStatus(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IntTools_EdgeEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
|
||||||
|
const TopoDS_Edge& theEdge2)
|
||||||
|
:
|
||||||
|
myEdge1(theEdge1),
|
||||||
|
myEdge2(theEdge2),
|
||||||
|
myTol1(0.),
|
||||||
|
myTol2(0.),
|
||||||
|
myTol(0.),
|
||||||
|
myRes1(0.),
|
||||||
|
myRes2(0.),
|
||||||
|
myRange1(0., 0.),
|
||||||
|
myRange2(0., 0.),
|
||||||
|
mySwap(Standard_False),
|
||||||
|
myErrorStatus(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IntTools_EdgeEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
|
||||||
|
const Standard_Real aT11,
|
||||||
|
const Standard_Real aT12,
|
||||||
|
const TopoDS_Edge& theEdge2,
|
||||||
|
const Standard_Real aT21,
|
||||||
|
const Standard_Real aT22)
|
||||||
|
:
|
||||||
|
myEdge1(theEdge1),
|
||||||
|
myEdge2(theEdge2),
|
||||||
|
myTol1(0.),
|
||||||
|
myTol2(0.),
|
||||||
|
myTol(0.),
|
||||||
|
myRes1(0.),
|
||||||
|
myRes2(0.),
|
||||||
|
myRange1(aT11, aT12),
|
||||||
|
myRange2(aT21, aT22),
|
||||||
|
mySwap(Standard_False),
|
||||||
|
myErrorStatus(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IntTools_EdgeEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline IntTools_EdgeEdge::~IntTools_EdgeEdge()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetEdge1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge& theEdge)
|
||||||
|
{
|
||||||
|
myEdge1 = theEdge;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetRange1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetRange1(const IntTools_Range& theRange)
|
||||||
|
{
|
||||||
|
myRange1 = theRange;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetRange1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetRange1(const Standard_Real aT1,
|
||||||
|
const Standard_Real aT2)
|
||||||
|
{
|
||||||
|
myRange1.SetFirst(aT1);
|
||||||
|
myRange1.SetLast(aT2);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetEdge1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge& theEdge,
|
||||||
|
const Standard_Real aT1,
|
||||||
|
const Standard_Real aT2)
|
||||||
|
{
|
||||||
|
SetEdge1(theEdge);
|
||||||
|
SetRange1(aT1, aT2);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetEdge2
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge)
|
||||||
|
{
|
||||||
|
myEdge2 = theEdge;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetRange1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetRange2(const IntTools_Range& theRange)
|
||||||
|
{
|
||||||
|
myRange2 = theRange;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetRange1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetRange2(const Standard_Real aT1,
|
||||||
|
const Standard_Real aT2)
|
||||||
|
{
|
||||||
|
myRange2.SetFirst(aT1);
|
||||||
|
myRange2.SetLast(aT2);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetEdge1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge,
|
||||||
|
const Standard_Real aT1,
|
||||||
|
const Standard_Real aT2)
|
||||||
|
{
|
||||||
|
SetEdge2(theEdge);
|
||||||
|
SetRange2(aT1, aT2);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : CommonParts
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline const IntTools_SequenceOfCommonPrts& IntTools_EdgeEdge::CommonParts() const
|
||||||
|
{
|
||||||
|
return myCommonParts;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsDone
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline Standard_Boolean IntTools_EdgeEdge::IsDone() const
|
||||||
|
{
|
||||||
|
return (myErrorStatus == 0);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckData
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
inline void IntTools_EdgeEdge::CheckData()
|
||||||
|
{
|
||||||
|
if (myEdge1.IsNull() || myEdge2.IsNull()) {
|
||||||
|
myErrorStatus = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (BRep_Tool::Degenerated(myEdge1) || BRep_Tool::Degenerated(myEdge2)) {
|
||||||
|
myErrorStatus = 2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!BRep_Tool::IsGeometric(myEdge1) || !BRep_Tool::IsGeometric(myEdge2)) {
|
||||||
|
myErrorStatus = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,916 +0,0 @@
|
|||||||
// Created on: 2012-11-29
|
|
||||||
// Created by: Peter KURNEV
|
|
||||||
// Copyright (c) 2012-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and / or modify it
|
|
||||||
// under the terms of the GNU Lesser General Public version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <IntTools_EdgeEdge.ixx>
|
|
||||||
|
|
||||||
#include <gp_Elips.hxx>
|
|
||||||
#include <gp_Ax1.hxx>
|
|
||||||
#include <gp_Dir.hxx>
|
|
||||||
#include <gp_XYZ.hxx>
|
|
||||||
#include <gp_Ax2.hxx>
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
//
|
|
||||||
#include <Geom_Curve.hxx>
|
|
||||||
#include <Geom_Line.hxx>
|
|
||||||
#include <Geom_Circle.hxx>
|
|
||||||
#include <Geom_Ellipse.hxx>
|
|
||||||
#include <Geom_Parabola.hxx>
|
|
||||||
#include <Geom_Hyperbola.hxx>
|
|
||||||
#include <Geom_BezierCurve.hxx>
|
|
||||||
#include <Geom_BSplineCurve.hxx>
|
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
|
||||||
#include <Geom_OffsetCurve.hxx>
|
|
||||||
//
|
|
||||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
|
||||||
//
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//class : IntTools_ComparatorCurve
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
class IntTools_ComparatorCurve {
|
|
||||||
public:
|
|
||||||
IntTools_ComparatorCurve() {
|
|
||||||
myT11=0.;
|
|
||||||
myT12=0.;
|
|
||||||
myT21=0.;
|
|
||||||
myT22=0.;
|
|
||||||
myIsSame=Standard_False;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
virtual ~IntTools_ComparatorCurve(){
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetCurve1(const BRepAdaptor_Curve& aBC3D) {
|
|
||||||
myBC1=aBC3D;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
const BRepAdaptor_Curve& Curve1()const {
|
|
||||||
return myBC1;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetRange1(const Standard_Real aT1,
|
|
||||||
const Standard_Real aT2) {
|
|
||||||
myT11=aT1;
|
|
||||||
myT12=aT2;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void Range1(Standard_Real& aT1, Standard_Real& aT2)const {
|
|
||||||
aT1=myT11;
|
|
||||||
aT2=myT12;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetCurve2(const BRepAdaptor_Curve& aBC3D){
|
|
||||||
myBC2=aBC3D;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
const BRepAdaptor_Curve& Curve2()const{
|
|
||||||
return myBC2;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetRange2(const Standard_Real aT1,
|
|
||||||
const Standard_Real aT2){
|
|
||||||
myT21=aT1;
|
|
||||||
myT22=aT2;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void Range2(Standard_Real& aT1,
|
|
||||||
Standard_Real& aT2)const {
|
|
||||||
aT1=myT21;
|
|
||||||
aT2=myT22;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
Standard_Boolean IsSame()const {
|
|
||||||
return myIsSame;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void Perform();
|
|
||||||
//
|
|
||||||
//--------------------------------------
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
void IsSameElipse();
|
|
||||||
//
|
|
||||||
void IsSameBSplineCurve();
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSameReal(const Standard_Real aR1,
|
|
||||||
const Standard_Real aR2);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSameAx2(const gp_Ax2& aAx21,
|
|
||||||
const gp_Ax2& aAx22);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSameAx1(const gp_Ax1& aAx1,
|
|
||||||
const gp_Ax1& aAx2);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSamePnt(const gp_Pnt& aP1,
|
|
||||||
const gp_Pnt& aP2);
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSameDir(const gp_Dir& aDir1,
|
|
||||||
const gp_Dir& aDir2);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsSameXYZ(const gp_XYZ& aXYZ1,
|
|
||||||
const gp_XYZ& aXYZ2);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
void GetCurveBase(const Handle(Geom_Curve)& aC3D,
|
|
||||||
GeomAbs_CurveType& aTypeBase,
|
|
||||||
Handle(Geom_Curve)& aCurveBase);
|
|
||||||
//
|
|
||||||
static
|
|
||||||
Standard_Boolean
|
|
||||||
IsTypeBase(const Handle(Geom_Curve)& aC,
|
|
||||||
GeomAbs_CurveType& aTypeB);
|
|
||||||
//
|
|
||||||
protected:
|
|
||||||
BRepAdaptor_Curve myBC1;
|
|
||||||
Standard_Real myT11;
|
|
||||||
Standard_Real myT12;
|
|
||||||
//
|
|
||||||
BRepAdaptor_Curve myBC2;
|
|
||||||
Standard_Real myT21;
|
|
||||||
Standard_Real myT22;
|
|
||||||
//
|
|
||||||
Standard_Boolean myIsSame;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_ComparatorCurve::Perform()
|
|
||||||
{
|
|
||||||
GeomAbs_CurveType aCurveType1, aCurveType2;
|
|
||||||
//
|
|
||||||
myIsSame=Standard_False;
|
|
||||||
//
|
|
||||||
aCurveType1=myBC1.GetType();
|
|
||||||
aCurveType2=myBC2.GetType();
|
|
||||||
//
|
|
||||||
myIsSame=(aCurveType1==aCurveType2);
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myIsSame=IsSameReal(myT11, myT21);
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myIsSame=IsSameReal(myT12, myT22);
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aCurveType1==GeomAbs_Ellipse) {
|
|
||||||
IsSameElipse();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (aCurveType1==GeomAbs_BSplineCurve) {
|
|
||||||
IsSameBSplineCurve();
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myIsSame=Standard_False;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameBSplineCurve
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_ComparatorCurve::IsSameBSplineCurve()
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsRational, bIsPreiodic;
|
|
||||||
Standard_Integer iNbPoles, iNbKnots, iDegree;
|
|
||||||
//
|
|
||||||
bIsRational=myBC1.IsRational();
|
|
||||||
myIsSame=(bIsRational==myBC2.IsRational());
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
iNbPoles=myBC1.NbPoles();
|
|
||||||
myIsSame=(iNbPoles==myBC2.NbPoles());
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
iNbKnots=myBC1.NbKnots();
|
|
||||||
myIsSame=(iNbKnots==myBC2.NbKnots());
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
iDegree=myBC1.Degree();
|
|
||||||
myIsSame=(iDegree==myBC2.Degree());
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
bIsPreiodic=myBC1.IsPeriodic();
|
|
||||||
myIsSame=(bIsPreiodic==myBC2.IsPeriodic());
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------
|
|
||||||
Standard_Integer i, j, aM[2];
|
|
||||||
Standard_Real aT1, aT2, aX0[4], aX1[4];
|
|
||||||
GeomAbs_CurveType aTypeBase;
|
|
||||||
gp_Pnt aP;
|
|
||||||
Handle(Geom_Curve) aC;
|
|
||||||
Handle(Geom_BSplineCurve) aBSp[2];
|
|
||||||
TopoDS_Edge aE1, aE2;
|
|
||||||
//
|
|
||||||
aE1=myBC1.Edge();
|
|
||||||
aE2=myBC2.Edge();
|
|
||||||
//
|
|
||||||
aC=BRep_Tool::Curve (aE1, aT1, aT2);
|
|
||||||
GetCurveBase(aC, aTypeBase, aBSp[0]);
|
|
||||||
//
|
|
||||||
aC=BRep_Tool::Curve (aE2, aT1, aT2);
|
|
||||||
GetCurveBase(aC, aTypeBase, aBSp[1]);
|
|
||||||
//
|
|
||||||
// Poles / Weights
|
|
||||||
for(i=1; i<=iNbPoles; ++i) {
|
|
||||||
aP=aBSp[0]->Pole(i);
|
|
||||||
aP.Coord(aX0[0], aX0[1], aX0[2]);
|
|
||||||
aX0[3]=aBSp[0]->Weight(i);
|
|
||||||
//
|
|
||||||
aP=aBSp[1]->Pole(i);
|
|
||||||
aP.Coord(aX1[0], aX1[1], aX1[2]);
|
|
||||||
aX1[3]=aBSp[1]->Weight(i);
|
|
||||||
//
|
|
||||||
for (j=0; j<4; ++j) {
|
|
||||||
myIsSame=IsSameReal(aX0[j], aX1[j]);
|
|
||||||
if(!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//for(i=1; i<iNbPoles; ++i) {
|
|
||||||
//
|
|
||||||
// Knots / Multiplicities
|
|
||||||
for(i=1; i<=iNbKnots; ++i) {
|
|
||||||
aX0[0]=aBSp[0]->Knot(i);
|
|
||||||
aX0[1]=aBSp[1]->Knot(i);
|
|
||||||
myIsSame=IsSameReal(aX0[0], aX0[1]);
|
|
||||||
if(!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aM[0]=aBSp[0]->Multiplicity(i);
|
|
||||||
aM[1]=aBSp[1]->Multiplicity(i);
|
|
||||||
myIsSame=(aM[0]==aM[1]);
|
|
||||||
if(!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetCurveBase
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_ComparatorCurve::GetCurveBase(const Handle(Geom_Curve)& aC3D,
|
|
||||||
GeomAbs_CurveType& aTypeBase,
|
|
||||||
Handle(Geom_Curve)& aCurveBase)
|
|
||||||
{
|
|
||||||
Standard_Boolean bIsTypeBase;
|
|
||||||
Standard_Integer iTrimmed, iOffset;
|
|
||||||
Standard_Real aOffsetBase;
|
|
||||||
GeomAbs_CurveType aTypeB;
|
|
||||||
Handle(Geom_Curve) aC3DB;
|
|
||||||
Handle(Geom_TrimmedCurve) aCT3D;
|
|
||||||
Handle(Geom_OffsetCurve) aCF3D;
|
|
||||||
//
|
|
||||||
aTypeBase=GeomAbs_OtherCurve;
|
|
||||||
aOffsetBase=0.;
|
|
||||||
//
|
|
||||||
aC3DB=aC3D;
|
|
||||||
bIsTypeBase=IsTypeBase(aC3DB, aTypeB);
|
|
||||||
if (bIsTypeBase) {
|
|
||||||
aTypeBase=aTypeB;
|
|
||||||
aCurveBase=aC3D;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for(;;) {
|
|
||||||
iTrimmed=0;
|
|
||||||
iOffset=0;
|
|
||||||
aCT3D=Handle(Geom_TrimmedCurve)::DownCast(aC3DB);
|
|
||||||
if (!aCT3D.IsNull()) {
|
|
||||||
aC3DB=aCT3D->BasisCurve();
|
|
||||||
++iTrimmed;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aCF3D=Handle(Geom_OffsetCurve)::DownCast(aC3DB);
|
|
||||||
if (!aCF3D.IsNull()) {
|
|
||||||
Standard_Real aOffset;
|
|
||||||
//
|
|
||||||
aOffset=aCF3D->Offset();
|
|
||||||
aOffsetBase=aOffsetBase+aOffset;
|
|
||||||
//
|
|
||||||
aC3DB=aCF3D->BasisCurve();
|
|
||||||
++iOffset;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!(iTrimmed || iOffset)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
bIsTypeBase=IsTypeBase(aC3DB, aTypeB);
|
|
||||||
if (bIsTypeBase) {
|
|
||||||
aTypeBase=aTypeB;
|
|
||||||
aCurveBase=aC3DB;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsTypeBase
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsTypeBase(const Handle(Geom_Curve)& aC,
|
|
||||||
GeomAbs_CurveType& aTypeB)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
Handle(Standard_Type) aType;
|
|
||||||
//
|
|
||||||
bRet=Standard_True;
|
|
||||||
//
|
|
||||||
aType=aC->DynamicType();
|
|
||||||
if (aType==STANDARD_TYPE(Geom_Line)) {
|
|
||||||
aTypeB=GeomAbs_Line;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_Circle)) {
|
|
||||||
aTypeB=GeomAbs_Circle;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_Ellipse)) {
|
|
||||||
aTypeB=GeomAbs_Ellipse;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_Parabola)) {
|
|
||||||
aTypeB=GeomAbs_Parabola;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_Hyperbola)) {
|
|
||||||
aTypeB=GeomAbs_Hyperbola;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_BezierCurve)) {
|
|
||||||
aTypeB=GeomAbs_BezierCurve;
|
|
||||||
}
|
|
||||||
else if (aType==STANDARD_TYPE(Geom_BSplineCurve)) {
|
|
||||||
aTypeB=GeomAbs_BSplineCurve;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aTypeB=GeomAbs_OtherCurve;
|
|
||||||
bRet=!bRet;
|
|
||||||
}
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameElipse
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_ComparatorCurve::IsSameElipse()
|
|
||||||
{
|
|
||||||
Standard_Real aR1, aR2;
|
|
||||||
gp_Elips aElips1, aElips2;
|
|
||||||
//
|
|
||||||
myIsSame=Standard_False;
|
|
||||||
//
|
|
||||||
aElips1=myBC1.Ellipse();
|
|
||||||
aElips2=myBC2.Ellipse();
|
|
||||||
//
|
|
||||||
aR1=aElips1.MajorRadius();
|
|
||||||
aR2=aElips2.MajorRadius();
|
|
||||||
myIsSame=IsSameReal(aR1, aR2);
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aR1=aElips1.MinorRadius();
|
|
||||||
aR2=aElips2.MinorRadius();
|
|
||||||
myIsSame=IsSameReal(aR1, aR2);
|
|
||||||
if (!myIsSame) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const gp_Ax2& aAx21=aElips1.Position();
|
|
||||||
const gp_Ax2& aAx22=aElips2.Position();
|
|
||||||
myIsSame=IsSameAx2(aAx21, aAx22);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameAx2
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSameAx2(const gp_Ax2& aAx21,
|
|
||||||
const gp_Ax2& aAx22)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
//
|
|
||||||
const gp_Ax1& aAx1=aAx21.Axis();
|
|
||||||
const gp_Ax1& aAx2=aAx22.Axis();
|
|
||||||
//
|
|
||||||
bRet=IsSameAx1(aAx1, aAx2);
|
|
||||||
if (!bRet) {
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const gp_Dir& aDirX1=aAx21.XDirection();
|
|
||||||
const gp_Dir& aDirX2=aAx22.XDirection();
|
|
||||||
//
|
|
||||||
bRet=IsSameDir(aDirX1, aDirX2);
|
|
||||||
if (!bRet) {
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
const gp_Dir& aDirY1=aAx21.YDirection();
|
|
||||||
const gp_Dir& aDirY2=aAx22.YDirection();
|
|
||||||
//
|
|
||||||
bRet=IsSameDir(aDirY1, aDirY2);
|
|
||||||
//
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSamePnt
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSamePnt(const gp_Pnt& aP1,
|
|
||||||
const gp_Pnt& aP2)
|
|
||||||
{
|
|
||||||
const gp_XYZ& aXYZ1=aP1.XYZ();
|
|
||||||
const gp_XYZ& aXYZ2=aP2.XYZ();
|
|
||||||
return IsSameXYZ(aXYZ1, aXYZ2);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameAx1
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSameAx1(const gp_Ax1& aAx1,
|
|
||||||
const gp_Ax1& aAx2)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
//
|
|
||||||
const gp_Pnt& aP1=aAx1.Location();
|
|
||||||
const gp_Pnt& aP2=aAx2.Location();
|
|
||||||
//
|
|
||||||
bRet=IsSamePnt(aP1, aP2);
|
|
||||||
if (!bRet) {
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
const gp_Dir& aDir1=aAx1.Direction();
|
|
||||||
const gp_Dir& aDir2=aAx2.Direction();
|
|
||||||
//
|
|
||||||
bRet=IsSameDir(aDir1, aDir2);
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameDir
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSameDir(const gp_Dir& aDir1,
|
|
||||||
const gp_Dir& aDir2)
|
|
||||||
{
|
|
||||||
const gp_XYZ& aXYZ1=aDir1.XYZ();
|
|
||||||
const gp_XYZ& aXYZ2=aDir2.XYZ();
|
|
||||||
return IsSameXYZ(aXYZ1, aXYZ2);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameXYZ
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSameXYZ(const gp_XYZ& aXYZ1,
|
|
||||||
const gp_XYZ& aXYZ2)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet = Standard_False;
|
|
||||||
Standard_Integer i;
|
|
||||||
Standard_Real aX1[3], aX2[3];
|
|
||||||
|
|
||||||
aXYZ1.Coord(aX1[0], aX1[1], aX1[2]);
|
|
||||||
aXYZ2.Coord(aX2[0], aX2[1], aX2[2]);
|
|
||||||
//
|
|
||||||
for (i=0; i<3; ++i) {
|
|
||||||
bRet=IsSameReal(aX1[i], aX2[i]);
|
|
||||||
if(!bRet) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameReal
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean
|
|
||||||
IntTools_ComparatorCurve::IsSameReal(const Standard_Real aR1,
|
|
||||||
const Standard_Real aR2)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet;
|
|
||||||
Standard_Real aEpsilon;
|
|
||||||
//
|
|
||||||
aEpsilon=Epsilon(aR1);
|
|
||||||
bRet=(fabs(aR1-aR2)<aEpsilon);
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//modified by NIZNHY-PKV Tue Jan 15 07:44:33 2013f
|
|
||||||
//=======================================================================
|
|
||||||
// class: IntTools_DistCC
|
|
||||||
// purpose :
|
|
||||||
//=======================================================================
|
|
||||||
class IntTools_DistCC {
|
|
||||||
public:
|
|
||||||
IntTools_DistCC() {
|
|
||||||
myT11=0.;
|
|
||||||
myT12=0.;
|
|
||||||
myT21=0.;
|
|
||||||
myT22=0.;
|
|
||||||
myErrorStatus=1;
|
|
||||||
myThreshold=1.e-7;
|
|
||||||
myDx=0.;
|
|
||||||
myTx=0.;
|
|
||||||
myNbP=10;
|
|
||||||
myIndent=0.3;
|
|
||||||
myEps=0.001;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
~IntTools_DistCC() {
|
|
||||||
};
|
|
||||||
//-------- 1
|
|
||||||
void SetCurve1(const Handle(Geom_Curve)& aC1) {
|
|
||||||
myC1=aC1;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
const Handle(Geom_Curve)& Curve1()const {
|
|
||||||
return myC1;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetRange1(const Standard_Real aT11,
|
|
||||||
const Standard_Real aT12) {
|
|
||||||
myT11=aT11;
|
|
||||||
myT12=aT12;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void Range1(Standard_Real& aT11,
|
|
||||||
Standard_Real& aT12)const {
|
|
||||||
aT11=myT11;
|
|
||||||
aT12=myT12;
|
|
||||||
};
|
|
||||||
//-------- 2
|
|
||||||
void SetCurve2(const Handle(Geom_Curve)& aC2) {
|
|
||||||
myC2=aC2;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
const Handle(Geom_Curve)& Curve2()const {
|
|
||||||
return myC2;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetRange2(const Standard_Real aT21,
|
|
||||||
const Standard_Real aT22) {
|
|
||||||
myT21=aT21;
|
|
||||||
myT22=aT22;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void Range2(Standard_Real& aT21,
|
|
||||||
Standard_Real& aT22)const {
|
|
||||||
aT21=myT21;
|
|
||||||
aT22=myT22;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
void SetThreshold(const Standard_Real aD) {
|
|
||||||
myThreshold=aD;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Standard_Real Threshold() const {
|
|
||||||
return myThreshold;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
void Perform();
|
|
||||||
//
|
|
||||||
Standard_Integer ErrorStatus()const {
|
|
||||||
return myErrorStatus;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
Standard_Real MaxDeviation()const {
|
|
||||||
return myDx;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Standard_Real MaxParameter()const {
|
|
||||||
return myTx;
|
|
||||||
}
|
|
||||||
//-----------------------------------------------------
|
|
||||||
protected :
|
|
||||||
//
|
|
||||||
void Init();
|
|
||||||
//
|
|
||||||
void CheckData();
|
|
||||||
//
|
|
||||||
Standard_Real Distance(const Standard_Real aT);
|
|
||||||
//
|
|
||||||
void FindMaxDeviation();
|
|
||||||
//
|
|
||||||
void FindMaxLocal (const Standard_Real aT11,
|
|
||||||
const Standard_Real aT12,
|
|
||||||
const Standard_Real aEps,
|
|
||||||
Standard_Real& aDx,
|
|
||||||
Standard_Real& aTx);
|
|
||||||
|
|
||||||
//
|
|
||||||
protected :
|
|
||||||
Standard_Real myT11;
|
|
||||||
Standard_Real myT12;
|
|
||||||
Handle(Geom_Curve) myC1;
|
|
||||||
|
|
||||||
Standard_Real myT21;
|
|
||||||
Standard_Real myT22;
|
|
||||||
Handle(Geom_Curve) myC2;
|
|
||||||
//
|
|
||||||
Standard_Real myThreshold;
|
|
||||||
Standard_Integer myErrorStatus;
|
|
||||||
//
|
|
||||||
Standard_Real myDx;
|
|
||||||
Standard_Real myTx;
|
|
||||||
//
|
|
||||||
Standard_Integer myNbP;
|
|
||||||
Standard_Real myIndent;
|
|
||||||
Standard_Real myEps;
|
|
||||||
GeomAPI_ProjectPointOnCurve myPPC2;
|
|
||||||
};
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_DistCC::Perform()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
//
|
|
||||||
CheckData();
|
|
||||||
if (myErrorStatus){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Init
|
|
||||||
myPPC2.Init(myC2, myT21, myT22);
|
|
||||||
//
|
|
||||||
FindMaxDeviation();
|
|
||||||
if (myErrorStatus){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : CheckData
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_DistCC::CheckData()
|
|
||||||
{
|
|
||||||
myErrorStatus=0;
|
|
||||||
//
|
|
||||||
if (myC1.IsNull()) {
|
|
||||||
myErrorStatus=2;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (myC2.IsNull()) {
|
|
||||||
myErrorStatus=3;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
//function : FindMaxDeviation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_DistCC::FindMaxDeviation()
|
|
||||||
{
|
|
||||||
Standard_Integer i, aNbP1, aNbP2;
|
|
||||||
Standard_Real aTmax, aT, aT1, aT2, dT, aDmax, aEps, aD;
|
|
||||||
//
|
|
||||||
myErrorStatus=0;
|
|
||||||
myDx=0.;
|
|
||||||
myTx=0.;
|
|
||||||
//
|
|
||||||
aTmax=0;
|
|
||||||
aDmax=0.;
|
|
||||||
aEps=myEps*(myT12-myT11);
|
|
||||||
//
|
|
||||||
aNbP1=myNbP-1;
|
|
||||||
aNbP2=aNbP1-1;
|
|
||||||
dT=(myT12-myT11)/aNbP1;
|
|
||||||
for (i=0; i<aNbP1; ++i) {
|
|
||||||
aT1=myT11+i*dT;
|
|
||||||
aT2=aT1+dT;
|
|
||||||
//
|
|
||||||
if (!i) {
|
|
||||||
aT1=aT1+myIndent*dT;
|
|
||||||
}
|
|
||||||
else if (i==aNbP2) {
|
|
||||||
aT2=aT2-myIndent*dT;
|
|
||||||
if (aT2>myT12) {
|
|
||||||
aT2=myT12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
FindMaxLocal(aT1, aT2, aEps, aD, aT);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (aD>aDmax) {
|
|
||||||
aDmax=aD;
|
|
||||||
aTmax=aT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myTx=aTmax;
|
|
||||||
myDx=aDmax;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : FindMaxLocal
|
|
||||||
//purpose : Solver: Golden Mean
|
|
||||||
//=======================================================================
|
|
||||||
void IntTools_DistCC::FindMaxLocal(const Standard_Real aT11,
|
|
||||||
const Standard_Real aT12,
|
|
||||||
const Standard_Real aEps,
|
|
||||||
Standard_Real& aDx,
|
|
||||||
Standard_Real& aTx)
|
|
||||||
{
|
|
||||||
Standard_Real aA, aB, aCf, aX1, aX2, aF1, aF2, aX, aF;
|
|
||||||
//
|
|
||||||
myErrorStatus=0;
|
|
||||||
aDx=0.;
|
|
||||||
aTx=0.;
|
|
||||||
//
|
|
||||||
aCf=1.6180339887498948482045868343656;// =0.5*(1.+sqrt(5.));
|
|
||||||
//
|
|
||||||
aA=aT11;
|
|
||||||
aB=aT12;
|
|
||||||
//
|
|
||||||
aX1=aB-(aB-aA)/aCf;
|
|
||||||
aF1=Distance(aX1);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aX2=aA+(aB-aA)/aCf;
|
|
||||||
aF2=Distance(aX2);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for(;;) {
|
|
||||||
if (fabs(aA-aB)<aEps) {
|
|
||||||
aX=0.5*(aA+aB);
|
|
||||||
aF=Distance(aX);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (aF1<aF2){
|
|
||||||
aA=aX1;
|
|
||||||
aX1=aX2;
|
|
||||||
aF1=aF2;
|
|
||||||
aX2=aA+(aB-aA)/aCf;
|
|
||||||
aF2=Distance(aX2);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aB=aX2;
|
|
||||||
aX2=aX1;
|
|
||||||
aF2=aF1;
|
|
||||||
aX1=aB-(aB-aA)/aCf;
|
|
||||||
aF1=Distance(aX1);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aDx=aF;
|
|
||||||
aTx=aX;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : Distance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Real IntTools_DistCC::Distance(const Standard_Real aT)
|
|
||||||
{
|
|
||||||
Standard_Integer aNbP2;
|
|
||||||
Standard_Real aD;
|
|
||||||
gp_Pnt aP1;
|
|
||||||
//
|
|
||||||
aD=0.;
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return aD;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
myC1->D0(aT, aP1);
|
|
||||||
myPPC2.Perform(aP1);
|
|
||||||
//
|
|
||||||
aNbP2=myPPC2.NbPoints();
|
|
||||||
if (!aNbP2) {
|
|
||||||
myErrorStatus=4;
|
|
||||||
return aD;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aD=myPPC2.LowerDistance();
|
|
||||||
if (aD>myThreshold) {
|
|
||||||
myErrorStatus=10;
|
|
||||||
}
|
|
||||||
return aD;
|
|
||||||
}
|
|
||||||
//modified by NIZNHY-PKV Tue Jan 15 07:44:44 2013t
|
|
||||||
//
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsSameCurves
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean IntTools_EdgeEdge::IsSameCurves()
|
|
||||||
{
|
|
||||||
Standard_Boolean bRet, bIsBC;
|
|
||||||
GeomAbs_CurveType aCT1, aCT2;
|
|
||||||
IntTools_ComparatorCurve aICC;
|
|
||||||
//
|
|
||||||
// 1. Check letter
|
|
||||||
aICC.SetCurve1(myCFrom);
|
|
||||||
aICC.SetRange1(myTminFrom, myTmaxFrom);
|
|
||||||
//
|
|
||||||
aICC.SetCurve2(myCTo);
|
|
||||||
aICC.SetRange2(myTminTo, myTmaxTo);
|
|
||||||
//
|
|
||||||
aICC.Perform();
|
|
||||||
bRet=aICC.IsSame();
|
|
||||||
if (bRet) {
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// 2. Check inwards
|
|
||||||
aCT1=myCFrom.GetType();
|
|
||||||
aCT2=myCTo.GetType();
|
|
||||||
bIsBC=(aCT1==GeomAbs_BSplineCurve ||
|
|
||||||
aCT1==GeomAbs_BezierCurve ||
|
|
||||||
aCT2==GeomAbs_BSplineCurve ||
|
|
||||||
aCT2==GeomAbs_BezierCurve);
|
|
||||||
//
|
|
||||||
if (bIsBC) {
|
|
||||||
Standard_Integer iErr;
|
|
||||||
Standard_Real aT11, aT12, aT21, aT22;
|
|
||||||
Handle(Geom_Curve) aC1, aC2;
|
|
||||||
IntTools_DistCC aDistCC;
|
|
||||||
//
|
|
||||||
const TopoDS_Edge& aE1=myCFrom.Edge();
|
|
||||||
aC1=BRep_Tool::Curve(aE1, aT11, aT12);
|
|
||||||
//
|
|
||||||
const TopoDS_Edge& aE2=myCTo.Edge();
|
|
||||||
aC2=BRep_Tool::Curve(aE2, aT21, aT22);
|
|
||||||
//
|
|
||||||
aDistCC.SetCurve1(aC1);
|
|
||||||
aDistCC.SetRange1(myTminFrom, myTmaxFrom);
|
|
||||||
aDistCC.SetCurve2(aC2);
|
|
||||||
aDistCC.SetRange2(myTminTo, myTmaxTo);
|
|
||||||
aDistCC.SetThreshold(myCriteria);
|
|
||||||
//
|
|
||||||
aDistCC.Perform();
|
|
||||||
//
|
|
||||||
iErr=aDistCC.ErrorStatus();
|
|
||||||
//
|
|
||||||
bRet=(!iErr);
|
|
||||||
//
|
|
||||||
}
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
|
|
@ -88,7 +88,8 @@
|
|||||||
// Returns true if one of original edges dropped
|
// Returns true if one of original edges dropped
|
||||||
static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
||||||
const TopoDS_Shape aShape,
|
const TopoDS_Shape aShape,
|
||||||
Standard_Integer& anIndex)
|
Standard_Integer& anIndex,
|
||||||
|
Handle(ShapeBuild_ReShape)& aContext)
|
||||||
{
|
{
|
||||||
//map of edges
|
//map of edges
|
||||||
TopTools_IndexedMapOfShape aNewEdges;
|
TopTools_IndexedMapOfShape aNewEdges;
|
||||||
@ -122,6 +123,7 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
|||||||
aNewEdges.Substitute(aNewEdges.FindIndex(current), LastEdge);
|
aNewEdges.Substitute(aNewEdges.FindIndex(current), LastEdge);
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
edges.Remove(i);
|
edges.Remove(i);
|
||||||
|
aContext->Remove(current);
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
if(!isDropped) {
|
if(!isDropped) {
|
||||||
@ -838,7 +840,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
|
|
||||||
Standard_Integer dummy;
|
Standard_Integer dummy;
|
||||||
TopTools_SequenceOfShape edges;
|
TopTools_SequenceOfShape edges;
|
||||||
AddOrdinaryEdges(edges,aFace,dummy);
|
AddOrdinaryEdges(edges, aFace, dummy, myContext);
|
||||||
|
|
||||||
TopTools_SequenceOfShape faces;
|
TopTools_SequenceOfShape faces;
|
||||||
faces.Append(aFace);
|
faces.Append(aFace);
|
||||||
@ -878,7 +880,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
|||||||
B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
|
B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
|
||||||
MovePCurves(aMockUpFace,anCheckedFace);
|
MovePCurves(aMockUpFace,anCheckedFace);
|
||||||
|
|
||||||
if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
|
if (AddOrdinaryEdges(edges, aMockUpFace, dummy, myContext)) {
|
||||||
// sequence edges is modified
|
// sequence edges is modified
|
||||||
i = dummy;
|
i = dummy;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user