mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
Patch for HYDRO.
This commit is contained in:
parent
47d9074abb
commit
edf6c13821
@ -699,28 +699,11 @@ void BOPAlgo_ArgumentAnalyzer::TestTangent()
|
||||
}
|
||||
}
|
||||
else if(theType == TopAbs_EDGE) {
|
||||
Standard_Integer aDiscretize = 30;
|
||||
Standard_Real aDeflection = 0.01;
|
||||
const TopoDS_Edge& aE1 = *(TopoDS_Edge*)&(aS1);
|
||||
const TopoDS_Edge& aE2 = *(TopoDS_Edge*)&(aS2);
|
||||
|
||||
IntTools_EdgeEdge aEE;
|
||||
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();
|
||||
|
||||
//
|
||||
IntTools_EdgeEdge aEE(aE1, aE2);
|
||||
//
|
||||
if (aEE.IsDone()) {
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts = aEE.CommonParts();
|
||||
Standard_Integer ii = 0;
|
||||
|
@ -20,6 +20,7 @@ uses
|
||||
Shape from TopoDS,
|
||||
BaseAllocator from BOPCol,
|
||||
ListOfShape from BOPCol,
|
||||
ListOfShape from TopTools,
|
||||
MapOfShape from BOPCol,
|
||||
IndexedDataMapOfShapeListOfShape from BOPCol,
|
||||
Operation from BOPAlgo,
|
||||
@ -97,6 +98,14 @@ is
|
||||
returns Boolean from Standard
|
||||
is protected;
|
||||
|
||||
Generated (me:out;
|
||||
theS : Shape from TopoDS)
|
||||
---Purpose: Returns the list of shapes generated from the
|
||||
-- shape theS.
|
||||
returns ListOfShape from TopTools
|
||||
is redefined;
|
||||
---C++: return const &
|
||||
|
||||
fields
|
||||
myNbArgs : Integer from Standard is protected;
|
||||
myOperation : Operation from BOPAlgo is protected;
|
||||
|
@ -136,3 +136,45 @@
|
||||
//
|
||||
myShape=aRC;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BOPAlgo_BOP::Generated(const TopoDS_Shape& theS)
|
||||
{
|
||||
myHistShapes.Clear();
|
||||
if (theS.IsNull() || (myOperation != BOPAlgo_SECTION)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = theS.ShapeType();
|
||||
if (aType != TopAbs_FACE) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
Standard_Integer nS = myDS->Index(theS);
|
||||
if (nS < 0) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
if (!myDS->HasFaceInfo(nS)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
//collect section edges of the face theS
|
||||
Standard_Integer i, aNb, nSp;
|
||||
//
|
||||
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
|
||||
aNb = aMPBSc.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
|
||||
nSp = aPB->Edge();
|
||||
const TopoDS_Shape& aSp = myDS->Shape(nSp);
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
|
||||
|
@ -29,55 +29,9 @@
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BOPAlgo_Builder::Generated(const TopoDS_Shape& theS)
|
||||
const TopTools_ListOfShape& BOPAlgo_Builder::Generated(const TopoDS_Shape&)
|
||||
{
|
||||
Standard_Boolean bHasImage, bToReverse;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myHistShapes.Clear();
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
bHasImage=myImages.IsBound(theS);
|
||||
if (!bHasImage) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
aType=theS.ShapeType();
|
||||
//
|
||||
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
//PrepareHistory();
|
||||
//
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myShapesSD.IsBound(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
TopoDS_Shape aSpR=myShapesSD.Find(aSp);
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSpR.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSpR, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSpR.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSpR);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
@ -114,21 +68,23 @@
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aSp=aIt.Value();
|
||||
if (!myShapesSD.IsBound(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
if (myShapesSD.IsBound(aSp)) {
|
||||
aSp = myShapesSD.Find(aSp);
|
||||
}
|
||||
//
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -175,13 +131,13 @@
|
||||
//
|
||||
if (!myShapesSD.IsBound(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
return bRet; //false
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape aSpR=myShapesSD.Find(aSp);
|
||||
if (myMapShape.Contains(aSpR)) {
|
||||
return bRet; //false
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -201,7 +157,7 @@
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage, bContainsSD;
|
||||
Standard_Boolean bHasImage;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_MapOfShape aMS;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
@ -232,18 +188,18 @@
|
||||
BOPCol_ListOfShape aLSx;
|
||||
if (!bHasImage) {
|
||||
if (myMapShape.Contains(aSx)) {
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
}
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
}
|
||||
}
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
@ -254,55 +210,19 @@
|
||||
myHasDeleted=IsDeleted(aSx);
|
||||
}
|
||||
//
|
||||
if (!myHasGenerated || !myHasModified) {
|
||||
if (!myHasModified && bHasImage) {
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
if (bHasImage) {
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
//
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
bContainsSD=myShapesSD.IsBound(aSp);
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
if (bContainsSD) {
|
||||
myHasGenerated=Standard_True;
|
||||
}
|
||||
}
|
||||
if (!myHasModified) {
|
||||
if (!bContainsSD) {
|
||||
myHasModified=Standard_True;
|
||||
}
|
||||
}
|
||||
} // if (myMapShape.Contains(aSp))
|
||||
}
|
||||
}
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
myHasModified = Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
if (aType==TopAbs_FACE) {
|
||||
const TopTools_ListOfShape& aLG = Generated(aSx);
|
||||
myHasGenerated = aLG.Extent() > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
myFlagHistory=Standard_True;
|
||||
}
|
||||
|
||||
// <- A
|
||||
/*
|
||||
BOPCol_ListOfShape aLSx;
|
||||
if (!bHasImage) {
|
||||
if (myMapShape.Contains(aSx)) {
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
}
|
||||
}
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
*/
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
@ -42,6 +44,7 @@
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPDS_BoxBndTree.hxx>
|
||||
//
|
||||
#include <BOPInt_Context.hxx>
|
||||
#include <BOPInt_ShrunkRange.hxx>
|
||||
@ -56,28 +59,24 @@
|
||||
#include <BOPDS_VectorOfInterfEE.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
#include <BOPDS_Pave.hxx>
|
||||
#include <BOPDS_BoxBndTree.hxx>
|
||||
|
||||
//
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function: PerformEE
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformEE()
|
||||
void BOPAlgo_PaveFiller::PerformEE()
|
||||
{
|
||||
Standard_Boolean bJustAdd, bOrder;
|
||||
Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize;
|
||||
Standard_Integer aNbCPrts, nWhat, nWith;
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer i, iX, iSize, nE1, nE2;
|
||||
Standard_Integer aNbCPrts;
|
||||
Standard_Real aTS11, aTS12, aTS21, aTS22,
|
||||
aT11, aT12, aT21, aT22;
|
||||
Standard_Real aTolE1, aTolE2, aDeflection;
|
||||
TopAbs_ShapeEnum aType;
|
||||
TopoDS_Edge aEWhat, aEWith;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
Handle(BOPDS_PaveBlock) aPBn1, aPBn2;
|
||||
BOPDS_MapOfPaveBlock aMPBToUpdate;
|
||||
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
|
||||
//
|
||||
@ -94,9 +93,6 @@
|
||||
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
|
||||
//
|
||||
aDiscretize=30;
|
||||
aDeflection=0.01;
|
||||
//
|
||||
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
|
||||
aEEs.SetStartSize(iSize);
|
||||
aEEs.SetIncrement(iSize);
|
||||
@ -120,9 +116,6 @@
|
||||
const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.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& aLPB2=myDS->ChangePaveBlocks(nE2);
|
||||
//
|
||||
@ -156,75 +149,23 @@
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// -----------f
|
||||
//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);
|
||||
IntTools_EdgeEdge anEdgeEdge;
|
||||
//
|
||||
aPB1->Range(aT11, aT12);
|
||||
aPB2->Range(aT21, aT22);
|
||||
IntTools_Range aPBRange1(aT11, aT12), aPBRange2(aT21, aT22);
|
||||
//
|
||||
IntTools_Range aPBR1 = aPBRange1;
|
||||
IntTools_Range aPBR2 = aPBRange2;
|
||||
BOPTools_AlgoTools::CorrectRange (aE1, aE2, aPBR1, aPBRange1);
|
||||
BOPTools_AlgoTools::CorrectRange (aE2, aE1, aPBR2, aPBRange2);
|
||||
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
|
||||
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
|
||||
//
|
||||
aEdgeEdge.SetRange1(aPBRange1);
|
||||
aEdgeEdge.SetRange2(aPBRange2);
|
||||
//
|
||||
aEdgeEdge.Perform();
|
||||
if (!aEdgeEdge.IsDone()) {
|
||||
anEdgeEdge.Perform();
|
||||
if (!anEdgeEdge.IsDone()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bOrder=aEdgeEdge.Order();
|
||||
if (!bOrder) {
|
||||
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();
|
||||
IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
|
||||
aR21(aT21, aTS21), aR22(aTS22, aT22);
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
|
||||
aNbCPrts=aCPrts.Length();
|
||||
for (i=1; i<=aNbCPrts; ++i) {
|
||||
const IntTools_CommonPrt& aCPart=aCPrts(i);
|
||||
@ -235,18 +176,25 @@
|
||||
Standard_Integer nV[4], j;
|
||||
Standard_Real aT1, aT2, aTol;
|
||||
TopoDS_Vertex aVnew;
|
||||
IntTools_Range aCR1, aCR2;
|
||||
//
|
||||
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
|
||||
bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol);
|
||||
bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol);
|
||||
bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol);
|
||||
bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol);
|
||||
bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) ||
|
||||
BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
|
||||
bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, 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]);
|
||||
aPBn2->Indices(nV[2], nV[3]);
|
||||
aPB1->Indices(nV[0], nV[1]);
|
||||
aPB2->Indices(nV[2], nV[3]);
|
||||
//
|
||||
if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) ||
|
||||
(bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) {
|
||||
@ -257,7 +205,7 @@
|
||||
for (j = 0; j < 4; ++j) {
|
||||
if (bIsOnPave[j]) {
|
||||
//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);
|
||||
bFlag = Standard_True;
|
||||
break;
|
||||
@ -267,7 +215,7 @@
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aVnew);
|
||||
BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
|
||||
// <-LXBR
|
||||
{
|
||||
Standard_Integer nVS[2], iFound, k;
|
||||
@ -310,14 +258,14 @@
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 1
|
||||
iX=aEEs.Append()-1;
|
||||
BOPDS_InterfEE& aEE=aEEs(iX);
|
||||
aEE.SetIndices(nWhat, nWith);
|
||||
aEE.SetIndices(nE1, nE2);
|
||||
aEE.SetCommonPart(aCPart);
|
||||
// 2
|
||||
myDS->AddInterf(nWhat, nWith);
|
||||
myDS->AddInterf(nE1, nE2);
|
||||
//
|
||||
BOPDS_CoupleOfPaveBlocks aCPB;
|
||||
//
|
||||
@ -328,14 +276,11 @@
|
||||
break;
|
||||
//
|
||||
case TopAbs_EDGE: {
|
||||
Standard_Boolean bHasSameBounds;
|
||||
Standard_Integer aNbComPrt2;
|
||||
//
|
||||
aNbComPrt2=aCPart.Ranges2().Length();
|
||||
if (aNbComPrt2>1){
|
||||
if (aNbCPrts > 1) {
|
||||
break;
|
||||
}
|
||||
//// <-LXBR
|
||||
//
|
||||
Standard_Boolean bHasSameBounds;
|
||||
bHasSameBounds=aPB1->HasSameBounds(aPB2);
|
||||
if (!bHasSameBounds) {
|
||||
break;
|
||||
@ -343,10 +288,10 @@
|
||||
// 1
|
||||
iX=aEEs.Append()-1;
|
||||
BOPDS_InterfEE& aEE=aEEs(iX);
|
||||
aEE.SetIndices(nWhat, nWith);
|
||||
aEE.SetIndices(nE1, nE2);
|
||||
aEE.SetCommonPart(aCPart);
|
||||
// 2
|
||||
myDS->AddInterf(nWhat, nWith);
|
||||
myDS->AddInterf(nE1, nE2);
|
||||
//
|
||||
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
|
||||
}//case TopAbs_EDGE
|
||||
@ -388,9 +333,9 @@
|
||||
//function : PerformVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
Standard_Integer aNbV, iRet;
|
||||
//
|
||||
@ -523,9 +468,9 @@
|
||||
//function : TreatNewVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::TreatNewVertices(
|
||||
const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
|
||||
void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
(const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
|
||||
{
|
||||
Standard_Integer j, i, aNbV, aNbVSD;
|
||||
Standard_Real aTol;
|
||||
@ -661,7 +606,7 @@
|
||||
//function : FillShrunkData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
|
||||
void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
|
||||
{
|
||||
Standard_Integer nE, nV1, nV2, iErr;
|
||||
Standard_Real aT1, aT2, aTS1, aTS2;
|
||||
|
@ -271,7 +271,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
Standard_Boolean bExist, bValid2D;
|
||||
Standard_Integer i, nF1, nF2, aNbC, aNbP, j;
|
||||
Standard_Integer nV1, nV2;
|
||||
Standard_Real aTolR3D, aTolR2D, aT1, aT2, aTol;
|
||||
Standard_Real aTolR3D, aT1, aT2, aTol;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
TopoDS_Edge aES;
|
||||
@ -310,7 +310,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
|
||||
//
|
||||
aTolR3D=aFF.TolR3D();
|
||||
aTolR2D=aFF.TolR2D();
|
||||
//
|
||||
// Update face info
|
||||
if (aMF.Add(nF1)) {
|
||||
@ -1400,66 +1399,66 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
|
||||
aType1=aGAS1.GetType();
|
||||
aType2=aGAS2.GetType();
|
||||
//
|
||||
if (aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||
GeomAbs_CurveType aTypeC;
|
||||
//if (aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||
GeomAbs_CurveType aTypeC;
|
||||
//
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
aTypeC=aIC.Type();
|
||||
//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||
Handle(Geom2d_Curve) aC2D[2];
|
||||
//
|
||||
aC2D[0]=aIC.FirstCurve2d();
|
||||
aC2D[1]=aIC.SecondCurve2d();
|
||||
if (!aC2D[0].IsNull() && !aC2D[1].IsNull()) {
|
||||
Standard_Integer nV, m, n;
|
||||
Standard_Real aTC[2], aD, aD2, u, v, aDT2, aScPr, aDScPr;
|
||||
gp_Pnt aPC[2], aPV;
|
||||
gp_Dir aDN[2];
|
||||
gp_Pnt2d aP2D;
|
||||
BOPCol_MapIteratorOfMapOfInteger aItMI, aItMI1;
|
||||
//
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
aTypeC=aIC.Type();
|
||||
if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||
Handle(Geom2d_Curve) aC2D[2];
|
||||
aDT2=2e-7; // the rich criteria
|
||||
aDScPr=5.e-9; // the creasing criteria
|
||||
aIC.Bounds(aTC[0], aTC[1], aPC[0], aPC[1]);
|
||||
//
|
||||
aItMI.Initialize(aMV);
|
||||
for (; aItMI.More(); aItMI.Next()) {
|
||||
nV = aItMI.Value();
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nV));
|
||||
aPV=BRep_Tool::Pnt(aV);
|
||||
//
|
||||
aC2D[0]=aIC.FirstCurve2d();
|
||||
aC2D[1]=aIC.SecondCurve2d();
|
||||
if (!aC2D[0].IsNull() && !aC2D[1].IsNull()) {
|
||||
Standard_Integer nV, m, n;
|
||||
Standard_Real aTC[2], aD, aD2, u, v, aDT2, aScPr, aDScPr;
|
||||
gp_Pnt aPC[2], aPV;
|
||||
gp_Dir aDN[2];
|
||||
gp_Pnt2d aP2D;
|
||||
BOPCol_MapIteratorOfMapOfInteger aItMI, aItMI1;
|
||||
for (m=0; m<2; ++m) {
|
||||
aD2=aPC[m].SquareDistance(aPV);
|
||||
if (aD2>aDT2) {// no rich
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aDT2=2e-7; // the rich criteria
|
||||
aDScPr=5.e-9; // the creasing criteria
|
||||
aIC.Bounds(aTC[0], aTC[1], aPC[0], aPC[1]);
|
||||
for (n=0; n<2; ++n) {
|
||||
Handle(Geom_Surface)& aS=(!n)? aS1 : aS2;
|
||||
aC2D[n]->D0(aTC[m], aP2D);
|
||||
aP2D.Coord(u, v);
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface(aS, u, v, aDN[n]);
|
||||
}
|
||||
//
|
||||
aScPr=aDN[0]*aDN[1];
|
||||
if (aScPr<0.) {
|
||||
aScPr=-aScPr;
|
||||
}
|
||||
aScPr=1.-aScPr;
|
||||
//
|
||||
aItMI.Initialize(aMV);
|
||||
for (; aItMI.More(); aItMI.Next()) {
|
||||
nV = aItMI.Value();
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nV));
|
||||
aPV=BRep_Tool::Pnt(aV);
|
||||
//
|
||||
for (m=0; m<2; ++m) {
|
||||
aD2=aPC[m].SquareDistance(aPV);
|
||||
if (aD2>aDT2) {// no rich
|
||||
continue;
|
||||
}
|
||||
//
|
||||
for (n=0; n<2; ++n) {
|
||||
Handle(Geom_Surface)& aS=(!n)? aS1 : aS2;
|
||||
aC2D[n]->D0(aTC[m], aP2D);
|
||||
aP2D.Coord(u, v);
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface(aS, u, v, aDN[n]);
|
||||
}
|
||||
//
|
||||
aScPr=aDN[0]*aDN[1];
|
||||
if (aScPr<0.) {
|
||||
aScPr=-aScPr;
|
||||
}
|
||||
aScPr=1.-aScPr;
|
||||
//
|
||||
if (aScPr>aDScPr) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// The intersection curve aIC is vanishing curve (the crease)
|
||||
aD=sqrt(aD2);
|
||||
//
|
||||
PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol);
|
||||
}
|
||||
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
||||
if (aScPr>aDScPr) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// The intersection curve aIC is vanishing curve (the crease)
|
||||
aD=sqrt(aD2);
|
||||
//
|
||||
PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol);
|
||||
}
|
||||
}//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||
}//if(aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
||||
}
|
||||
//}//if (aTypeC==GeomAbs_BezierCurve || aTypeC==GeomAbs_BSplineCurve) {
|
||||
//}//if(aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -189,6 +189,12 @@ is
|
||||
ListOfShape from TopTools,
|
||||
OrientedShapeMapHasher from TopTools);
|
||||
|
||||
class DataMapOfShapeHArray2OfShape instantiates
|
||||
DataMap from TCollection (Shape from TopoDS,
|
||||
HArray2OfShape from TopTools,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
class CurveConstraint ;
|
||||
---Purpose: same as CurveConstraint from GeomPlate
|
||||
-- with BRepAdaptor_Surface instead of
|
||||
|
@ -158,10 +158,7 @@ static Standard_Boolean PlaneOfWire (const TopoDS_Wire& W, gp_Pln& P)
|
||||
TopoDS_Edge Edge = TopoDS::Edge(anExp.Current());
|
||||
Standard_Real first, last;
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Curve) curv;
|
||||
curv = BRep_Tool::Curve(Edge, loc, first, last);
|
||||
curv =
|
||||
Handle(Geom_Curve)::DownCast(curv->Transformed(loc.Transformation()));
|
||||
Handle(Geom_Curve) curv = BRep_Tool::Curve(Edge, first, last);
|
||||
if (wClosed) {
|
||||
GeomAdaptor_Curve AdC;
|
||||
AdC.Load(curv);
|
||||
@ -1455,9 +1452,24 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
Standard_Integer nbs, NbSamples = 0;
|
||||
if (theLength <= 2)
|
||||
NbSamples = 4;
|
||||
gp_Pln FirstPlane;
|
||||
PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
|
||||
gp_Pnt FirstBary = FirstPlane.Location();
|
||||
gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
|
||||
for (i = ideb+1; i <= ifin; i++)
|
||||
{
|
||||
const TopoDS_Wire& wire = TopoDS::Wire(myWork(i));
|
||||
|
||||
//Compute offset vector as current bary center projected on first plane
|
||||
//to first bary center
|
||||
gp_Pln CurPlane;
|
||||
PlaneOfWire(wire, CurPlane);
|
||||
gp_Pnt CurBary = CurPlane.Location();
|
||||
gp_Vec aVec(FirstBary, CurBary);
|
||||
gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
|
||||
CurBary.Translate(-anOffsetProj); //projected current bary center
|
||||
gp_Vec Offset(CurBary, FirstBary);
|
||||
|
||||
TopoDS_Wire newwire;
|
||||
BRep_Builder BB;
|
||||
BB.MakeWire(newwire);
|
||||
@ -1481,11 +1493,6 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
else
|
||||
for (j = 1; j <= theLength; j++)
|
||||
{
|
||||
// get a vector to superpose SeqVertices(j) on PrevSeq(1)
|
||||
const TopoDS_Vertex& Vprev = TopoDS::Vertex( PrevSeq(1) );
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex( SeqVertices(j) );
|
||||
gp_Vec curToPrevVec( BRep_Tool::Pnt(V), BRep_Tool::Pnt(Vprev) );
|
||||
|
||||
//Forward
|
||||
Standard_Real SumDist = 0.;
|
||||
for (k = j, n = 1; k <= theLength; k++, n++)
|
||||
@ -1493,7 +1500,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
const TopoDS_Vertex& Vprev = TopoDS::Vertex( PrevSeq(n) );
|
||||
gp_Pnt Pprev = BRep_Tool::Pnt(Vprev);
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex( SeqVertices(k) );
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + Offset.XYZ();
|
||||
SumDist += Pprev.Distance(P);
|
||||
if (NbSamples > 0)
|
||||
{
|
||||
@ -1512,7 +1519,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
(Ecurve.FirstParameter() + nbs*SampleOnCur) :
|
||||
(Ecurve.FirstParameter() + (NbSamples-nbs)*SampleOnCur);
|
||||
gp_Pnt PonPrev = PrevEcurve.Value(ParOnPrev);
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + Offset.XYZ();
|
||||
SumDist += PonPrev.Distance(PonCur);
|
||||
}
|
||||
}
|
||||
@ -1522,7 +1529,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
const TopoDS_Vertex& Vprev = TopoDS::Vertex( PrevSeq(n) );
|
||||
gp_Pnt Pprev = BRep_Tool::Pnt(Vprev);
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex( SeqVertices(k) );
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + Offset.XYZ();
|
||||
SumDist += Pprev.Distance(P);
|
||||
if (NbSamples > 0)
|
||||
{
|
||||
@ -1541,7 +1548,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
(Ecurve.FirstParameter() + nbs*SampleOnCur) :
|
||||
(Ecurve.FirstParameter() + (NbSamples-nbs)*SampleOnCur);
|
||||
gp_Pnt PonPrev = PrevEcurve.Value(ParOnPrev);
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + Offset.XYZ();
|
||||
SumDist += PonPrev.Distance(PonCur);
|
||||
}
|
||||
}
|
||||
@ -1560,7 +1567,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
const TopoDS_Vertex& Vprev = TopoDS::Vertex( PrevSeq(n) );
|
||||
gp_Pnt Pprev = BRep_Tool::Pnt(Vprev);
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex( SeqVertices(k) );
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + Offset.XYZ();
|
||||
SumDist += Pprev.Distance(P);
|
||||
if (NbSamples > 0)
|
||||
{
|
||||
@ -1582,7 +1589,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
(Ecurve.FirstParameter() + (NbSamples-nbs)*SampleOnCur) :
|
||||
(Ecurve.FirstParameter() + nbs*SampleOnCur);
|
||||
gp_Pnt PonPrev = PrevEcurve.Value(ParOnPrev);
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + Offset.XYZ();
|
||||
SumDist += PonPrev.Distance(PonCur);
|
||||
}
|
||||
}
|
||||
@ -1592,7 +1599,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
const TopoDS_Vertex& Vprev = TopoDS::Vertex( PrevSeq(n) );
|
||||
gp_Pnt Pprev = BRep_Tool::Pnt(Vprev);
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex( SeqVertices(k) );
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt P = BRep_Tool::Pnt(V).XYZ() + Offset.XYZ();
|
||||
SumDist += Pprev.Distance(P);
|
||||
if (NbSamples > 0)
|
||||
{
|
||||
@ -1611,7 +1618,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
(Ecurve.FirstParameter() + (NbSamples-nbs)*SampleOnCur) :
|
||||
(Ecurve.FirstParameter() + nbs*SampleOnCur);
|
||||
gp_Pnt PonPrev = PrevEcurve.Value(ParOnPrev);
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + curToPrevVec.XYZ();
|
||||
gp_Pnt PonCur = Ecurve.Value(ParOnCur).XYZ() + Offset.XYZ();
|
||||
SumDist += PonPrev.Distance(PonCur);
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,13 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepFill_Draft.ixx>
|
||||
|
||||
#include <BRepFill_DraftLaw.hxx>
|
||||
#include <BRepFill_ShapeLaw.hxx>
|
||||
#include <BRepFill_Sweep.hxx>
|
||||
#include <BRepFill_DataMapOfShapeHArray2OfShape.hxx>
|
||||
|
||||
#include <BndLib_Add3dCurve.hxx>
|
||||
#include <BndLib_AddSurface.hxx>
|
||||
@ -519,7 +521,9 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B,
|
||||
BRepFill_Sweep Sweep(mySec, myLoc, Standard_True);
|
||||
Sweep.SetTolerance(myTol);
|
||||
Sweep.SetAngularControl(angmin, angmax);
|
||||
Sweep.Build(myStyle, myCont);
|
||||
TopTools_MapOfShape Dummy;
|
||||
BRepFill_DataMapOfShapeHArray2OfShape Dummy2;
|
||||
Sweep.Build(Dummy, Dummy2, myStyle, myCont);
|
||||
if (Sweep.IsDone()) {
|
||||
myShape = Sweep.Shape();
|
||||
myShell = TopoDS::Shell(myShape);
|
||||
|
@ -14,6 +14,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepFill_Evolved.ixx>
|
||||
|
||||
|
||||
@ -2220,8 +2221,8 @@ void BRepFill_Evolved::MakePipe(const TopoDS_Edge& SE,
|
||||
}
|
||||
#endif
|
||||
|
||||
// BRepFill_Pipe Pipe(BRepLib_MakeWire(SE),GenProf);
|
||||
BRepFill_Pipe Pipe = BRepFill_Pipe(BRepLib_MakeWire(SE),GenProf);
|
||||
BRepFill_Pipe Pipe(BRepLib_MakeWire(SE), GenProf);
|
||||
//BRepFill_Pipe Pipe = BRepFill_Pipe(BRepLib_MakeWire(SE),GenProf);
|
||||
|
||||
#ifdef DRAW
|
||||
if (AffichGeom) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepFill_LocationLaw.ixx>
|
||||
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
@ -36,6 +37,7 @@
|
||||
#include <TColgp_Array1OfVec2d.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@ -608,8 +610,10 @@ void BRepFill_LocationLaw::CurvilinearBounds(const Standard_Integer Index,
|
||||
M(2,1), M(2,2), M(2,3), V.Y(),
|
||||
M(3,1), M(3,2), M(3,3), V.Z(),
|
||||
1.e-12, 1.e-14);
|
||||
TopLoc_Location Loc(fila);
|
||||
W.Location(Loc.Multiplied(W.Location()));
|
||||
//TopLoc_Location Loc(fila);
|
||||
//W.Location(Loc.Multiplied(W.Location()));
|
||||
W = BRepBuilderAPI_Transform(W, fila, Standard_True); //copy
|
||||
///////////////////////////////////////////
|
||||
}
|
||||
else {
|
||||
W.Nullify();
|
||||
|
@ -14,6 +14,7 @@
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
|
||||
class Pipe from BRepFill
|
||||
|
||||
---Purpose: Create a shape by sweeping a shape (the profile)
|
||||
@ -26,6 +27,8 @@ class Pipe from BRepFill
|
||||
uses
|
||||
|
||||
HArray2OfShape from TopTools,
|
||||
MapOfShape from TopTools,
|
||||
DataMapOfShapeHArray2OfShape from BRepFill,
|
||||
LocationLaw from BRepFill,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
@ -108,7 +111,7 @@ is
|
||||
is static;
|
||||
|
||||
|
||||
PipeLine(me; Point : Pnt from gp)
|
||||
PipeLine(me : in out; Point : Pnt from gp)
|
||||
---Purpose: Create a Wire by sweeping the Point along the <spine>
|
||||
returns Wire from TopoDS
|
||||
raises
|
||||
@ -145,6 +148,10 @@ is
|
||||
DefineRealSegmax(me : in out)
|
||||
is static private;
|
||||
|
||||
RebuildTopOrBottomFace(me; aFace: Shape from TopoDS;
|
||||
IsTop: Boolean from Standard)
|
||||
is static private;
|
||||
|
||||
ShareFaces(me: in out; theShape: Shape from TopoDS;
|
||||
theInitialFacesLen: Integer;
|
||||
theInitialEdgesLen: Integer;
|
||||
@ -164,7 +171,10 @@ fields
|
||||
myLoc : LocationLaw from BRepFill;
|
||||
mySections: HArray2OfShape from TopTools;
|
||||
myFaces : HArray2OfShape from TopTools;
|
||||
myEdges : HArray2OfShape from TopTools;
|
||||
myEdges : HArray2OfShape from TopTools;
|
||||
myReversedEdges : MapOfShape from TopTools;
|
||||
myTapes : DataMapOfShapeHArray2OfShape from BRepFill;
|
||||
myCurIndexOfSectionEdge : Integer from Standard;
|
||||
myFirst : Shape from TopoDS;
|
||||
myLast : Shape from TopoDS;
|
||||
|
||||
|
@ -52,12 +52,65 @@
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
|
||||
#ifdef DRAW
|
||||
#include <DBRep.hxx>
|
||||
static Standard_Boolean Affich = 0;
|
||||
#endif
|
||||
|
||||
|
||||
static void UpdateTolFromTopOrBottomPCurve(const TopoDS_Face& aFace,
|
||||
TopoDS_Edge& anEdge)
|
||||
{
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, fpar, lpar);
|
||||
if (aPCurve.IsNull())
|
||||
return;
|
||||
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||
if (aCurve.IsNull())
|
||||
return;
|
||||
|
||||
Handle(Geom2dAdaptor_HCurve) GAHC2d = new Geom2dAdaptor_HCurve(aPCurve, fpar, lpar);
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
|
||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(aSurf);
|
||||
Adaptor3d_CurveOnSurface ConS(GAHC2d, GAHS);
|
||||
|
||||
Standard_Real Tol = BRep_Tool::Tolerance(anEdge);
|
||||
Standard_Real InitTol = Tol;
|
||||
Standard_Real TolTol = Tol*Tol;
|
||||
const Standard_Integer NCONTROL = 22;
|
||||
Standard_Real delta = (lpar - fpar)/NCONTROL;
|
||||
for (Standard_Integer i = 0; i <= NCONTROL; i++)
|
||||
{
|
||||
Standard_Real par = fpar + i*delta;
|
||||
gp_Pnt pnt = aCurve->Value(par);
|
||||
gp_Pnt prj = ConS.Value(par);
|
||||
Standard_Real sqdist = pnt.SquareDistance(prj);
|
||||
if (sqdist > TolTol)
|
||||
TolTol = sqdist;
|
||||
}
|
||||
Tol = 1.00005 * Sqrt(TolTol);
|
||||
if (Tol >= InitTol)
|
||||
{
|
||||
BRep_Builder BB;
|
||||
BB.UpdateEdge(anEdge, Tol);
|
||||
TopoDS_Iterator itv(anEdge);
|
||||
for (; itv.More(); itv.Next())
|
||||
{
|
||||
TopoDS_Vertex aVertex = TopoDS::Vertex(itv.Value());
|
||||
BB.UpdateVertex(aVertex, Tol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepFill_Pipe
|
||||
//purpose :
|
||||
@ -70,6 +123,8 @@ BRepFill_Pipe::BRepFill_Pipe()
|
||||
myContinuity = GeomAbs_C2;
|
||||
myMode = GeomFill_IsCorrectedFrenet;
|
||||
myForceApproxC1 = Standard_False;
|
||||
|
||||
myCurIndexOfSectionEdge = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +154,9 @@ BRepFill_Pipe::BRepFill_Pipe(const TopoDS_Wire& Spine,
|
||||
myContinuity = GeomAbs_C0;
|
||||
|
||||
myForceApproxC1 = ForceApproxC1;
|
||||
|
||||
myCurIndexOfSectionEdge = 1;
|
||||
|
||||
Perform(Spine, Profile, KPart);
|
||||
}
|
||||
|
||||
@ -175,7 +233,8 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine,
|
||||
TopLoc_Location LocFirst(fila);
|
||||
myFirst = myProfile;
|
||||
if ( ! LocFirst.IsIdentity()) {
|
||||
myFirst.Location( LocFirst.Multiplied(myProfile.Location()) );
|
||||
//myFirst.Location( LocFirst.Multiplied(myProfile.Location()) );
|
||||
myFirst = BRepBuilderAPI_Transform(myProfile, fila, Standard_True); //copy
|
||||
}
|
||||
|
||||
myLoc->Law(myLoc->NbLaw())->GetDomain(first, last);
|
||||
@ -190,7 +249,8 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine,
|
||||
if (! myLoc->IsClosed() || LocFirst != LocLast) {
|
||||
myLast = myProfile;
|
||||
if ( ! LocLast.IsIdentity()) {
|
||||
myLast.Location(LocLast.Multiplied(myProfile.Location()) );
|
||||
//myLast.Location(LocLast.Multiplied(myProfile.Location()) );
|
||||
myLast = BRepBuilderAPI_Transform(myProfile, fila, Standard_True); //copy
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -379,7 +439,7 @@ TopoDS_Shape BRepFill_Pipe::Section(const TopoDS_Vertex& VSpine) const
|
||||
//purpose : Construct a wire by sweeping of a point
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire BRepFill_Pipe::PipeLine(const gp_Pnt& Point) const
|
||||
TopoDS_Wire BRepFill_Pipe::PipeLine(const gp_Pnt& Point)
|
||||
{
|
||||
// Postioning
|
||||
gp_Pnt P;
|
||||
@ -393,7 +453,8 @@ TopoDS_Wire BRepFill_Pipe::PipeLine(const gp_Pnt& Point) const
|
||||
// Sweeping
|
||||
BRepFill_Sweep MkSw(Section, myLoc, Standard_True);
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( myReversedEdges, myTapes,
|
||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
TopoDS_Shape aLocalShape = MkSw.Shape();
|
||||
return TopoDS::Wire(aLocalShape);
|
||||
// return TopoDS::Wire(MkSw.Shape());
|
||||
@ -480,7 +541,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
|
||||
case TopAbs_SOLID :
|
||||
case TopAbs_COMPSOLID :
|
||||
Standard_DomainError::Raise("BRepFill_Pipe::SOLID or COMPSOLID");
|
||||
Standard_DomainError::Raise("BRepFill_Pipe::profile contains solids");
|
||||
break;
|
||||
|
||||
case TopAbs_COMPOUND :
|
||||
@ -519,7 +580,8 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
new (BRepFill_ShapeLaw) (TopoDS::Vertex(TheS));
|
||||
BRepFill_Sweep MkSw(Section, myLoc, Standard_True);
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( myReversedEdges, myTapes,
|
||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
}
|
||||
|
||||
@ -530,7 +592,8 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
MkSw.SetBounds(TopoDS::Wire(TheFirst),
|
||||
TopoDS::Wire(TheLast));
|
||||
MkSw.SetForceApproxC1(myForceApproxC1);
|
||||
MkSw.Build( BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
MkSw.Build( myReversedEdges, myTapes,
|
||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
|
||||
// Labeling of elements
|
||||
@ -543,9 +606,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
Handle(TopTools_HArray2OfShape) Aux, Somme;
|
||||
Standard_Integer length;
|
||||
Standard_Integer ii, jj, kk;
|
||||
const Standard_Integer aNbFaces = myFaces->ColLength();
|
||||
const Standard_Integer aNbEdges = myEdges->ColLength();
|
||||
const Standard_Integer aNbSections = mySections->ColLength();
|
||||
|
||||
Aux = MkSw.SubShape();
|
||||
length = Aux->ColLength() + myFaces->ColLength();
|
||||
@ -568,7 +628,9 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
for (jj=1; jj<=mySections->RowLength(); jj++) {
|
||||
for (ii=1; ii<=mySections->ColLength(); ii++)
|
||||
Somme->SetValue(ii, jj, mySections->Value(ii, jj));
|
||||
|
||||
|
||||
myCurIndexOfSectionEdge = mySections->ColLength()+1;
|
||||
|
||||
for (kk=1, ii=mySections->ColLength()+1;
|
||||
kk <=Aux->ColLength(); kk++, ii++)
|
||||
Somme->SetValue(ii, jj, Aux->Value(kk, jj));
|
||||
@ -589,15 +651,20 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
}
|
||||
|
||||
myEdges = Somme;
|
||||
|
||||
// Perform sharing faces
|
||||
result = ShareFaces(result, aNbFaces, aNbEdges, aNbSections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( TheS.ShapeType() == TopAbs_FACE ) {
|
||||
Standard_Integer ii, jj;
|
||||
//jgv
|
||||
TopExp_Explorer Explo(result, TopAbs_FACE);
|
||||
for (; Explo.More(); Explo.Next())
|
||||
{
|
||||
TopoDS_Shape aFace = Explo.Current();
|
||||
RebuildTopOrBottomFace(aFace.Reversed(), Standard_True); //top face was reversed
|
||||
}
|
||||
/////
|
||||
TopoDS_Face F;
|
||||
for (ii=InitialLength+1; ii<=myFaces->ColLength(); ii++) {
|
||||
for (jj=1; jj<=myFaces->RowLength(); jj++) {
|
||||
@ -609,6 +676,10 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
if ( !mySpine.Closed()) {
|
||||
// if Spine is not closed
|
||||
// add the last face of the solid
|
||||
|
||||
//jgv
|
||||
RebuildTopOrBottomFace(TheLast, Standard_False); //bottom face
|
||||
/////
|
||||
B.Add(result, TopoDS::Face(TheLast));
|
||||
}
|
||||
|
||||
@ -805,280 +876,46 @@ void BRepFill_Pipe::DefineRealSegmax()
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShareFaces
|
||||
//purpose :
|
||||
//function : RebuildTopOrBottomFace
|
||||
//purpose : Correct orientation of v-iso edges
|
||||
// according to new 3d and 2d curves taken from swept surfaces
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepFill_Pipe::ShareFaces
|
||||
(const TopoDS_Shape &theShape,
|
||||
const Standard_Integer theInitialFacesLen,
|
||||
const Standard_Integer theInitialEdgesLen,
|
||||
const Standard_Integer theInitialSectionsLen)
|
||||
void BRepFill_Pipe::RebuildTopOrBottomFace(const TopoDS_Shape& aFace,
|
||||
const Standard_Boolean IsTop) const
|
||||
{
|
||||
TopoDS_Shape aResult = theShape;
|
||||
// Check if there are shapes to be shared.
|
||||
TopTools_DataMapOfShapeInteger aMapBndEdgeIndex;
|
||||
TColStd_DataMapOfIntegerInteger aMapNewOldFIndex;
|
||||
TColStd_DataMapOfIntegerInteger aMapNewOldEIndex;
|
||||
TopTools_MapOfShape aMapUsedVtx;
|
||||
TopExp_Explorer anExp;
|
||||
Standard_Integer i;
|
||||
Standard_Integer IndexOfSection =
|
||||
(IsTop)? 1 : mySections->RowLength();
|
||||
|
||||
Standard_Integer ii;
|
||||
Standard_Integer jj;
|
||||
BRep_Builder aBuilder;
|
||||
|
||||
// Check the first and last J index of myFaces.
|
||||
for (i = 1; i <= 2; i++) {
|
||||
// Compute jj index of faces.
|
||||
if (i == 1) {
|
||||
jj = 1;
|
||||
} else {
|
||||
jj = myFaces->RowLength();
|
||||
|
||||
if (jj == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the map of boundary edges on initial faces.
|
||||
for (ii = 1; ii <= theInitialFacesLen; ii++) {
|
||||
anExp.Init(myFaces->Value(ii, jj), TopAbs_EDGE);
|
||||
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
aMapBndEdgeIndex.Bind(anExp.Current(), ii);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if edges of newly created faces are shared with old ones.
|
||||
for (ii = theInitialFacesLen + 1; ii <= myFaces->ColLength(); ii++) {
|
||||
anExp.Init(myFaces->Value(ii, jj), TopAbs_EDGE);
|
||||
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
if (aMapBndEdgeIndex.IsBound(anExp.Current())) {
|
||||
// This row should be replaced.
|
||||
Standard_Integer anOldIndex = aMapBndEdgeIndex.Find(anExp.Current());
|
||||
|
||||
aMapNewOldFIndex.Bind(ii, anOldIndex);
|
||||
|
||||
// Find corresponding new and old edges indices.
|
||||
TopoDS_Vertex aV[2];
|
||||
TopExp::Vertices(TopoDS::Edge(anExp.Current()), aV[0], aV[1]);
|
||||
Standard_Integer ie;
|
||||
|
||||
// Compute jj index of edges.
|
||||
Standard_Integer je = (i == 1 ? 1 : myEdges->RowLength());
|
||||
|
||||
for (Standard_Integer j = 0; j < 2; j++) {
|
||||
if (aMapUsedVtx.Contains(aV[j])) {
|
||||
// This vertex is treated.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find old index.
|
||||
Standard_Integer iEOld = -1;
|
||||
TopoDS_Vertex aVE[2];
|
||||
|
||||
for (ie = 1; ie <= theInitialEdgesLen; ie++) {
|
||||
const TopoDS_Shape &anEdge = myEdges->Value(ie, je);
|
||||
|
||||
TopExp::Vertices(TopoDS::Edge(anEdge), aVE[0], aVE[1]);
|
||||
|
||||
if (aV[j].IsSame(aVE[0]) || aV[j].IsSame(aVE[1])) {
|
||||
iEOld = ie;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iEOld > 0) {
|
||||
// Find new index.
|
||||
for (ie = theInitialEdgesLen+1; ie <= myEdges->ColLength(); ie++) {
|
||||
const TopoDS_Shape &anEdge = myEdges->Value(ie, je);
|
||||
|
||||
TopExp::Vertices(TopoDS::Edge(anEdge), aVE[0], aVE[1]);
|
||||
|
||||
if (aV[j].IsSame(aVE[0]) || aV[j].IsSame(aVE[1])) {
|
||||
// This row should be replaced.
|
||||
aMapNewOldEIndex.Bind(ie, iEOld);
|
||||
aMapUsedVtx.Add(aV[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BRep_Builder BB;
|
||||
TopoDS_Iterator itf(aFace);
|
||||
for (; itf.More(); itf.Next())
|
||||
{
|
||||
TopoDS_Shape aWire = itf.Value();
|
||||
TopTools_SequenceOfShape InitEdges;
|
||||
TopTools_SequenceOfShape ResEdges;
|
||||
TopoDS_Iterator itw(aWire);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
TopoDS_Shape anEdge = itw.Value();
|
||||
for (ii = myCurIndexOfSectionEdge; ii <= mySections->ColLength(); ii++)
|
||||
{
|
||||
TopoDS_Shape aVisoEdge = mySections->Value(ii, IndexOfSection);
|
||||
if (anEdge.IsSame(aVisoEdge))
|
||||
{
|
||||
InitEdges.Append(anEdge);
|
||||
ResEdges.Append(aVisoEdge);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!aMapNewOldFIndex.IsEmpty()) {
|
||||
TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter(aMapNewOldFIndex);
|
||||
TopTools_ListOfShape aListShape;
|
||||
BRepTools_Substitution aSubstitute;
|
||||
|
||||
for (; anIter.More(); anIter.Next()) {
|
||||
const Standard_Integer aNewIndex = anIter.Key();
|
||||
const Standard_Integer anOldIndex = anIter.Value();
|
||||
|
||||
// Change new faces by old ones.
|
||||
for (jj = 1; jj <= myFaces->RowLength(); jj++) {
|
||||
const TopoDS_Shape &aNewFace = myFaces->Value(aNewIndex, jj);
|
||||
const TopoDS_Shape &anOldFace = myFaces->Value(anOldIndex, jj);
|
||||
|
||||
if (!aSubstitute.IsCopied(aNewFace)) {
|
||||
aListShape.Append(anOldFace.Oriented(TopAbs_REVERSED));
|
||||
aSubstitute.Substitute(aNewFace, aListShape);
|
||||
aListShape.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change new edges by old ones.
|
||||
for (anIter.Initialize(aMapNewOldEIndex); anIter.More(); anIter.Next()) {
|
||||
const Standard_Integer aNewIndex = anIter.Key();
|
||||
const Standard_Integer anOldIndex = anIter.Value();
|
||||
|
||||
for (jj = 1; jj <= myEdges->RowLength(); jj++) {
|
||||
const TopoDS_Shape &aNewEdge = myEdges->Value(aNewIndex, jj);
|
||||
const TopoDS_Shape &anOldEdge = myEdges->Value(anOldIndex, jj);
|
||||
|
||||
if (!aSubstitute.IsCopied(aNewEdge)) {
|
||||
aListShape.Append(anOldEdge.Oriented(TopAbs_FORWARD));
|
||||
aSubstitute.Substitute(aNewEdge, aListShape);
|
||||
aListShape.Clear();
|
||||
|
||||
// Change new vertices by old ones.
|
||||
TopoDS_Iterator aNewIt(aNewEdge);
|
||||
TopoDS_Iterator anOldIt(anOldEdge);
|
||||
|
||||
for (; aNewIt.More() && anOldIt.More();
|
||||
aNewIt.Next(), anOldIt.Next()) {
|
||||
if (!aNewIt.Value().IsSame(anOldIt.Value())) {
|
||||
if (!aSubstitute.IsCopied(aNewIt.Value())) {
|
||||
aListShape.Append(anOldIt.Value().Oriented(TopAbs_FORWARD));
|
||||
aSubstitute.Substitute(aNewIt.Value(), aListShape);
|
||||
aListShape.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Perform substitution.
|
||||
aSubstitute.Build(aResult);
|
||||
|
||||
if (aSubstitute.IsCopied(aResult)) {
|
||||
// Get copied shape.
|
||||
const TopTools_ListOfShape& listSh = aSubstitute.Copy(aResult);
|
||||
|
||||
aResult = listSh.First();
|
||||
|
||||
// Update original faces with copied ones.
|
||||
for (ii = theInitialFacesLen + 1; ii <= myFaces->ColLength(); ii++) {
|
||||
for (jj = 1; jj <= myFaces->RowLength(); jj++) {
|
||||
TopoDS_Shape anOldFace = myFaces->Value(ii, jj); // Copy
|
||||
|
||||
if (aSubstitute.IsCopied(anOldFace)) {
|
||||
const TopTools_ListOfShape& aList = aSubstitute.Copy(anOldFace);
|
||||
|
||||
if(!aList.IsEmpty()) {
|
||||
// Store copied face.
|
||||
const TopoDS_Shape &aCopyFace = aList.First();
|
||||
TopAbs_Orientation anOri = anOldFace.Orientation();
|
||||
const Standard_Boolean isShared = aMapNewOldFIndex.IsBound(ii);
|
||||
|
||||
if (isShared) {
|
||||
// Reverse the orientation for shared face.
|
||||
anOri = TopAbs::Reverse(anOri);
|
||||
}
|
||||
|
||||
myFaces->SetValue(ii, jj, aCopyFace.Oriented(anOri));
|
||||
|
||||
// Check if it is necessary to update PCurves on this face.
|
||||
if (!isShared) {
|
||||
TopoDS_Face anOldF = TopoDS::Face(anOldFace);
|
||||
TopoDS_Face aCopyF = TopoDS::Face(aCopyFace);
|
||||
|
||||
anOldF.Orientation(TopAbs_FORWARD);
|
||||
anExp.Init(anOldF, TopAbs_EDGE);
|
||||
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Shape &anOldEdge = anExp.Current();
|
||||
|
||||
if (aSubstitute.IsCopied(anOldEdge)) {
|
||||
const TopTools_ListOfShape& aListE =
|
||||
aSubstitute.Copy(anOldEdge);
|
||||
|
||||
if(!aListE.IsEmpty()) {
|
||||
// This edge is copied. Check if there is a PCurve
|
||||
// on the face.
|
||||
TopoDS_Edge aCopyE = TopoDS::Edge(aListE.First());
|
||||
Standard_Real aFirst;
|
||||
Standard_Real aLast;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface
|
||||
(aCopyE, aCopyF, aFirst, aLast);
|
||||
|
||||
if (aPCurve.IsNull()) {
|
||||
// There is no pcurve copy it from the old edge.
|
||||
TopoDS_Edge anOldE = TopoDS::Edge(anOldEdge);
|
||||
|
||||
aPCurve = BRep_Tool::CurveOnSurface
|
||||
(anOldE, anOldF, aFirst, aLast);
|
||||
|
||||
if (aPCurve.IsNull() == Standard_False) {
|
||||
// Update the shared edge with PCurve from new Face.
|
||||
Standard_Real aTol = Max(BRep_Tool::Tolerance(anOldE),
|
||||
BRep_Tool::Tolerance(aCopyE));
|
||||
|
||||
aBuilder.UpdateEdge(aCopyE, aPCurve, aCopyF, aTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update new edges with shared ones.
|
||||
for (ii = theInitialEdgesLen + 1; ii <= myEdges->ColLength(); ii++) {
|
||||
for (jj = 1; jj <= myEdges->RowLength(); jj++) {
|
||||
const TopoDS_Shape &aLocalShape = myEdges->Value(ii, jj);
|
||||
|
||||
if (aSubstitute.IsCopied(aLocalShape)) {
|
||||
const TopTools_ListOfShape& aList = aSubstitute.Copy(aLocalShape);
|
||||
|
||||
if(!aList.IsEmpty()) {
|
||||
const TopAbs_Orientation anOri = TopAbs_FORWARD;
|
||||
|
||||
myEdges->SetValue(ii, jj, aList.First().Oriented(anOri));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update new sections with shared ones.
|
||||
for (ii = theInitialSectionsLen+1; ii <= mySections->ColLength(); ii++) {
|
||||
for (jj = 1; jj <= mySections->RowLength(); jj++) {
|
||||
const TopoDS_Shape &aLocalShape = mySections->Value(ii, jj);
|
||||
|
||||
if (aSubstitute.IsCopied(aLocalShape)) {
|
||||
const TopTools_ListOfShape& aList = aSubstitute.Copy(aLocalShape);
|
||||
|
||||
if(!aList.IsEmpty()) {
|
||||
const TopAbs_Orientation anOri = TopAbs_FORWARD;
|
||||
|
||||
mySections->SetValue(ii, jj, aList.First().Oriented(anOri));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aWire.Free(Standard_True);
|
||||
for (ii = 1; ii <= InitEdges.Length(); ii++)
|
||||
{
|
||||
BB.Remove(aWire, InitEdges(ii));
|
||||
UpdateTolFromTopOrBottomPCurve(TopoDS::Face(aFace), TopoDS::Edge(ResEdges(ii)));
|
||||
BB.Add(aWire, ResEdges(ii));
|
||||
}
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
@ -106,6 +106,19 @@ is
|
||||
|
||||
---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;
|
||||
ForceApproxC1 : Boolean from Standard);
|
||||
---Purpose: Set the flag that indicates attempt to approximate
|
||||
@ -280,6 +293,8 @@ fields
|
||||
myBoundTol : Real;
|
||||
myTolAngular : Real;
|
||||
angmin, angmax : Real;
|
||||
myMaxDegree : Integer;
|
||||
myMaxSegments : Integer;
|
||||
myForceApproxC1 : Boolean;
|
||||
|
||||
myLaw : Function from Law;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <BRepFill_ShapeLaw.hxx>
|
||||
#include <BRepFill_CompatibleWires.hxx>
|
||||
#include <BRepFill_NSections.hxx>
|
||||
#include <BRepFill_DataMapOfShapeHArray2OfShape.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
#include <GeomFill_TrihedronLaw.hxx>
|
||||
@ -69,6 +70,7 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
@ -212,7 +214,7 @@ static Standard_Boolean IsSameOriented(const TopoDS_Shape& aFace,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
||||
: mySpine(Spine),
|
||||
: mySpine(Spine),
|
||||
myForceApproxC1(Standard_False),
|
||||
myIsAutomaticLaw(Standard_False),
|
||||
myTrihedron(GeomFill_IsCorrectedFrenet),
|
||||
@ -224,6 +226,9 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
||||
myLaw.Nullify();
|
||||
SetTolerance();
|
||||
|
||||
myMaxDegree = 11;
|
||||
myMaxSegments = 30;
|
||||
|
||||
// Attention to closed non-declared wire !
|
||||
if (!mySpine.Closed()) {
|
||||
TopoDS_Vertex Vf, Vl;
|
||||
@ -412,6 +417,25 @@ BRepFill_PipeShell::BRepFill_PipeShell(const TopoDS_Wire& Spine)
|
||||
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
|
||||
//purpose : Set the flag that indicates attempt to approximate
|
||||
@ -738,7 +762,10 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
|
||||
GeomAbs_Shape theContinuity = GeomAbs_C2;
|
||||
if (myTrihedron == GeomFill_IsDiscreteTrihedron)
|
||||
theContinuity = GeomAbs_C0;
|
||||
MkSw.Build(myTransition, theContinuity);
|
||||
TopTools_MapOfShape Dummy;
|
||||
BRepFill_DataMapOfShapeHArray2OfShape Dummy2;
|
||||
MkSw.Build(Dummy, Dummy2, myTransition, theContinuity,
|
||||
GeomFill_Location, myMaxDegree, myMaxSegments);
|
||||
|
||||
myStatus = myLocation->GetStatus();
|
||||
Ok = (MkSw.IsDone() && (myStatus == GeomFill_PipeOk));
|
||||
@ -1118,11 +1145,14 @@ void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
|
||||
Sec.Vertex(),
|
||||
Sec.WithContact(),
|
||||
Sec.WithCorrection());
|
||||
W = Sec.Wire();
|
||||
TopoDS_Wire TmpWire = Sec.Wire();
|
||||
aTrsf = Place.Transformation();
|
||||
TopLoc_Location Loc2(Place.Transformation()), Loc1;
|
||||
Loc1 = W.Location();
|
||||
W.Location(Loc2.Multiplied(Loc1));
|
||||
//TopLoc_Location Loc2(Place.Transformation()), Loc1;
|
||||
//Loc1 = TmpWire.Location();
|
||||
//W.Location(Loc2.Multiplied(Loc1));
|
||||
//Transform the copy
|
||||
W = TopoDS::Wire(BRepBuilderAPI_Transform(TmpWire, aTrsf, Standard_True));
|
||||
////////////////////////////////////
|
||||
param = Place.AbscissaOnPath();
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
|
||||
class Sweep from BRepFill
|
||||
|
||||
---Purpose: Topological Sweep Algorithm
|
||||
@ -28,8 +29,11 @@ uses
|
||||
Shape from GeomAbs,
|
||||
HArray2OfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
MapOfShape from TopTools,
|
||||
DataMapOfShapeHArray2OfShape from BRepFill,
|
||||
Wire from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Shape from TopoDS,
|
||||
Trsf from gp
|
||||
|
||||
@ -81,7 +85,9 @@ is
|
||||
-- to be C0.
|
||||
|
||||
|
||||
Build(me : in out;
|
||||
Build(me : in out;
|
||||
ReversedEdges : in out MapOfShape from TopTools;
|
||||
Tapes : in out DataMapOfShapeHArray2OfShape from BRepFill;
|
||||
Transition : TransitionStyle = BRepFill_Modified;
|
||||
Continuity : Shape from GeomAbs = GeomAbs_C2;
|
||||
Approx : ApproxStyle = GeomFill_Location;
|
||||
@ -112,7 +118,9 @@ is
|
||||
|
||||
BuildShell(me : in out;
|
||||
Transition : TransitionStyle;
|
||||
Vf, Vl : Integer;
|
||||
Vf, Vl : Integer;
|
||||
ReversedEdges : in out MapOfShape from TopTools;
|
||||
Tapes : in out DataMapOfShapeHArray2OfShape from BRepFill;
|
||||
ExtendFirst : Real = 0.0;
|
||||
ExtendLast : Real = 0.0)
|
||||
returns Boolean is private;
|
||||
@ -158,6 +166,11 @@ is
|
||||
V : in out Shape from TopoDS)
|
||||
is private;
|
||||
|
||||
RebuildTopOrBottomEdge(me; aNewEdge: Edge from TopoDS;
|
||||
anEdge: in out Edge from TopoDS;
|
||||
ReversedEdges: in out MapOfShape from TopTools)
|
||||
is private;
|
||||
|
||||
fields
|
||||
isDone : Boolean;
|
||||
KPart : Boolean;
|
||||
|
@ -91,6 +91,7 @@
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColGeom_Array2OfSurface.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfBoolean.hxx>
|
||||
|
||||
#include <TopTools_Array1OfShape.hxx>
|
||||
#include <TopTools_Array2OfShape.hxx>
|
||||
@ -99,6 +100,7 @@
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
@ -908,20 +910,16 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
|
||||
f2, l2, C3);
|
||||
C2 = C3;
|
||||
|
||||
Standard_Boolean pointu_f, pointu_l;
|
||||
// P1 = BT.Pnt(Vf);
|
||||
P1 = BRep_Tool::Pnt(Vf);
|
||||
// P2 = BT.Pnt(V1);
|
||||
P2 = BRep_Tool::Pnt(V1);
|
||||
// pointu_f = Vf.IsSame(V1) || (P1.Distance(P2) < BT.Tolerance(Vf));
|
||||
pointu_f = Vf.IsSame(V1) || (P1.Distance(P2) < BRep_Tool::Tolerance(Vf));
|
||||
// P1 = BT.Pnt(Vl);
|
||||
P1 = BRep_Tool::Pnt(Vl);
|
||||
// P2 = BT.Pnt(V2);
|
||||
P2 = BRep_Tool::Pnt(V2);
|
||||
// pointu_l = Vl.IsSame(V2) || (P1.Distance(P2) < BT.Tolerance(Vl));
|
||||
pointu_l = Vl.IsSame(V2) || (P1.Distance(P2) < BRep_Tool::Tolerance(Vl));
|
||||
|
||||
|
||||
P2d.SetCoord(0.,f1);
|
||||
L = new (Geom2d_Line) (P2d, gp::DX2d());
|
||||
@ -1703,7 +1701,9 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
LastShape = Last;
|
||||
|
||||
// It is necessary to check the SameRange on its (PRO13551)
|
||||
#ifdef DEB
|
||||
Standard_Boolean issame = Standard_True;
|
||||
#endif
|
||||
BRep_Builder B;
|
||||
BRepTools_WireExplorer wexp;
|
||||
if (!FirstShape.IsNull()) {
|
||||
@ -1711,7 +1711,9 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
if (!BRepLib::CheckSameRange(wexp.Current())) {
|
||||
B.SameRange(wexp.Current(), Standard_False);
|
||||
B.SameParameter(wexp.Current(), Standard_False);
|
||||
#ifdef DEB
|
||||
issame = Standard_False;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1721,7 +1723,9 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
if (!BRepLib::CheckSameRange(wexp.Current())) {
|
||||
B.SameRange(wexp.Current(), Standard_False);
|
||||
B.SameParameter(wexp.Current(), Standard_False);
|
||||
#ifdef DEB
|
||||
issame = Standard_False;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1933,6 +1937,8 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
BuildShell(const BRepFill_TransitionStyle /*Transition*/,
|
||||
const Standard_Integer IFirst,
|
||||
const Standard_Integer ILast,
|
||||
TopTools_MapOfShape& ReversedEdges,
|
||||
BRepFill_DataMapOfShapeHArray2OfShape& Tapes,
|
||||
const Standard_Real ExtendFirst,
|
||||
const Standard_Real ExtendLast)
|
||||
{
|
||||
@ -2060,8 +2066,31 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
Standard_Boolean exuv, singu, singv;
|
||||
Handle(Geom_Surface) S;
|
||||
|
||||
// Preprocessing: correct <FirstShape> if the profile is shell
|
||||
if (!ReversedEdges.IsEmpty())
|
||||
{
|
||||
TopTools_SequenceOfShape EdgesToReverse;
|
||||
TopoDS_Iterator itw(FirstShape);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Shape& anEdge = itw.Value();
|
||||
if (ReversedEdges.Contains(anEdge))
|
||||
EdgesToReverse.Append(anEdge);
|
||||
}
|
||||
FirstShape.Free(Standard_True);
|
||||
for (Standard_Integer i = 1; i <= EdgesToReverse.Length(); i++)
|
||||
{
|
||||
B.Remove(FirstShape, EdgesToReverse(i));
|
||||
EdgesToReverse(i).Reverse();
|
||||
B.Add(FirstShape, EdgesToReverse(i));
|
||||
}
|
||||
}
|
||||
|
||||
// (2.0) return preexisting Edges and vertices
|
||||
TopoDS_Edge E;
|
||||
TColStd_Array1OfBoolean IsBuilt(1, NbLaw);
|
||||
IsBuilt.Init(Standard_False);
|
||||
TopTools_Array1OfShape StartEdges(1, NbLaw);
|
||||
if (! FirstShape.IsNull() && (IFirst==1)) {
|
||||
mySec->Init(FirstShape);
|
||||
for (isec=1; isec<=NbLaw; isec++) {
|
||||
@ -2073,7 +2102,53 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
Vertex(isec+1, 1) = TopExp::LastVertex(E);
|
||||
UpdateVertex(IFirst-1, isec+1,
|
||||
TabErr(isec, 1), Vi(1), Vertex(isec+1, 1));
|
||||
|
||||
StartEdges(isec) = E;
|
||||
if (Tapes.IsBound(E))
|
||||
{
|
||||
IsBuilt(isec) = Standard_True;
|
||||
|
||||
//Initialize VEdge, UEdge, Vertex and myFaces
|
||||
Standard_Integer j;
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
{
|
||||
VEdge(isec, j) = Tapes(E)->Value(1, j);
|
||||
VEdge(isec, j).Reverse(); //direction of round is reversed
|
||||
}
|
||||
Standard_Integer ifirst = isec+1, ilast = isec; //direction of round is reversed
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
UEdge(ifirst, j) = Tapes(E)->Value(2, j);
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
UEdge(ilast, j) = Tapes(E)->Value(3, j);
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Vertex(ifirst, j) = Tapes(E)->Value(4, j);
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Vertex(ilast, j) = Tapes(E)->Value(5, j);
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
myFaces->SetValue(isec, j, Tapes(E)->Value(6, j));
|
||||
|
||||
if (uclose && isec == 1)
|
||||
{
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
UEdge(NbLaw+1, j) = UEdge(1, j);
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Vertex(NbLaw+1, j) = Vertex(1, j);
|
||||
}
|
||||
if (uclose && isec == NbLaw)
|
||||
{
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
UEdge(1, j) = UEdge(NbLaw+1, j);
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Vertex(1, j) = Vertex(NbLaw+1, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(TopTools_HArray2OfShape) EmptyArray = new TopTools_HArray2OfShape(1, 6, 1, NbPath+1);
|
||||
Tapes.Bind(E, EmptyArray);
|
||||
}
|
||||
}
|
||||
|
||||
if (VEdge(1, 1).Orientation() == TopAbs_REVERSED)
|
||||
Vertex(1, 1) = TopExp::LastVertex(TopoDS::Edge(VEdge(1, 1)));
|
||||
else
|
||||
@ -2081,128 +2156,152 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
UpdateVertex(IFirst-1, 1,
|
||||
TabErr(1, 1), Vi(1), Vertex(1, 1));
|
||||
}
|
||||
else { // Otherwise construct vertices
|
||||
Standard_Real u, v, aux;
|
||||
Standard_Boolean ureverse;
|
||||
for (isec=1; isec<=NbLaw+1; isec++) {
|
||||
// Return data
|
||||
if (isec >NbLaw) {
|
||||
S = TabS(NbLaw, 1);
|
||||
ureverse = UReverse(NbLaw, 1);
|
||||
exuv = ExchUV(NbLaw, 1);
|
||||
|
||||
Standard_Real u, v, aux;
|
||||
Standard_Boolean ureverse;
|
||||
for (isec=1; isec<=NbLaw+1; isec++) {
|
||||
// Return data
|
||||
if (isec >NbLaw) {
|
||||
S = TabS(NbLaw, 1);
|
||||
ureverse = UReverse(NbLaw, 1);
|
||||
exuv = ExchUV(NbLaw, 1);
|
||||
}
|
||||
else {
|
||||
S = TabS(isec, 1);
|
||||
ureverse = UReverse(isec, 1);
|
||||
exuv = ExchUV(isec, 1);
|
||||
}
|
||||
S->Bounds(UFirst, ULast, VFirst, VLast);
|
||||
|
||||
// Choice of parameters
|
||||
if (ureverse) {
|
||||
if (exuv) {
|
||||
aux = VFirst; VFirst = VLast; VLast = aux;
|
||||
}
|
||||
else {
|
||||
S = TabS(isec, 1);
|
||||
ureverse = UReverse(isec, 1);
|
||||
exuv = ExchUV(isec, 1);
|
||||
aux = UFirst; UFirst = ULast; ULast = aux;
|
||||
}
|
||||
S->Bounds(UFirst, ULast, VFirst, VLast);
|
||||
|
||||
// Choice of parameters
|
||||
if (ureverse) {
|
||||
if (exuv) {
|
||||
aux = VFirst; VFirst = VLast; VLast = aux;
|
||||
}
|
||||
else {
|
||||
aux = UFirst; UFirst = ULast; ULast = aux;
|
||||
}
|
||||
}
|
||||
if (isec!= NbLaw+1) {
|
||||
}
|
||||
if (isec!= NbLaw+1) {
|
||||
u = UFirst;
|
||||
v = VFirst;
|
||||
}
|
||||
else {
|
||||
if (exuv) {
|
||||
u = UFirst;
|
||||
v = VLast;
|
||||
}
|
||||
else {
|
||||
u = ULast;
|
||||
v = VFirst;
|
||||
}
|
||||
else {
|
||||
if (exuv) {
|
||||
u = UFirst;
|
||||
v = VLast;
|
||||
}
|
||||
else {
|
||||
u = ULast;
|
||||
v = VFirst;
|
||||
}
|
||||
}
|
||||
|
||||
// construction of vertices
|
||||
}
|
||||
|
||||
// construction of vertices
|
||||
if (Vertex(isec, 1).IsNull())
|
||||
B.MakeVertex(TopoDS::Vertex(Vertex(isec, 1)),
|
||||
S->Value(u,v),
|
||||
mySec->VertexTol(isec-1,Vi(1)));
|
||||
else
|
||||
{
|
||||
TopLoc_Location Identity;
|
||||
Vertex(isec, 1).Location(Identity);
|
||||
B.UpdateVertex(TopoDS::Vertex(Vertex(isec, 1)),
|
||||
S->Value(u,v),
|
||||
mySec->VertexTol(isec-1,Vi(1)));
|
||||
}
|
||||
}
|
||||
|
||||
} //end of for (isec=1; isec<=NbLaw+1; isec++)
|
||||
|
||||
if (! LastShape.IsNull() && (ILast==myLoc->NbLaw()+1) ) {
|
||||
mySec->Init(LastShape);
|
||||
for (isec=1; isec<=NbLaw; isec++) {
|
||||
E = mySec->CurrentEdge();
|
||||
VEdge(isec, NbPath+1) = E;
|
||||
if (E.Orientation() == TopAbs_REVERSED)
|
||||
Vertex(isec+1, NbPath+1) = TopExp::FirstVertex(E);
|
||||
else
|
||||
Vertex(isec+1, NbPath+1) = TopExp::LastVertex(E);
|
||||
if (VEdge(isec, NbPath+1).IsNull())
|
||||
VEdge(isec, NbPath+1) = E;
|
||||
|
||||
if (Vertex(isec+1, NbPath+1).IsNull())
|
||||
{
|
||||
if (VEdge(isec, NbPath+1).Orientation() == TopAbs_REVERSED)
|
||||
Vertex(isec+1, NbPath+1) = TopExp::FirstVertex(TopoDS::Edge(VEdge(isec, NbPath+1)));
|
||||
else
|
||||
Vertex(isec+1, NbPath+1) = TopExp::LastVertex(TopoDS::Edge(VEdge(isec, NbPath+1)));
|
||||
}
|
||||
UpdateVertex(ILast-1, isec+1, TabErr(isec, NbPath),
|
||||
Vi(NbPath+1), Vertex(isec+1, NbPath+1));
|
||||
}
|
||||
if (VEdge(1, NbPath+1).Orientation() == TopAbs_REVERSED)
|
||||
Vertex(1, NbPath+1) =
|
||||
TopExp::LastVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
|
||||
else
|
||||
Vertex(1, NbPath+1) =
|
||||
TopExp::FirstVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
|
||||
|
||||
if (Vertex(1, NbPath+1).IsNull())
|
||||
{
|
||||
if (VEdge(1, NbPath+1).Orientation() == TopAbs_REVERSED)
|
||||
Vertex(1, NbPath+1) = TopExp::LastVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
|
||||
else
|
||||
Vertex(1, NbPath+1) = TopExp::FirstVertex(TopoDS::Edge(VEdge(1, NbPath+1)));
|
||||
}
|
||||
UpdateVertex(ILast-1, 1,
|
||||
TabErr(1, NbPath), Vi(NbPath+1), Vertex(1, NbPath+1 ));
|
||||
}
|
||||
else {
|
||||
Standard_Real u, v, aux;
|
||||
Standard_Boolean ureverse;
|
||||
for (isec=1; isec<=NbLaw+1; isec++) {
|
||||
// Return data
|
||||
if (isec >NbLaw) {
|
||||
}
|
||||
|
||||
for (isec=1; isec<=NbLaw+1; isec++) {
|
||||
// Return data
|
||||
if (isec >NbLaw) {
|
||||
S = TabS(NbLaw, NbPath);
|
||||
ureverse = UReverse(NbLaw, NbPath);
|
||||
exuv = ExchUV(NbLaw, NbPath);
|
||||
}
|
||||
else {
|
||||
S = TabS(isec, NbPath);
|
||||
ureverse = UReverse(isec, NbPath);
|
||||
exuv = ExchUV(isec, NbPath);
|
||||
}
|
||||
S->Bounds(UFirst, ULast, VFirst, VLast);
|
||||
|
||||
// Choice of parametres
|
||||
if (ureverse) {
|
||||
if (exuv) {
|
||||
aux = VFirst; VFirst = VLast; VLast = aux;
|
||||
}
|
||||
else {
|
||||
S = TabS(isec, NbPath);
|
||||
ureverse = UReverse(isec, NbPath);
|
||||
exuv = ExchUV(isec, NbPath);
|
||||
aux = UFirst; UFirst = ULast; ULast = aux;
|
||||
}
|
||||
S->Bounds(UFirst, ULast, VFirst, VLast);
|
||||
|
||||
// Choice of parametres
|
||||
if (ureverse) {
|
||||
if (exuv) {
|
||||
aux = VFirst; VFirst = VLast; VLast = aux;
|
||||
}
|
||||
else {
|
||||
aux = UFirst; UFirst = ULast; ULast = aux;
|
||||
}
|
||||
}
|
||||
if (isec == NbLaw+1) {
|
||||
}
|
||||
if (isec == NbLaw+1) {
|
||||
u = ULast;
|
||||
v = VLast;
|
||||
}
|
||||
else {
|
||||
if (exuv) {
|
||||
u = ULast;
|
||||
v = VFirst;
|
||||
}
|
||||
else {
|
||||
u = UFirst;
|
||||
v = VLast;
|
||||
}
|
||||
else {
|
||||
if (exuv) {
|
||||
u = ULast;
|
||||
v = VFirst;
|
||||
}
|
||||
else {
|
||||
u = UFirst;
|
||||
v = VLast;
|
||||
}
|
||||
}
|
||||
|
||||
// construction of vertex
|
||||
}
|
||||
|
||||
// construction of vertex
|
||||
if (Vertex(isec, NbPath+1).IsNull())
|
||||
B.MakeVertex(TopoDS::Vertex(Vertex(isec, NbPath+1)),
|
||||
S->Value(u,v),
|
||||
mySec->VertexTol(isec-1, Vi(NbPath+1)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TopLoc_Location Identity;
|
||||
Vertex(isec, NbPath+1).Location(Identity);
|
||||
B.UpdateVertex(TopoDS::Vertex(Vertex(isec, NbPath+1)),
|
||||
S->Value(u,v),
|
||||
mySec->VertexTol(isec-1, Vi(NbPath+1)));
|
||||
}
|
||||
} //end of for (isec=1; isec<=NbLaw+1; isec++)
|
||||
|
||||
|
||||
// ---------- Creation of Vertex and edge ------------
|
||||
for (ipath=1, IPath=IFirst; ipath<=NbPath;
|
||||
ipath++, IPath++) {
|
||||
for (isec=1; isec <=NbLaw; isec++) {
|
||||
if (IsBuilt(isec))
|
||||
continue;
|
||||
|
||||
S = TabS(isec, ipath);
|
||||
exuv = ExchUV(isec, ipath);
|
||||
S->Bounds(UFirst, ULast, VFirst, VLast);
|
||||
@ -2270,6 +2369,7 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
TabErr(isec,1) +
|
||||
mySec->VertexTol(isec,Vi(1)),
|
||||
TopoDS::Vertex(Vertex(isec+1, 1)) );
|
||||
|
||||
if (MergeVertex(Vertex(isec,1), Vertex(isec+1,1))) {
|
||||
VEdge(isec, 1) = NullEdge(Vertex(isec, 1));
|
||||
}
|
||||
@ -2339,7 +2439,7 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
}
|
||||
|
||||
// (2.2) Iso-u
|
||||
if (isec == 1) {
|
||||
if (isec == 1 && UEdge(1, ipath).IsNull()) {
|
||||
if (!Vertex(1,ipath).IsSame(Vertex(1,ipath+1))) {
|
||||
gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(Vertex(1,ipath)));
|
||||
gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(Vertex(1,ipath+1)));
|
||||
@ -2360,18 +2460,29 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
UEdge(isec+1, ipath) = UEdge(1, ipath);
|
||||
}
|
||||
else {
|
||||
UEdge(isec+1, ipath) = BuildEdge(S, !exuv, ULast,
|
||||
Vertex(isec+1, ipath),
|
||||
Vertex(isec+1, ipath+1),
|
||||
myTol3d);
|
||||
if (UEdge(isec+1, ipath).IsNull())
|
||||
UEdge(isec+1, ipath) = BuildEdge(S, !exuv, ULast,
|
||||
Vertex(isec+1, ipath),
|
||||
Vertex(isec+1, ipath+1),
|
||||
myTol3d);
|
||||
else
|
||||
UpdateEdge(TopoDS::Edge(UEdge(isec+1, ipath)), S, !exuv, ULast);
|
||||
}
|
||||
|
||||
// (2.3) Iso-v
|
||||
if (ipath == 1 && VEdge(isec, ipath).IsNull())
|
||||
VEdge(isec, ipath) = BuildEdge(S, exuv, VFirst,
|
||||
Vertex(isec , 1),
|
||||
Vertex(isec+1, 1),
|
||||
myTol3d);
|
||||
if (ipath == 1)
|
||||
{
|
||||
TopoDS_Edge aNewFirstEdge = BuildEdge(S, exuv, VFirst,
|
||||
Vertex(isec , 1),
|
||||
Vertex(isec+1, 1),
|
||||
myTol3d);
|
||||
if (VEdge(isec, ipath).IsNull())
|
||||
VEdge(isec, ipath) = aNewFirstEdge;
|
||||
else //rebuild first edge
|
||||
RebuildTopOrBottomEdge(aNewFirstEdge,
|
||||
TopoDS::Edge(VEdge(isec, ipath)),
|
||||
ReversedEdges);
|
||||
}
|
||||
|
||||
else UpdateEdge(TopoDS::Edge(VEdge(isec, ipath)),
|
||||
S, exuv, VFirst);
|
||||
@ -2386,9 +2497,22 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
Vertex(isec , ipath+1),
|
||||
Vertex(isec+1, ipath+1),
|
||||
myTol3d);
|
||||
else UpdateEdge(TopoDS::Edge(VEdge(isec, ipath+1)),
|
||||
S, exuv, VLast);
|
||||
|
||||
else
|
||||
{
|
||||
if (ipath != NbPath || vclose)
|
||||
UpdateEdge(TopoDS::Edge(VEdge(isec, ipath+1)),
|
||||
S, exuv, VLast);
|
||||
else //ipath == NbPath && !vclose => rebuild last edge
|
||||
{
|
||||
TopoDS_Edge aNewLastEdge = BuildEdge(S, exuv, VLast,
|
||||
Vertex(isec , ipath+1),
|
||||
Vertex(isec+1, ipath+1),
|
||||
myTol3d);
|
||||
RebuildTopOrBottomEdge(aNewLastEdge,
|
||||
TopoDS::Edge(VEdge(isec, ipath+1)),
|
||||
ReversedEdges);
|
||||
}
|
||||
}
|
||||
}
|
||||
}// End of construction of edges
|
||||
}
|
||||
@ -2427,7 +2551,7 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
else
|
||||
myFaces->SetValue(isec, IPath, VEdge(isec, ipath));
|
||||
}
|
||||
else {
|
||||
else if (myFaces->Value(isec, IPath).IsNull()) {
|
||||
BuildFace(TabS(isec,ipath),
|
||||
TopoDS::Edge(UEdge(isec, ipath)),
|
||||
TopoDS::Edge(VEdge(isec, ipath)),
|
||||
@ -2442,6 +2566,12 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
}
|
||||
}
|
||||
|
||||
// (3.1) Reverse the faces that have been built ealier
|
||||
for (ipath = 1; ipath <= NbPath; ipath++)
|
||||
for (isec = 1; isec <= NbLaw; isec++)
|
||||
if (IsBuilt(isec))
|
||||
myFaces->ChangeValue(isec, ipath).Reverse();
|
||||
|
||||
|
||||
// (4) History and Continuity
|
||||
|
||||
@ -2500,6 +2630,28 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// (5) Update Tapes
|
||||
Standard_Integer j;
|
||||
if (IFirst == 1 && !Tapes.IsEmpty()) //works only in case of single shell
|
||||
{
|
||||
for (isec = 1; isec <= NbLaw; isec++)
|
||||
{
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(1, j, myVEdges->Value(isec, j));
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(2, j, myUEdges->Value(isec, j));
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(3, j, myUEdges->Value(isec+1, j));
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(4, j, Vertex(isec, j));
|
||||
for (j = 1; j <= NbPath+1; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(5, j, Vertex(isec+1, j));
|
||||
for (j = 1; j <= NbPath; j++)
|
||||
Tapes(StartEdges(isec))->SetValue(6, j, myFaces->Value(isec, j));
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@ -2507,11 +2659,13 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
//function : Build
|
||||
//purpose : Construt the result of sweeping
|
||||
//======================================================================
|
||||
void BRepFill_Sweep::Build(const BRepFill_TransitionStyle Transition,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const GeomFill_ApproxStyle Approx,
|
||||
const Standard_Integer Degmax,
|
||||
const Standard_Integer Segmax)
|
||||
void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
|
||||
BRepFill_DataMapOfShapeHArray2OfShape& Tapes,
|
||||
const BRepFill_TransitionStyle Transition,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const GeomFill_ApproxStyle Approx,
|
||||
const Standard_Integer Degmax,
|
||||
const Standard_Integer Segmax)
|
||||
{
|
||||
myContinuity = Continuity;
|
||||
myApproxStyle = Approx;
|
||||
@ -2548,6 +2702,8 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
if (NbTrous==1) Extend = EvalExtrapol(1, Transition);
|
||||
isDone = BuildShell(Transition,
|
||||
1, NbPath+1,
|
||||
ReversedEdges,
|
||||
Tapes,
|
||||
Extend, Extend);
|
||||
}
|
||||
else { // This is done piece by piece
|
||||
@ -2558,6 +2714,8 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
|
||||
else ILast = Trous->Value(ii);
|
||||
isDone = BuildShell(Transition,
|
||||
IFirst, ILast,
|
||||
ReversedEdges,
|
||||
Tapes,
|
||||
EvalExtrapol(IFirst, Transition),
|
||||
EvalExtrapol(ILast, Transition));
|
||||
if (IFirst>1) {
|
||||
@ -3100,3 +3258,105 @@ void BRepFill_Sweep::UpdateVertex(const Standard_Integer ipath,
|
||||
B.UpdateVertex(TheV, Tol);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RebuildTopOrBottomEdge
|
||||
//purpose : Rebuild v-iso edge of top or bottom section
|
||||
// inserting new 3d and 2d curves taken from swept surfaces
|
||||
//======================================================================
|
||||
void BRepFill_Sweep::RebuildTopOrBottomEdge(const TopoDS_Edge& aNewEdge,
|
||||
TopoDS_Edge& anEdge,
|
||||
TopTools_MapOfShape& ReversedEdges) const
|
||||
{
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom_Curve) aNewCurve = BRep_Tool::Curve(aNewEdge, fpar, lpar);
|
||||
TopLoc_Location Identity;
|
||||
|
||||
Standard_Boolean ToReverse = Standard_False;
|
||||
Standard_Boolean IsDegen = BRep_Tool::Degenerated(aNewEdge);
|
||||
if (IsDegen)
|
||||
BRep_Tool::Range(aNewEdge, fpar, lpar);
|
||||
else
|
||||
{
|
||||
TopoDS_Vertex V1, V2, NewV1, NewV2;
|
||||
TopExp::Vertices(anEdge, V1, V2);
|
||||
if (!V1.IsSame(V2))
|
||||
{
|
||||
TopExp::Vertices(aNewEdge, NewV1, NewV2);
|
||||
V1.Location(Identity);
|
||||
if (!V1.IsSame(NewV1))
|
||||
{
|
||||
if (V1.IsSame(NewV2))
|
||||
ToReverse = Standard_True;
|
||||
else
|
||||
{
|
||||
gp_Pnt Pnt1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt NewPnt1 = BRep_Tool::Pnt(NewV1);
|
||||
Standard_Real TolSum = BRep_Tool::Tolerance(V1) + BRep_Tool::Tolerance(NewV1);
|
||||
if (!Pnt1.IsEqual(NewPnt1, TolSum))
|
||||
ToReverse = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real OldFirst, OldLast;
|
||||
Handle(Geom_Curve) OldCurve = BRep_Tool::Curve(anEdge, OldFirst, OldLast);
|
||||
gp_Vec OldD1, NewD1;
|
||||
gp_Pnt MidPnt;
|
||||
OldCurve->D1(0.5*(OldFirst + OldLast), MidPnt, OldD1);
|
||||
aNewCurve->D1(0.5*(fpar + lpar), MidPnt, NewD1);
|
||||
if (OldD1 * NewD1 < 0.)
|
||||
ToReverse = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
anEdge.Location(Identity);
|
||||
const Handle(BRep_TEdge)& TEdge = *((Handle(BRep_TEdge)*) &anEdge.TShape());
|
||||
TEdge->Tolerance(BRep_Tool::Tolerance(aNewEdge));
|
||||
BRep_Builder BB;
|
||||
BB.Range(anEdge, fpar, lpar);
|
||||
BB.UpdateEdge(anEdge, aNewCurve, Precision::Confusion());
|
||||
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &aNewEdge.TShape());
|
||||
const BRep_ListOfCurveRepresentation& lcr = TE->Curves();
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itrep(lcr);
|
||||
for (; itrep.More(); itrep.Next())
|
||||
{
|
||||
const Handle(BRep_CurveRepresentation)& CurveRep = itrep.Value();
|
||||
if (CurveRep->IsCurveOnSurface())
|
||||
{
|
||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&CurveRep);
|
||||
Handle(Geom2d_Curve) aPCurve = GC->PCurve();
|
||||
Handle(Geom_Surface) aSurf = GC->Surface();
|
||||
TopLoc_Location aLoc = aNewEdge.Location() * GC->Location();
|
||||
BB.UpdateEdge(anEdge, aPCurve, aSurf, aLoc, Precision::Confusion());
|
||||
}
|
||||
}
|
||||
|
||||
anEdge.Free(Standard_True);
|
||||
TopoDS_Vertex V1, V2;
|
||||
TopExp::Vertices(anEdge, V1, V2);
|
||||
|
||||
TopoDS_Shape anEdgeFORWARD = anEdge.Oriented(TopAbs_FORWARD);
|
||||
|
||||
BB.Remove(anEdgeFORWARD, V1);
|
||||
BB.Remove(anEdgeFORWARD, V2);
|
||||
|
||||
V1.Location(Identity);
|
||||
V2.Location(Identity);
|
||||
if (ToReverse)
|
||||
{
|
||||
V2.Orientation(TopAbs_FORWARD);
|
||||
V1.Orientation(TopAbs_REVERSED);
|
||||
}
|
||||
BB.Add(anEdgeFORWARD, V1);
|
||||
BB.Add(anEdgeFORWARD, V2);
|
||||
|
||||
if (ToReverse)
|
||||
{
|
||||
anEdge.Reverse();
|
||||
ReversedEdges.Add(anEdge);
|
||||
}
|
||||
|
||||
BB.Degenerated(anEdge, IsDegen);
|
||||
}
|
||||
|
@ -212,12 +212,28 @@ is
|
||||
-- - boundary tolerance BoundTol
|
||||
-- - 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;
|
||||
ForceApproxC1 : Boolean from Standard);
|
||||
---Purpose: Set the flag that indicates attempt to approximate
|
||||
-- a C1-continuous surface if a swept surface proved
|
||||
-- to be C0.
|
||||
|
||||
|
||||
|
||||
SetTransitionMode(me : in out;
|
||||
Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed)
|
||||
---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);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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
|
||||
//purpose : Set the flag that indicates attempt to approximate
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepTools_TrsfModification
|
||||
@ -147,6 +148,9 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve2d
|
||||
Standard_Real scale = myTrsf.ScaleFactor();
|
||||
Tol *= Abs(scale);
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,loc);
|
||||
GeomAdaptor_Surface GAsurf(S);
|
||||
if (GAsurf.GetType() == GeomAbs_Plane)
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real f,l;
|
||||
Handle(Geom2d_Curve) NewC = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||
|
@ -317,8 +317,8 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
|
||||
delta = (BC->Knot(i+1) - t) / NbLocalPnts;
|
||||
for (j = 0; j < NbLocalPnts; j++)
|
||||
{
|
||||
t += delta;
|
||||
Pnts->SetValue( nb++, myAdpSection.Value(t) );
|
||||
t += delta;
|
||||
}
|
||||
}
|
||||
if (I3 != I4 && first < BC->Knot(I3))
|
||||
@ -327,8 +327,8 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
|
||||
delta = (last - t) / NbLocalPnts;
|
||||
for (j = 0; j < NbLocalPnts; j++)
|
||||
{
|
||||
t += delta;
|
||||
Pnts->SetValue( nb++, myAdpSection.Value(t) );
|
||||
t += delta;
|
||||
}
|
||||
}
|
||||
if (!myAdpSection.IsClosed())
|
||||
|
@ -1 +0,0 @@
|
||||
IntTools_EdgeEdge_1.cxx
|
@ -87,10 +87,6 @@ is
|
||||
---Purpose: class provides computing ranges of parameters
|
||||
--- of edge/face intersection.
|
||||
|
||||
class BeanBeanIntersector;
|
||||
---Purpose: class provides computing ranges of parameters
|
||||
--- of edge/edge intersection.
|
||||
|
||||
-----
|
||||
class Curve;
|
||||
---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: Peter KURNEV
|
||||
-- Copyright (c) 2000-2014 OPEN CASCADE SAS
|
||||
-- Created by: Eugeny MALTCHIKOV
|
||||
-- Copyright (c) 2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
@ -14,298 +13,221 @@
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
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
|
||||
Edge from TopoDS,
|
||||
Curve from BRepAdaptor,
|
||||
SequenceOfRoots from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
CArray1OfReal from IntTools,
|
||||
CommonPrt from IntTools,
|
||||
SequenceOfCommonPrts from IntTools,
|
||||
Range from IntTools
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns EdgeEdge from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
SetEdge1 (me:out;
|
||||
anEdge:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the first edge
|
||||
---
|
||||
|
||||
SetTolerance1 (me:out;
|
||||
aTolEdge1:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of tolerance pipe for the first edge
|
||||
---
|
||||
uses
|
||||
Real from Standard,
|
||||
Box from Bnd,
|
||||
Range from IntTools,
|
||||
Edge from TopoDS,
|
||||
Curve from Geom,
|
||||
Curve from BRepAdaptor,
|
||||
ShapeEnum from TopAbs,
|
||||
SequenceOfRanges from IntTools,
|
||||
SequenceOfCommonPrts from IntTools
|
||||
|
||||
SetEdge2 (me:out;
|
||||
anEdge:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the second edge
|
||||
---
|
||||
is
|
||||
|
||||
Create
|
||||
returns EdgeEdge from IntTools;
|
||||
---C++: alias "~IntTools_EdgeEdge();"
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Empty contructor
|
||||
|
||||
SetTolerance2 (me:out;
|
||||
aTolEdge2:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of tolerance pipe for the first edge
|
||||
---
|
||||
|
||||
SetDiscretize (me:out;
|
||||
aDiscret:Integer from Standard);
|
||||
---Purpose:
|
||||
--- Sets the number of division for the shortest
|
||||
--- edge among the two. The deflection is not taken
|
||||
--- into account
|
||||
---
|
||||
|
||||
SetDeflection (me:out;
|
||||
aDeflection:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of maximum reative deflection between
|
||||
--- the two nearest points on a curve.
|
||||
---
|
||||
|
||||
SetEpsilonT (me:out;
|
||||
anEpsT:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the criteria of equality of two arguments,
|
||||
--- i.e. |t2-t1|<anEpsT will mean that t2=t1
|
||||
---
|
||||
|
||||
SetEpsilonNull (me:out;
|
||||
anEpsNull:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the criteria of equality of two functions' values
|
||||
--- i.e. |f(t2)-f(t1)|<anEpsNull will mean that f(t2)=f(t1)
|
||||
---
|
||||
|
||||
SetRange1 (me:out;
|
||||
aRange:Range from IntTools);
|
||||
|
||||
SetRange2 (me:out;
|
||||
aRange:Range from IntTools);
|
||||
|
||||
SetRange1 (me:out;
|
||||
aFirst, aLast:Real from Standard);
|
||||
|
||||
SetRange2 (me:out;
|
||||
aFirst, aLast:Real from Standard);
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose:
|
||||
--- The main method of the algorithm to determine
|
||||
--- 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;
|
||||
|
||||
Create (
|
||||
theEdge1 : Edge from TopoDS;
|
||||
theEdge2 : Edge from TopoDS)
|
||||
returns EdgeEdge from IntTools;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Contructor
|
||||
|
||||
ComputeLineLine(me:out)
|
||||
is protected;
|
||||
|
||||
--modified by NIZNHY-PKV Mon Oct 31 12:16:55 2011f
|
||||
IsSameCurves(me:out)
|
||||
returns Boolean from Standard
|
||||
is protected;
|
||||
--modified by NIZNHY-PKV Mon Oct 31 12:16:59 2011t
|
||||
|
||||
fields
|
||||
-- Data
|
||||
myEdge1 : Edge from TopoDS;
|
||||
myEdge2 : Edge from TopoDS;
|
||||
myTol1 : Real from Standard;
|
||||
myTol2 : Real from Standard;
|
||||
|
||||
myDiscret : Integer from Standard;
|
||||
|
||||
myEpsT : Real from Standard;
|
||||
myEpsNull : Real from Standard;
|
||||
myDeflection : Real from Standard;
|
||||
|
||||
-- data curves
|
||||
myCFrom : Curve from BRepAdaptor;
|
||||
myTminFrom : Real from Standard;
|
||||
myTmaxFrom : Real from Standard;
|
||||
myTolFrom : Real from Standard;
|
||||
Create (
|
||||
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:
|
||||
-- Contructor
|
||||
|
||||
SetEdge1(me:out;
|
||||
theEdge : Edge from TopoDS);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the first edge
|
||||
|
||||
SetEdge1(me:out;
|
||||
theEdge : Edge from TopoDS;
|
||||
aT1, aT2 : Real from Standard);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the first edge and its range
|
||||
|
||||
SetRange1(me:out;
|
||||
theRange1 : Range from IntTools);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the range for the first edge
|
||||
|
||||
SetRange1(me:out;
|
||||
aT1, aT2 : Real from Standard);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the range for the first edge
|
||||
|
||||
SetEdge2(me:out;
|
||||
theEdge : Edge from TopoDS);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the second edge
|
||||
|
||||
myCTo : Curve from BRepAdaptor;
|
||||
myTminTo : Real from Standard;
|
||||
myTmaxTo : Real from Standard;
|
||||
myTolTo : Real from Standard;
|
||||
|
||||
myCriteria : Real from Standard;
|
||||
SetEdge2(me:out;
|
||||
theEdge : Edge from TopoDS;
|
||||
aT1, aT2 : Real from Standard);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the first edge and its range
|
||||
|
||||
SetRange2(me:out;
|
||||
theRange : Range from IntTools);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the range for the second edge
|
||||
|
||||
SetRange2(me:out;
|
||||
aT1, aT2 : Real from Standard);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the range for the second edge
|
||||
|
||||
myIsDone : Boolean from Standard;
|
||||
myErrorStatus : Integer from Standard;
|
||||
CheckData(me:out)
|
||||
is protected;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Checks the data
|
||||
|
||||
--- internal members
|
||||
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;
|
||||
Prepare(me:out)
|
||||
is protected;
|
||||
---Purpose:
|
||||
-- Prepares the data
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose:
|
||||
-- Performs the intersection between edges
|
||||
|
||||
ComputeLineLine(me:out)
|
||||
is protected;
|
||||
---Purpose:
|
||||
-- Computes Line/Line intersection.
|
||||
|
||||
FindRoughRanges(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
|
||||
is protected;
|
||||
---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
|
||||
-- source data
|
||||
myEdge1 : Edge from TopoDS is protected;
|
||||
myEdge2 : Edge from TopoDS is protected;
|
||||
|
||||
myGeom1 : Curve from Geom is protected;
|
||||
myGeom2 : Curve from Geom is protected;
|
||||
|
||||
myCurve1 : Curve from BRepAdaptor is protected;
|
||||
myCurve2 : Curve from BRepAdaptor is protected;
|
||||
|
||||
myTol1 : Real from Standard is protected;
|
||||
myTol2 : Real from Standard is protected;
|
||||
myTol : Real from Standard is protected;
|
||||
|
||||
myRes1 : Real from Standard is protected;
|
||||
myRes2 : Real from Standard is protected;
|
||||
|
||||
myRange1 : Range from IntTools is protected;
|
||||
myRange2 : Range from IntTools is protected;
|
||||
|
||||
-- results
|
||||
mySwap : Boolean from Standard is protected;
|
||||
myErrorStatus : Integer from Standard is protected;
|
||||
myCommonParts : SequenceOfCommonPrts from IntTools is protected;
|
||||
|
||||
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,918 +0,0 @@
|
||||
// Created on: 2014-11-29
|
||||
// Created by: Peter KURNEV
|
||||
// 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 <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_Integer iErr;
|
||||
Standard_Real aA, aB, aCf, aX1, aX2, aF1, aF2, aX, aF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
iErr=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
|
||||
static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
||||
const TopoDS_Shape aShape,
|
||||
Standard_Integer& anIndex)
|
||||
Standard_Integer& anIndex,
|
||||
Handle(ShapeBuild_ReShape)& aContext)
|
||||
{
|
||||
//map of edges
|
||||
TopTools_IndexedMapOfShape aNewEdges;
|
||||
@ -122,6 +123,7 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
||||
aNewEdges.Substitute(aNewEdges.FindIndex(current), LastEdge);
|
||||
/////////////////////////
|
||||
edges.Remove(i);
|
||||
aContext->Remove(current);
|
||||
i--;
|
||||
|
||||
if(!isDropped) {
|
||||
@ -838,7 +840,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
|
||||
Standard_Integer dummy;
|
||||
TopTools_SequenceOfShape edges;
|
||||
AddOrdinaryEdges(edges,aFace,dummy);
|
||||
AddOrdinaryEdges(edges, aFace, dummy, myContext);
|
||||
|
||||
TopTools_SequenceOfShape faces;
|
||||
faces.Append(aFace);
|
||||
@ -878,7 +880,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
|
||||
MovePCurves(aMockUpFace,anCheckedFace);
|
||||
|
||||
if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
|
||||
if (AddOrdinaryEdges(edges, aMockUpFace, dummy, myContext)) {
|
||||
// sequence edges is modified
|
||||
i = dummy;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user