/adm/lin
/adm/mac
/adm/make
-/adm/cmake
*.vcproj*user
+*.vcxproj*user
*.csproj*user
*.ncb
*.suo
# Emacs backup files
*~
-#Generated files
+# Generated files
/*.am
/*.m4
/*.ac
/*.sh
-/*.bat
+/custom.bat
/autom4te.cache
/build_configure
/configure
/Makefile
/libtool
/stamp*
+/build*
+/install
* There are two groups of arguments in BOA:
* Objects <i>(S1=S11, S12, ...)</i>;
* Tools <i>(S2=S21, S22, ...)</i>.
-* All arguments in a group should have the same dimension (see the Table).
+* The following table contains the values of dimension for different types of arguments:
| No | Type of Argument | Index of Type | Dimension |
| :---- | :---- | :----- | :---- |
| 7 | EDGE | 6 | 1 |
| 8 | VERTEX | 7 | 0 |
-* For Boolean operation Fuse the arguments should have equal dimensions.
-* For Boolean operation Cut the dimension of *S2* should not be less then the dimension of *S1*.
+* For Boolean operation Fuse all arguments should have equal dimensions.
+* For Boolean operation Cut the minimal dimension of *S2* should not be less than the maximal dimension of *S1*.
+* For Boolean operation Common the arguments could have any dimension.
@subsection occt_algorithms_9_3 Results. General Rules
* The content of the result depends on the type of the operation (Common, Fuse, Cut12, Cut21) and the dimensions of the arguments.
* The result of the operation Fuse is defined for arguments *S1* and *S2* that have the same dimension value : *Dim(S1)=Dim(S2)*. If the arguments have different dimension values the result of the operation Fuse is not defined. The dimension of the result is equal to the dimension of the arguments. For example, it is impossible to fuse an edge and a face.
* The result of the operation Fuse for arguments *S1* and *S2* contains the parts of arguments that have states **OUT** relative to the opposite arguments.
-* The result of the operations Fuse, Common, Cut12, Cut21 for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
-* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The dimension of the result is equal to the lower dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
+* The result of the operation Fuse for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
+* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
* The result of the operation Common for the arguments *S1* and *S2* contains the parts of the argument that have states **IN** and **ON** relative to the opposite argument.
-* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The dimension of the result is equal to *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
+* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain the shapes of different dimension, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
* The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
* The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
+* For the argumenst of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be compound containing Wire.
@subsection occt_algorithms_9_4 Examples
@figure{/user_guides/boolean_operations/images/boolean_image070.png}
+@subsubsection occt_algorithms_9_4_23 Case 23: A Shell and a Wire cut by a Solid.
+
+Let us consider Shell *Sh* and Wire *W* as the objects and Solid *S* as the tool:
+
+@figure{/user_guides/boolean_operations/images/boolean_image136.png}
+
+* The result of *Fuse* operation is not defined as the dimension of the arguments is not the same.
+
+* The result of *Common* operation is a compound containing the parts of the initial Shell and Wire common for the Solid. The new Shell and Wire are created from the objects.
+
+@figure{/user_guides/boolean_operations/images/boolean_image137.png}
+
+* The result of *Cut12* operation is a compound containing the parts of the initial Shell and Wire out of the Solid. The new Shell and Wire are created from the objects.
+
+@figure{/user_guides/boolean_operations/images/boolean_image138.png}
+
+* The result of *Cut21* operation is not defined as the objects have lower dimension than the tool.
+
@subsection occt_algorithms_9_5 Class BOPAlgo_BOP
| No | Contents | Implementation |
| :---- | :---- | :------ |
-| 1 | For the Type of the Boolean operation Common, Cut and *myDim[0] < 3* | |
-| 1.1 | Compute minimal dimension *Dmin = min(myDim[0], myDim[1])* | *BOPAlgo_BOP:: BuildShape()* |
-| 1.2 | Make connexity blocks from sub-shapes of *myRS*, taking into account the value of *Dmin* | *BOPTools_Tools::MakeConnexityBlocks()* |
+| 1 | For the Type of the Boolean operation Common, Cut with any dimension and operation Fuse with *myDim[0] < 3* | |
+| 1.1 | Find containers (WIRE, SHELL, COMPSOLID) in the arguments | *BOPAlgo_BOP:: BuildShape()* |
+| 1.2 | Make connexity blocks from splits of each container that are in *myRC* | *BOPTools_Tools::MakeConnexityBlocks()* |
| 1.3 | Build the result from shapes made from the connexity blocks | *BOPAlgo_BOP:: BuildShape()* |
-| 2 | For the Type of the Boolean operation Common, Cut and *myDim[0] = 3* | |
-| 2.1 | *myShape = myRC* | BOPAlgo_BOP::BuildShape () |
-| 3 | For the Type of the Boolean operation Fuse and *myDim[0] = 3* | |
-| 3.1 | Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
-| 3.2 | Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
-| 3.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
-| 3.4 | Add the solids <i>(SDi)</i> to the result | |
+| 1.4 | Add the remaining shapes from *myRC* to the result | *BOPAlgo_BOP:: BuildShape()* |
+| 2 | For the Type of the Boolean operation Fuse with *myDim[0] = 3* | |
+| 2.1 | Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
+| 2.2 | Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
+| 2.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
+| 2.4 | Add the solids <i>(SDi)</i> to the result | |
@section occt_algorithms_10a Section Algorithm
explode r Sh
renamevar r_1 r
explode r e
-wire w r_4 r_1 r_7 r_8 r_9 r_10 r_11 r_12 r_13 r_14 r_22 r_23 r_24 r_25 r_19 r_20 r_21 r_26 r_35 r_31 r_32 r_33 r_34 r_36 r_37
+wire w r_4 r_1 r_20 r_21 r_22 r_23 r_24 r_25 r_26 r_7 r_30 r_31 r_32 r_33 r_27 r_28 r_29 r_11 r_38 r_34 r_35 r_36 r_37 r_16 r_17
tcopy w w1
tmirror w1 -6 0 0 0 1 0
wire w w w1
---Purpose: Adds Tool argument of the operation
is virtual;
- SetTools (me:out;
- theShapes: ListOfShape from TopTools)
- is virtual;
-
SetTools (me:out;
theShapes: ListOfShape from BOPCol)
is virtual;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BOPAlgo_BOP.ixx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRep_Builder.hxx>
-#include <TopExp_Explorer.hxx>
+#include <BOPAlgo_BOP.hxx>
+#include <BOPAlgo_BuilderSolid.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPCol_DataMapOfShapeShape.hxx>
+#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
-#include <BOPCol_IndexedMapOfShape.hxx>
-#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
-#include <BOPCol_DataMapOfShapeShape.hxx>
-
#include <BOPDS_DS.hxx>
-
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
-#include <BOPTools_AlgoTools.hxx>
-
-#include <BOPAlgo_BuilderSolid.hxx>
-
-#include <BRep_Tool.hxx>
-//
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
#include <NCollection_DataMap.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
typedef NCollection_IndexedDataMap
//
static
TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
+//
+static
+ void CollectContainers(const TopoDS_Shape& theS,
+ BOPCol_ListOfShape& theLSC);
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
-void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theShapes)
-{
- TopTools_ListIteratorOfListOfShape aIt;
- //
- myTools.Clear();
- aIt.Initialize(theShapes);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS = aIt.Value();
- AddTool(aS);
- }
-}
-//=======================================================================
-//function : SetTools
-//purpose :
-//=======================================================================
void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
void BOPAlgo_BOP::CheckData()
{
Standard_Integer i, j, iDim, aNbArgs, aNbTools;
- Standard_Boolean bFlag;
+ Standard_Boolean bFlag, bFuse;
BOPCol_ListIteratorOfListOfShape aItLS;
//
myErrorStatus=0;
return;
}
//
- // myDims
- myDims[0]=-1;
- myDims[1]=-1;
+ bFuse = (myOperation == BOPAlgo_FUSE);
+ //
+ // The rules for different types of operations are the following:
+ // 1. FUSE: All arguments and tools should have the same dimension;
+ // 2. CUT: The MAXIMAL dimension of the ARGUMENTS should be less
+ // or equal to the MINIMAL dimension of the TOOLS;
+ // 3. CUT21: The MINIMAL dimension of ARGUMENTS should be grater
+ // or equal to the MAXIMAL dimension of the TOOLS;
+ // 4. COMMON: The arguments and tools could have any dimensions.
+ //
+ Standard_Integer iDimMin[2], iDimMax[2];
+ //
for (i=0; i<2; ++i) {
const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
aItLS.Initialize(aLS);
}
//
if (!j) {
- myDims[i]=iDim;
+ iDimMin[i] = iDim;
+ iDimMax[i] = iDim;
continue;
}
//
- if (iDim!=myDims[i]) {
+ if (iDim < iDimMin[i]) {
+ iDimMin[i] = iDim;
+ }
+ else if (iDim > iDimMax[i]) {
+ iDimMax[i] = iDim;
+ }
+ //
+ if (bFuse && (iDimMin[i] != iDimMax[i])) {
// non-homogenious argument
myErrorStatus=13;
return;
}
}
//
- if (myDims[0]<myDims[1]) {
- if (myOperation==BOPAlgo_FUSE ||
- myOperation==BOPAlgo_CUT21) {
- // non-licit operation for the arguments
- myErrorStatus=14;
- return;
- }
- }
- else if (myDims[0]>myDims[1]) {
- if (myOperation==BOPAlgo_FUSE ||
- myOperation==BOPAlgo_CUT) {
- // non-licit operation for the arguments
- myErrorStatus=14;
- return;
- }
+ if (((myOperation == BOPAlgo_FUSE) && (iDimMax[0] != iDimMax[1])) ||
+ ((myOperation == BOPAlgo_CUT) && (iDimMax[0] > iDimMin[1])) ||
+ ((myOperation == BOPAlgo_CUT21) && (iDimMin[0] < iDimMax[1])) ) {
+ // non-licit operation for the arguments
+ myErrorStatus=14;
+ return;
}
+ //
+ myDims[0] = iDimMin[0];
+ myDims[1] = iDimMin[1];
}
//=======================================================================
//function : Prepare
//=======================================================================
void BOPAlgo_BOP::BuildRC()
{
- Standard_Boolean bFlag1, bFlag2, bIsBound;
- Standard_Integer aDmin;
- TopAbs_ShapeEnum aTmin;
+ TopAbs_ShapeEnum aType;
TopoDS_Compound aC;
- TopoDS_Shape aSAIm, aSTIm;
BRep_Builder aBB;
- TopExp_Explorer aExp;
- BOPCol_DataMapOfShapeShape aDMSSA;
- BOPCol_ListIteratorOfListOfShape aItLS, aItIm;
- Standard_Boolean bHasInterf;
- Standard_Integer iX;
- BOPTools_IndexedDataMapOfSetShape aDMSTS;
//
- myErrorStatus=0;
+ myErrorStatus = 0;
//
aBB.MakeCompound(aC);
//
// A. Fuse
- if (myOperation==BOPAlgo_FUSE) {
- aTmin=TypeToExplore(myDims[0]);
- aExp.Init(myShape, aTmin);
+ if (myOperation == BOPAlgo_FUSE) {
+ BOPCol_MapOfShape aMFence;
+ aType = TypeToExplore(myDims[0]);
+ TopExp_Explorer aExp(myShape, aType);
for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape& aS=aExp.Current();
- aBB.Add(aC, aS);
+ const TopoDS_Shape& aS = aExp.Current();
+ if (aMFence.Add(aS)) {
+ aBB.Add(aC, aS);
+ }
}
- myRC=aC;
+ myRC = aC;
return;
- }
- //
- aDmin=myDims[1];
- if (myDims[0] < myDims[1]) {
- aDmin=myDims[0];
}
- aTmin=TypeToExplore(aDmin);
//
// B. Common, Cut, Cut21
//
- bFlag1=(myOperation==BOPAlgo_COMMON || myOperation==BOPAlgo_CUT21);
- bFlag2=(myOperation==BOPAlgo_CUT || myOperation==BOPAlgo_CUT21);
+ Standard_Integer i, j, aNb, iDim;
+ Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
+ BOPCol_IndexedMapOfShape aMArgs, aMTools;
+ BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
+ BOPCol_ListIteratorOfListOfShape aItLS;
//
- const BOPCol_ListOfShape& aLA=( bFlag1) ? myArguments : myTools;
- aItLS.Initialize(aLA);
- for (; aItLS.More(); aItLS.Next()) {
- const TopoDS_Shape& aSA=aItLS.Value();
+ for (i = 0; i < 2; ++i) {
+ const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
+ BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
+ aItLS.Initialize(aLS);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aS = aItLS.Value();
+ iDim = BOPTools_AlgoTools::Dimension(aS);
+ aType = TypeToExplore(iDim);
+ BOPTools::MapShapes(aS, aType, aMS);
+ }
+ }
+ //
+ bCheckEdges = Standard_False;
+ //
+ for (i = 0; i < 2; ++i) {
+ const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
+ BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
//
- if (myImages.IsBound(aSA)){
- const BOPCol_ListOfShape& aLSAIm=myImages.Find(aSA);
- aItIm.Initialize(aLSAIm);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Shape& aSAIm=aItIm.Value();
- aExp.Init(aSAIm, aTmin);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape aSIm=aExp.Current();
- aDMSSA.Bind(aSIm, aSIm);
+ aNb = aMS.Extent();
+ for (j = 1; j <= aNb; ++j) {
+ const TopoDS_Shape& aS = aMS(j);
+ aType = aS.ShapeType();
+ if (aType == TopAbs_EDGE) {
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
+ bCheckEdges = Standard_True;
+ if (BRep_Tool::Degenerated(aE)) {
+ continue;
}
}
- }
- //
- else {
- aExp.Init(aSA, aTmin);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape aSIm=aExp.Current();
- aDMSSA.Bind(aSIm, aSIm);
- if (aTmin==TopAbs_SOLID) {
- iX=myDS->Index(aSIm);
- bHasInterf=myDS->HasInterf(iX);
- if (!bHasInterf) {
- BOPTools_Set aST;
- //
- aST.Add(aSIm, TopAbs_FACE);
- //
- aDMSTS.Add(aST, aSIm);
- }
+ //
+ if (myImages.IsBound(aS)) {
+ const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
+ aItLS.Initialize(aLSIm);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSIm = aItLS.Value();
+ aMSIm.Add(aSIm);
}
}
+ else {
+ aMSIm.Add(aS);
+ }
}
- } //for (; aItLS.More(); aItLS.Next())
+ }
//
- const BOPCol_ListOfShape& aLT=(!bFlag1) ? myArguments : myTools;
- aItLS.Initialize(aLT);
- for (; aItLS.More(); aItLS.Next()) {
- const TopoDS_Shape& aST=aItLS.Value();
- if (myImages.IsBound(aST)){
- const BOPCol_ListOfShape& aLSTIm=myImages.Find(aST);
- aItIm.Initialize(aLSTIm);
- for (; aItIm.More(); aItIm.Next()) {
- const TopoDS_Shape& aSTIm=aItIm.Value();
- aExp.Init(aSTIm, aTmin);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape aSIm=aExp.Current();
- // skip degenerated edges
- if (aTmin==TopAbs_EDGE) {
- const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
- if (BRep_Tool::Degenerated(aEIm)) {
- continue;
- }
- }
- //
- bIsBound=aDMSSA.IsBound(aSIm);
- if (!bFlag2) { // ie common
- if (bIsBound) {
- const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
- aBB.Add(aC, aSImA);
- }
- }
- else {// ie cut or cut21
- if (!bIsBound) {
- aBB.Add(aC, aSIm);
- }
- }
- }
+ // compare the maps and make the result
+ //
+ Standard_Integer iDimMin, iDimMax;
+ //
+ iDimMin = Min(myDims[0], myDims[1]);
+ bCommon = (myOperation == BOPAlgo_COMMON);
+ bCut21 = (myOperation == BOPAlgo_CUT21);
+ //
+ const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
+ const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
+ //
+ BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
+ //
+ if (bCommon) {
+ aNb = aMIt.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ const TopoDS_Shape& aS = aMIt(i);
+ iDimMax = BOPTools_AlgoTools::Dimension(aS);
+ for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
+ aType = TypeToExplore(iDim);
+ BOPTools::MapShapes(aS, aType, aMItExp);
}
- }// if (myImages.IsBound(aST)){
+ aMItExp.Add(aS);
+ }
+ }
+ else {
+ aMItExp = aMIt;
+ }
+ //
+ aNb = aMCheck.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ const TopoDS_Shape& aS = aMCheck(i);
+ iDimMax = BOPTools_AlgoTools::Dimension(aS);
+ for (iDim = iDimMin; iDim < iDimMax; ++iDim) {
+ aType = TypeToExplore(iDim);
+ BOPTools::MapShapes(aS, aType, aMCheckExp);
+ }
+ aMCheckExp.Add(aS);
+ }
+ //
+ aNb = aMItExp.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ const TopoDS_Shape& aS = aMItExp(i);
+ //
+ bContains = aMCheckExp.Contains(aS);
+ if (bCommon) {
+ if (bContains) {
+ aBB.Add(aC, aS);
+ }
+ }
else {
- aExp.Init(aST, aTmin);
+ if (!bContains) {
+ aBB.Add(aC, aS);
+ }
+ }
+ }
+ //
+ // filter result for COMMON operation
+ if (bCommon) {
+ BOPCol_MapOfShape aMFence;
+ TopExp_Explorer aExp;
+ TopoDS_Compound aCx;
+ aBB.MakeCompound(aCx);
+ //
+ for (iDim = 3; iDim >= iDimMin; --iDim) {
+ aType = TypeToExplore(iDim);
+ aExp.Init(aC, aType);
for (; aExp.More(); aExp.Next()) {
- const TopoDS_Shape aSIm=aExp.Current();
- // skip degenerated edges
- if (aTmin==TopAbs_EDGE) {
- const TopoDS_Edge& aEIm=*((TopoDS_Edge*)&aSIm);
- if (BRep_Tool::Degenerated(aEIm)) {
- continue;
- }
- }
- bIsBound=aDMSSA.IsBound(aSIm);
- if (!bFlag2) { // ie common
- if (bIsBound) {
- const TopoDS_Shape& aSImA=aDMSSA.Find(aSIm);
- aBB.Add(aC, aSImA);
- }
- else {
- if (aTmin==TopAbs_SOLID) {
- BOPTools_Set aST;
- //
- aST.Add(aSIm, TopAbs_FACE);
- //
- if (aDMSTS.Contains(aST)) {
- const TopoDS_Shape& aSImA=aDMSTS.FindFromKey(aST);
- aBB.Add(aC, aSImA);
- }
- }
- }
- }
- else {// ie cut or cut21
- if (!bIsBound) {
- if (aTmin==TopAbs_SOLID) {
- BOPTools_Set aST;
- //
- aST.Add(aSIm, TopAbs_FACE);
- //
- bIsBound=aDMSTS.Contains(aST);
- }
- //
- if (!bIsBound) {
- aBB.Add(aC, aSIm);
- }
- }
+ const TopoDS_Shape& aS = aExp.Current();
+ if (aMFence.Add(aS)) {
+ aBB.Add(aCx, aS);
+ BOPTools::MapShapes(aS, aMFence);
}
}
}
- } //for (; aItLS.More(); aItLS.Next())
+ aC = aCx;
+ }
//
- // the squats around degeneracy
- if (aTmin!=TopAbs_EDGE) {
- myRC=aC;
+ if (!bCheckEdges) {
+ myRC = aC;
return;
}
- //---------------------------------------------------------
//
// The squats around degenerated edges
- Standard_Integer i, aNbS, nVD;
- TopAbs_ShapeEnum aType;
+ Standard_Integer nVD;
BOPCol_IndexedMapOfShape aMVC;
//
// 1. Vertices of aC
BOPTools::MapShapes(aC, TopAbs_VERTEX, aMVC);
//
// 2. DE candidates
- aNbS=myDS->NbSourceShapes();
- for (i=0; i<aNbS; ++i) {
- const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
- aType=aSI.ShapeType();
- if (aType!=aTmin) {
+ aNb = myDS->NbSourceShapes();
+ for (i = 0; i < aNb; ++i) {
+ const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+ aType = aSI.ShapeType();
+ if (aType != TopAbs_EDGE) {
continue;
}
//
- const TopoDS_Edge& aE=*((TopoDS_Edge*)&aSI.Shape());
+ const TopoDS_Edge& aE = *((TopoDS_Edge*)&aSI.Shape());
if (!BRep_Tool::Degenerated(aE)) {
continue;
}
//
- nVD=aSI.SubShapes().First();
- const TopoDS_Shape& aVD=myDS->Shape(nVD);
+ nVD = aSI.SubShapes().First();
+ const TopoDS_Shape& aVD = myDS->Shape(nVD);
//
if (!aMVC.Contains(aVD)) {
continue;
//=======================================================================
void BOPAlgo_BOP::BuildShape()
{
- Standard_Integer aDmin, aNbLCB;
- TopAbs_ShapeEnum aT1, aT2, aTR;
- TopoDS_Shape aR, aRC;
+ BuildRC();
+ //
+ if ((myOperation == BOPAlgo_FUSE) && (myDims[0] == 3)) {
+ BuildSolid();
+ return;
+ }
+ //
+ Standard_Integer i;
+ TopAbs_ShapeEnum aType, aT1, aT2;
+ BOPCol_ListOfShape aLSC, aLCB;
+ BOPCol_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
TopoDS_Iterator aIt;
BRep_Builder aBB;
- BOPCol_ListOfShape aLCB;
- BOPCol_ListIteratorOfListOfShape aItLCB;
- //
- myErrorStatus=0;
+ TopoDS_Shape aRC, aRCB;
//
- BuildRC();
+ TopoDS_Compound aResult;
+ aBB.MakeCompound(aResult);
//
- aDmin=myDims[1];
- if (myDims[0]<myDims[1]) {
- aDmin=myDims[0];
- }
+ BOPCol_MapOfShape aMSRC, aMFence;
+ BOPTools::MapShapes(myRC, aMSRC);
//
- if (!aDmin) {
- myShape=myRC;
- return;
+ // collect images of containers
+ for (i = 0; i < 2; ++i) {
+ const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
+ //
+ aItLS.Initialize(aLS);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aS = aItLS.Value();
+ //
+ CollectContainers(aS, aLSC);
+ }
}
- //
- else if (aDmin==1 || aDmin==2) { //edges, faces
- aT1=TopAbs_VERTEX;
- aT2=TopAbs_EDGE;
- aTR=TopAbs_WIRE;
- if (aDmin==2) {
- aT1=TopAbs_EDGE;
- aT2=TopAbs_FACE;
- aTR=TopAbs_SHELL;
+ // make containers
+ aItLS.Initialize(aLSC);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSC = aItLS.Value();
+ //
+ BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+ //
+ aIt.Initialize(aSC);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ if (myImages.IsBound(aS)) {
+ const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
+ //
+ aItLSIm.Initialize(aLSIm);
+ for (; aItLSIm.More(); aItLSIm.Next()) {
+ const TopoDS_Shape& aSIm = aItLSIm.Value();
+ if (aMSRC.Contains(aSIm) && aMFence.Add(aSIm)) {
+ aBB.Add(aRC, aSIm);
+ }
+ }
+ }
+ else if (aMSRC.Contains(aS) && aMFence.Add(aS)) {
+ aBB.Add(aRC, aS);
+ }
}
//
- BOPTools_AlgoTools::MakeConnexityBlocks
- (myRC, aT1, aT2, aLCB);
- aNbLCB=aLCB.Extent();
- if (!aNbLCB) {
- myShape=myRC;
- return;
+ aType = aSC.ShapeType();
+ switch (aType) {
+ case TopAbs_WIRE: {
+ aT1 = TopAbs_VERTEX;
+ aT2 = TopAbs_EDGE;
+ break;
+ }
+ case TopAbs_SHELL: {
+ aT1 = TopAbs_EDGE;
+ aT2 = TopAbs_FACE;
+ break;
+ }
+ default: {
+ aT1 = TopAbs_FACE;
+ aT2 = TopAbs_SOLID;
+ }
}
//
- BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+ aLCB.Clear();
+ BOPTools_AlgoTools::MakeConnexityBlocks(aRC, aT1, aT2, aLCB);
+ if (aLCB.IsEmpty()) {
+ continue;
+ }
//
aItLCB.Initialize(aLCB);
for (; aItLCB.More(); aItLCB.Next()) {
- BOPTools_AlgoTools::MakeContainer(aTR, aR);
+ BOPTools_AlgoTools::MakeContainer(aType, aRCB);
//
- const TopoDS_Shape& aCB=aItLCB.Value();
+ const TopoDS_Shape& aCB = aItLCB.Value();
aIt.Initialize(aCB);
for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS=aIt.Value();
- aBB.Add(aR, aS);
+ const TopoDS_Shape& aCBS = aIt.Value();
+ aBB.Add(aRCB, aCBS);
}
//
- if (aTR==TopAbs_SHELL) {
- BOPTools_AlgoTools::OrientFacesOnShell(aR);
+ if (aType == TopAbs_SHELL) {
+ BOPTools_AlgoTools::OrientFacesOnShell(aRCB);
}
//
- aBB.Add(aRC, aR);
+ aBB.Add(aResult, aRCB);
}
- myShape=aRC;
- }// elase if (aDmin==1 || aDmin==2) {
-
- else {//aDmin=3
- Standard_Integer aNbObjs, aNbTools;
- //
- aNbObjs=myArguments.Extent();
- aNbTools=myTools.Extent();
- //
- if (aNbObjs==1 && aNbTools==1) {
- if (myOperation==BOPAlgo_FUSE) {
- BuildSolid();
- }
- else {
- myShape=myRC;
- }
- }
- else {
- BuildSolid();
+ }
+ //
+ // add the rest of the shapes into result
+ BOPCol_MapOfShape aMSResult;
+ BOPTools::MapShapes(aResult, aMSResult);
+ //
+ aIt.Initialize(myRC);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ if (!aMSResult.Contains(aS)) {
+ aBB.Add(aResult, aS);
}
}
+ //
+ myShape = aResult;
}
//=======================================================================
//function : BuildSolid
}
return aRet;
}
+//=======================================================================
+//function : CollectContainers
+//purpose :
+//=======================================================================
+void CollectContainers(const TopoDS_Shape& theS,
+ BOPCol_ListOfShape& theLSC)
+{
+ TopAbs_ShapeEnum aType = theS.ShapeType();
+ if (aType == TopAbs_WIRE ||
+ aType == TopAbs_SHELL ||
+ aType == TopAbs_COMPSOLID) {
+ theLSC.Append(theS);
+ return;
+ }
+ //
+ if (aType != TopAbs_COMPOUND) {
+ return;
+ }
+ //
+ TopoDS_Iterator aIt(theS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ CollectContainers(aS, theLSC);
+ }
+}
+
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_DS.hxx>
+
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+
//=======================================================================
//function :
//purpose :
PostTreat();
}
-//
-// myErrorStatus
-//
-// 0 - Ok
-//
//=======================================================================
//function : PostTreat
//purpose :
//=======================================================================
void BOPAlgo_Builder::PostTreat()
{
- BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05, myRunParallel);
- BOPTools_AlgoTools::CorrectShapeTolerances(myShape, myRunParallel);
+ Standard_Integer i, aNbS;
+ TopAbs_ShapeEnum aType;
+ BOPCol_IndexedMapOfShape aMA;
+ if (myPaveFiller->NonDestructive()) {
+ // MapToAvoid
+ aNbS=myDS->NbSourceShapes();
+ for (i=0; i<aNbS; ++i) {
+ const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+ aType=aSI.ShapeType();
+ if (aType==TopAbs_VERTEX ||
+ aType==TopAbs_EDGE||
+ aType==TopAbs_FACE) {
+ const TopoDS_Shape& aS=aSI.Shape();
+ aMA.Add(aS);
+}
+ }
+ }
+ //
+ BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel);
+ BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel);
}
aLE.Append(aSp);
}
//
- BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
- //
+ if (!myPaveFiller->NonDestructive()) {
+ // speed up for planar faces
+ BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
+ }
// 3 Build split faces
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
aBF.SetFace(aF);
-- 4 - V/V, V/E, E/E, V/F and E/F;
-- 5 - all interferences, default value.
- SetNonDestructive(me:out;
- theFlag: Boolean from Standard);
- ---Purpose: Sets the flag <theFlag> that defines
- -- the mode of the treatment:
- -- the copy of the argument when theFlag is true
- -- the argument itself when theFlag is false
-
- NonDestructive(me)
- returns Boolean from Standard;
- ---Purpose: Returns the flag that defines the
- -- mode of the treatment:
- -- true when the copy of the argument is used
- -- false when the argument itself is used
-
PostTreat (me:out)
is protected;
---Purpose: Provides post-treatment actions
fields
myLevelOfCheck: Integer from Standard is protected;
- myNonDestructive: Boolean from Standard is protected;
myNewOldMap : DataMapOfShapeShape from BOPCol is protected;
end CheckerSI;
}
}
//=======================================================================
-//function : SetNonDestructive
-//purpose :
-//=======================================================================
-void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag)
-{
- myNonDestructive=theFlag;
-}
-//=======================================================================
-//function : NonDestructive
-//purpose :
-//=======================================================================
-Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const
-{
- return myNonDestructive;
-}
-//=======================================================================
//function : Init
//purpose :
//=======================================================================
Iterator from BOPDS,
PIterator from BOPDS,
PaveBlock from BOPDS,
+ CommonBlock from BOPDS,
Curve from BOPDS,
IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS,
MapOfPaveBlock from BOPDS,
returns Real from Standard;
---Purpose: Returns the additional tolerance
+ UpdateVertex(me:out;
+ nV : Integer from Standard;
+ aTolNew: Real from Standard)
+ returns Integer from Standard
+ is protected;
+ ---Purpose:
+ -- Updates tolerance vertex nV due to V/E interference;
+ -- It always creates new vertex if nV is from arguments
+ -- Returns: DS index of updated vertex.
+
+ ComputeTolerance(me:out;
+ theCB:CommonBlock from BOPDS)
+ returns Real from Standard
+ is protected;
+
+ UpdatePaveBlocksWithSDVertices(me:out)
+ is protected;
+
+ UpdateCommonBlocksWithSDVertices (me:out)
+ is protected;
+
+ UpdateBlocksWithSharedVertices (me:out)
+ is protected;
+
+ EstimatePaveOnCurve (me:out;
+ nV : Integer from Standard;
+ theNC : out Curve from BOPDS;
+ theTolR3D : Real from Standard)
+ returns Boolean from Standard
+ is protected;
+
+ UpdateEdgeTolerance(me:out;
+ nE : Integer from Standard;
+ aTolNew: Real from Standard)
+ is protected;
+
+ SetNonDestructive(me:out;
+ theFlag:Boolean from Standard);
+ ---Purpose: Sets the flag <theFlag> that defines
+ -- the mode of treatment: in non-destructive mode
+ -- the argument shapes are not modified: the copy of sub-shape
+ -- is created in the result if it is needed to be updated.
+
+ SetNonDestructive(me:out)
+ is protected;
+ ---Purpose: Sets non-destructive mode automatically if the argument
+ -- contains a locked shape (see TopoDS_Shape::Locked()).
+
+ NonDestructive(me)
+ returns Boolean from Standard;
+ ---Purpose: Returns the flag that defines
+ -- the mode of treatment: in non-destructive mode
+ -- the argument shapes are not modified: the copy of sub-shape
+ -- is created in the result if it is needed to be updated.
+
+ SetIsPrimary(me:out;
+ theFlag:Boolean from Standard)
+ is protected;
+
+ IsPrimary(me)
+ returns Boolean from Standard
+ is protected;
+
fields
myArguments : ListOfShape from BOPCol is protected;
myDS : PDS from BOPDS is protected;
myContext : Context from IntTools is protected;
mySectionAttribute : SectionAttribute from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
+ myNonDestructive : Boolean from Standard is protected;
+ myIsPrimary : Boolean from Standard is protected;
end PaveFiller;
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function :
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function : ~
Clear();
}
//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag)
+{
+ myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
+{
+ return myNonDestructive;
+}
+//=======================================================================
+//function : SetIsPrimary
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag)
+{
+ myIsPrimary=bFlag;
+}
+//=======================================================================
+//function : IsPrimary
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const
+{
+ return myIsPrimary;
+}
+//=======================================================================
//function : Clear
//purpose :
//=======================================================================
//
// 0 Clear
Clear();
+
//
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
// 3 myContext
myContext=new IntTools_Context;
//
+ // 4 NonDestructive flag
+ SetNonDestructive();
+ //
myErrorStatus=0;
}
//=======================================================================
return;
}
//
+ UpdatePaveBlocksWithSDVertices();
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 02
PerformVF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 12
PerformEF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
//
- MakeSplitEdges();
+ // 22
+ PerformFF();
if (myErrorStatus) {
return;
}
//
- // 22
- PerformFF();
+ UpdateBlocksWithSharedVertices();
+ //
+ MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
+ UpdatePaveBlocksWithSDVertices();
+ //
MakeBlocks();
if (myErrorStatus) {
return;
if (myErrorStatus) {
return;
}
- //
// 03
PerformVZ();
if (myErrorStatus) {
#include <TopoDS_Vertex.hxx>
#include <BRepBndLib.hxx>
+#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
-#include <BOPTools_AlgoTools.hxx>
+
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_ShapeInfo.hxx>
-#include <BOPAlgo_Tools.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BOPAlgo_Tools.hxx>
//=======================================================================
// function: PerformVV
//
BOPTools_AlgoTools::MakeVertex(aLV, aVn);
//
- // Appennd new vertex to the DS
+ // Append new vertex to the DS
aSIn.SetShape(aVn);
n=myDS->Append(aSIn);
//
}
}
//
+ BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
+ //
+ BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
+ aItDMII.Initialize(aDMII);
+ for (; aItDMII.More(); aItDMII.Next()) {
+ n1=aItDMII.Key();
+ myDS->InitPaveBlocksForVertex(n1);
+ }
+ //
//-----------------------------------------------------scope t
aLV.Clear();
aMBlocks.Clear();
--- /dev/null
+// Created by: Peter KURNEV
+// Copyright (c) 2010-2014 OPEN CASCADE SAS
+// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
+// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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 <BOPAlgo_PaveFiller.ixx>
+
+#include <Precision.hxx>
+
+#include <gp_Pnt.hxx>
+#include <Bnd_Box.hxx>
+
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_VectorOfListOfPaveBlock.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_DS.hxx>
+
+//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive()
+{
+ if (!myIsPrimary) {
+ return;
+ }
+ //
+ Standard_Boolean bFlag;
+ BOPCol_ListIteratorOfListOfShape aItLS;
+ //
+ bFlag=Standard_False;
+ aItLS.Initialize(myArguments);
+ for(; aItLS.More() && (!bFlag); aItLS.Next()) {
+ const TopoDS_Shape& aS=aItLS.Value();
+ bFlag=aS.Locked();
+ }
+ myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : UpdateEdgeTolerance
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bIsNewShape, bHasShapeSD;
+ Standard_Integer nV, nVx;
+ Standard_Real aTolV;
+ BRep_Builder aBB;
+ BOPCol_ListIteratorOfListOfInteger aIt;
+ //
+ BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
+ const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
+ //
+ if (myNonDestructive) {
+ bIsNewShape=myDS->IsNewShape(nE);
+ if (!bIsNewShape) {
+ return;
+ }
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ nV = aIt.Value();
+ bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+ if (bHasShapeSD) {
+ continue;
+ }
+ bIsNewShape=myDS->IsNewShape(nV);
+ if (!bIsNewShape) {
+ return;
+ }
+ }
+ }
+ //
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aBB.UpdateEdge(aE, aTol);
+ Bnd_Box& aBoxE=aSIE.ChangeBox();
+ BRepBndLib::Add(aE, aBoxE);
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ nV = aIt.Value();
+ bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+ if (bHasShapeSD) {
+ nV=nVx;
+ }
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+ aTolV = BRep_Tool::Tolerance(aV);
+ if (aTolV < aTol) {
+ aBB.UpdateVertex(aV, aTol);
+ BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
+ Bnd_Box& aBoxV = aSIV.ChangeBox();
+ BRepBndLib::Add(aV, aBoxV);
+ }
+ }
+}
+//=======================================================================
+//function : UpdateVertex
+//purpose :
+//=======================================================================
+Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
+ (const Standard_Integer nV,
+ const Standard_Real aTolNew)
+{
+ Standard_Integer nVNew;
+ Standard_Real aTolV;
+ BRep_Builder aBB;
+
+ nVNew = nV;
+ if (myDS->IsNewShape(nVNew) ||
+ myDS->HasShapeSD(nV, nVNew) ||
+ !myNonDestructive) {
+ // nV is a new vertex, it has SD or non-destructive mode is not in force
+ const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
+ aTolV = BRep_Tool::Tolerance(aVSD);
+ if (aTolV < aTolNew) {
+ aBB.UpdateVertex(aVSD, aTolNew);
+ BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
+ Bnd_Box& aBoxV = aSIV.ChangeBox();
+ BRepBndLib::Add(aVSD, aBoxV);
+ }
+ return nVNew;
+ }
+ //
+ // nV is old vertex
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+ aTolV = BRep_Tool::Tolerance(aV);
+ //
+ // create new vertex
+ TopoDS_Vertex aVNew;
+ gp_Pnt aPV = BRep_Tool::Pnt(aV);
+ aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
+ //
+ // append new vertex to DS
+ BOPDS_ShapeInfo aSIV;
+ aSIV.SetShapeType(TopAbs_VERTEX);
+ aSIV.SetShape(aVNew);
+ nVNew = myDS->Append(aSIV);
+ //
+ // bounding box for the new vertex
+ BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
+ Bnd_Box& aBoxDS = aSIDS.ChangeBox();
+ BRepBndLib::Add(aVNew, aBoxDS);
+ //
+ // add vertex to SD map
+ myDS->AddShapeSD(nV, nVNew);
+ //
+ myDS->InitPaveBlocksForVertex(nV);
+ //
+ return nVNew;
+}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ myDS->UpdatePaveBlocksWithSDVertices();
+}
+//=======================================================================
+//function : UpdateCommonBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ Standard_Integer aNbPBP;
+ //
+ BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+ aNbPBP=aPBP.Extent();
+ if(!aNbPBP) {
+ return;
+ }
+ //
+ Standard_Integer i, nV1, nV2;
+ Standard_Real aTolV;
+ BOPDS_MapOfCommonBlock aMCB;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ Handle(BOPDS_PaveBlock) aPB;
+ //
+ aTolV = Precision::Confusion();
+ //
+ for (i=0; i<aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ aPB=aItPB.Value();
+ const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+ if (aCB.IsNull()) {
+ continue;
+ }
+ //
+ if (aMCB.Add(aCB)) {
+ myDS->SortPaveBlocks(aCB);
+ aPB->Indices(nV1, nV2);
+ UpdateVertex(nV1, aTolV);
+ UpdateVertex(nV2, aTolV);
+ myDS->UpdateCommonBlockWithSDVertices(aCB);
+ }
+ }
+ }
+ UpdatePaveBlocksWithSDVertices();
+}
BOPAlgo_VertexEdge() :
BOPAlgo_Algo(),
- myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
+ myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
};
//
virtual ~BOPAlgo_VertexEdge(){
myV=aV;
}
//
- const TopoDS_Vertex& Vertex()const {
- return myV;
- }
- //
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
- const TopoDS_Edge& Edge()const {
- return myE;
- }
- //
Standard_Integer Flag()const {
return myFlag;
}
return myT;
}
//
+ Standard_Real VertexNewTolerance()const {
+ return myTolVNew;
+ }
+ //
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
- myFlag=myContext->ComputeVE (myV, myE, myT);
+ myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
};
//
protected:
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT;
+ Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Edge myE;
Handle(IntTools_Context) myContext;
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
- Standard_Real aT, aTolE, aTolV;
+ Standard_Real aT;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
- BRep_Builder aBB;
BOPAlgo_VectorOfVertexEdge aVVE;
//
myErrorStatus=0;
if (!iFlag) {
aVESolver.Indices(nV, nE, nVx);
aT=aVESolver.Parameter();
- const TopoDS_Vertex& aV=aVESolver.Vertex();
- const TopoDS_Edge& aE=aVESolver.Edge();
// 1
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2
myDS->AddInterf(nV, nE);
- // 3
+ //
+ //
BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First());
//
+ // 3 update vertex V/E if necessary
+ Standard_Real aTolVNew = aVESolver.VertexNewTolerance();
+ nVx=UpdateVertex(nV, aTolVNew);
+ //4
+ if (myDS->IsNewShape(nVx)) {
+ aVE.SetIndexNew(nVx);
+ }
+ //5 append ext pave to pave block
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
- aTolV = BRep_Tool::Tolerance(aV);
- aTolE = BRep_Tool::Tolerance(aE);
- if ( aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolE);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
}
- }
}//for (k=0; k < aNbVE; ++k) {
}
aMPBToUpdate.Clear();
}
//=======================================================================
-//function : PerformVertices
+//function : PerformVerticesEE
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
Handle(BOPDS_PaveBlock)& aPB,
BOPDS_MapOfPaveBlock& aMPBToUpdate)
{
- Standard_Integer aNbPnt, nE;
- gp_Pnt aP;
+ Standard_Integer nE, nVx, nVSD, iFlag;
+ Standard_Real aT, aTolVNew;
//
nE = aPB->OriginalEdge();
//
return;
}
//
- if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
+ if (aPB->Pave1().Index() == nV ||
+ aPB->Pave2().Index() == nV) {
return;
}
//
- const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
- const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
- aP=BRep_Tool::Pnt(aV);
+ nVx = nV;
+ if (myDS->HasShapeSD(nV, nVSD)) {
+ nVx = nVSD;
+ }
//
- GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
- aProjector.Perform(aP);
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
+ const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
//
- aNbPnt = aProjector.NbPoints();
- if (aNbPnt) {
- Standard_Real aT, aDist;
- //Standard_Integer i;
- BRep_Builder aBB;
+ iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
+ if (iFlag == 0 || iFlag == -4) {
BOPDS_Pave aPave;
//
- aDist=aProjector.LowerDistance();
- aT=aProjector.LowerDistanceParameter();
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aVEs.SetIncrement(10);
+ // 1
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
- //
+ // 2
myDS->AddInterf(nV, nE);
//
- aBB.UpdateVertex(aV, aDist);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
- Bnd_Box& aBox=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBox);
- //
- aPave.SetIndex(nV);
+ // 3 update vertex V/E if necessary
+ nVx=UpdateVertex(nV, aTolVNew);
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVE.SetIndexNew(nVx);
+ }
+ // 5 append ext pave to pave block
+ aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
//
aMPBToUpdate.Add(aPB);
}
}
-
- /*
- // DEBf
- {
- TopoDS_Compound aCx;
- BRep_Builder aBBx;
- aBBx.MakeCompound(aCx);
- aItMVCPB.Initialize(theMVCPB);
- for (; aItMVCPB.More(); aItMVCPB.Next()) {
- const TopoDS_Shape& aS=aItMVCPB.Key();
- aBBx.Add(aCx, aS);
- }
- BRepTools::Write(aCx, "cx");
- }
- // DEBt
- */
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBndLib.hxx>
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
BOPAlgo_VertexFace() :
BOPAlgo_Algo(),
myIV(-1), myIF(-1), myIVx(-1),
- myFlag(-1), myT1(-1.), myT2(-1.) {
+ myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) {
}
//
virtual ~BOPAlgo_VertexFace(){
aT2=myT2;
}
//
+ Standard_Real VertexNewTolerance()const {
+ return myTolVNew;
+ }
+ //
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
- myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
+ myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
}
//
protected:
Standard_Integer myFlag;
Standard_Real myT1;
Standard_Real myT2;
+ Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(IntTools_Context) myContext;
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
- Standard_Real aT1, aT2, aTolF, aTolV;
- BRep_Builder aBB;
+ Standard_Real aT1, aT2;
BOPAlgo_VectorOfVertexFace aVVF;
//
myErrorStatus=0;
//
aVertexFace.Indices(nV, nF, nVx);
aVertexFace.Parameters(aT1, aT2);
- const TopoDS_Vertex& aV=aVertexFace.Vertex();
- const TopoDS_Face& aF=aVertexFace.Face();
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
- // 3
+ //
+ // 3 update vertex V/F if necessary
+ Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
+ nVx=UpdateVertex(nVx, aTolVNew);
+ //
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVF.SetIndexNew(nVx);
+ }
+ // 5 update FaceInfo
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
- // 4
- aTolV = BRep_Tool::Tolerance(aV);
- aTolF = BRep_Tool::Tolerance(aF);
- if (aTolV < aTolF) {
- aBB.UpdateVertex(aV, aTolF);
- BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
- Bnd_Box& aBoxV = aSIV.ChangeBox();
- BRepBndLib::Add(aV, aBoxV);
- }
}//for (k=0; k < aNbVF; ++k) {
}// if (iSize) {
else {
#include <GeomAPI_ProjectPointOnSurf.hxx>
//
+#include <Precision.hxx>
+
#include <Bnd_Box.hxx>
//
#include <TopoDS_Vertex.hxx>
if (bIsOnPave[j]) {
bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn);
if (bV[j]) {
- const TopoDS_Vertex& aV=
+ const TopoDS_Vertex& aV =
(*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
- BOPTools_AlgoTools::UpdateVertex(aE, aT, aV);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
+ //
+ Standard_Real f, l, aTolVnew, aDistPP, aTolPC, aTolV;
+ //
+ const Handle(Geom_Curve)& aCur = BRep_Tool::Curve(aE, f, l);
+ //
+ gp_Pnt aP1 = BRep_Tool::Pnt(aV);
+ gp_Pnt aP2 = aCur->Value(aT);
+ //
+
+ aDistPP=aP1.Distance(aP2);
+
+ aTolPC=Precision::PConfusion();
+ aTolV=BRep_Tool::Tolerance(aV);
+ if (aDistPP > (aTolV+aTolPC)) {
+ aTolVnew=Max(aTolE, aDistPP);
+ UpdateVertex(nV[j], aTolVnew);
+ }
}
else {
bIsOnPave[j] = ForceInterfVF(nV[j], nF);
myDS->AddInterf(nE, nF);
break;
}
- //update tolerance of edge if needed
- if (aTolE < aTolF) {
- myDS->UpdateEdgeTolerance(nE, aTolF);
- aTolE = aTolF;
- }
aEF.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE, nF);
}
//
// 2 Fuse vertices
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
}
}
}
- // 6 Split PaveBlocksa
+ // 6 Split PaveBlocks
for (i=1; i<=aNbPBLI; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
const Standard_Integer nF)
{
Standard_Boolean bRet;
+ Standard_Integer iFlag, nVx;
+ Standard_Real U, V, aTolVNew;
//
bRet = Standard_False;
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF);
//
- GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF);
- const gp_Pnt& aP = BRep_Tool::Pnt(aV);
- aProj.Perform(aP);
- if (!aProj.IsDone()) {
- return bRet;
- }
- Standard_Real aDist, U, V;
- //
- aDist=aProj.LowerDistance();
- aProj.LowerDistanceParameters(U, V);
- //
- gp_Pnt2d aP2d(U, V);
- bRet = myContext->IsPointInFace (aF, aP2d);
- if (bRet) {
- //Standard_Integer i;
- BRep_Builder aBB;
+ iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
+ if (iFlag == 0 || iFlag == -2) {
+ bRet=!bRet;
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetIncrement(10);
+ // 1
BOPDS_InterfVF& aVF=aVFs.Append1();
+ //
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
- //
+ // 2
myDS->AddInterf(nV, nF);
//
- aBB.UpdateVertex(aV, aDist);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
+ // 3 update vertex V/F if necessary
+ nVx=UpdateVertex(nV, aTolVNew);
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVF.SetIndexNew(nVx);
+ }
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
- aMVIn.Add(nV);
+ aMVIn.Add(nVx);
}
- //
return bRet;
}
-
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
//
+ if (aMI.Add(nF1)) {
+ myDS->UpdateFaceInfoOn(nF1);
+ myDS->UpdateFaceInfoIn(nF1);
+ }
+ if (aMI.Add(nF2)) {
+ myDS->UpdateFaceInfoOn(nF2);
+ myDS->UpdateFaceInfoIn(nF2);
+ }
+ //
aBAS1.Initialize(aF1, Standard_False);
aBAS2.Initialize(aF2, Standard_False);
- //
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
Standard_Boolean bToIntersect;
//
- if (aMI.Add(nF1)) {
- myDS->UpdateFaceInfoOn(nF1);
- myDS->UpdateFaceInfoIn(nF1);
- }
- if (aMI.Add(nF2)) {
- myDS->UpdateFaceInfoOn(nF2);
- myDS->UpdateFaceInfoIn(nF2);
- }
- //
bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
myDS->AddInterf(nF1, nF2);
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aTolE = BRep_Tool::Tolerance(aE);
if (aTolR3D > aTolE) {
- myDS->UpdateEdgeTolerance(nE, aTolR3D);
+ UpdateEdgeTolerance(nE, aTolR3D);
}
bInBothFaces = Standard_False;
- } else {
+ }
+ else {
bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
aFI1.PaveBlocksIn().Contains(aPBOut))&&
(aFI2.PaveBlocksOn().Contains(aPBOut) ||
//
BOPCol_ListOfShape aLS(theAllocator);
BOPAlgo_PaveFiller aPF(theAllocator);
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
//function : IsExistingVertex
//purpose :
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
- (const gp_Pnt& aP,
- const Standard_Real theTolR3D,
- const BOPCol_MapOfInteger& aMVOnIn)const
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
+ (const gp_Pnt& aP,
+ const Standard_Real theTolR3D,
+ const BOPCol_MapOfInteger& aMVOnIn)const
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
//function : IsExistingPaveBlock
//purpose :
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
- (const Handle(BOPDS_PaveBlock)& thePB,
- const BOPDS_Curve& theNC,
- const Standard_Real theTolR3D,
- const BOPCol_ListOfInteger& theLSE)
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
+ (const Handle(BOPDS_PaveBlock)& thePB,
+ const BOPDS_Curve& theNC,
+ const Standard_Real theTolR3D,
+ const BOPCol_ListOfInteger& theLSE)
{
Standard_Boolean bRet=Standard_True;
//
aItLI.Initialize(theLSE);
for (; aItLI.More(); aItLI.Next()) {
nE=aItLI.Value();
+ if (nE < 0)
+ continue;
const BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const Bnd_Box& aBoxE=aSIE.Box();
if (!aBoxE.IsOut(aBoxPm)) {
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
aPB->Indices(nV21, nV22);
nSp=aPB->Edge();
+ if (nSp < 0)
+ continue;
const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp=aSISp.Box();
//function : GetEFPnts
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1,
- const Standard_Integer nF2,
- IntSurf_ListOfPntOn2S& aListOfPnts)
+void BOPAlgo_PaveFiller::GetEFPnts
+ (const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ IntSurf_ListOfPntOn2S& aListOfPnts)
{
Standard_Integer nE, nF, nFOpposite, aNbEFs, i;
Standard_Real U1, U2, V1, V2, f, l;
//function : GetStickVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_MapOfInteger& aMVStick,
- BOPCol_MapOfInteger& aMVEF,
- BOPCol_MapOfInteger& aMI)
+void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ BOPCol_MapOfInteger& aMVStick,
+ BOPCol_MapOfInteger& aMVEF,
+ BOPCol_MapOfInteger& aMI)
{
Standard_Integer nS1, nS2, nVNew, aTypeInt, i;
//
//function : ProcessOldPaveBlocks
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
+void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
(const Standard_Integer theInt,
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
//function : UpdateExistingPaveBlocks
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
- (const Handle(BOPDS_PaveBlock)& aPBf,
- BOPDS_ListOfPaveBlock& aLPB,
- const Standard_Integer nF1,
- const Standard_Integer nF2)
+void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
+ (const Handle(BOPDS_PaveBlock)& aPBf,
+ BOPDS_ListOfPaveBlock& aLPB,
+ const Standard_Integer nF1,
+ const Standard_Integer nF2)
{
Standard_Integer nE;
Standard_Boolean bCB;
// function: PutClosingPaveOnCurve
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
+void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
{
Standard_Boolean bIsClosed, bHasBounds, bAdded;
Standard_Integer nVC, j;
//function : PreparePostTreatFF
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PreparePostTreatFF
+void BOPAlgo_PaveFiller::PreparePostTreatFF
(const Standard_Integer aInt,
const Standard_Integer aCur,
const Handle(BOPDS_PaveBlock)& aPB,
aTolFF = Max(aTolFF, 5.e-6);
}
}
+//=======================================================================
+//function : UpdateBlocksWithSharedVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ //
+ myErrorStatus=0;
+ //
+ Standard_Integer aNbFF;
+ //
+ BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
+ aNbFF=aFFs.Extent();
+ if (!aNbFF) {
+ return;
+ }
+ //
+ Standard_Boolean bOnCurve, bHasShapeSD;
+ Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD;
+ Standard_Real aTolR3D, aTolV;
+ BOPCol_MapOfInteger aMF;
+ //
+ for (i=0; i<aNbFF; ++i) {
+ BOPDS_InterfFF& aFF=aFFs(i);
+ //
+ BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
+ aNbC=aVC.Extent();
+ if (!aNbC) {
+ continue;
+ }
+ //
+ aFF.Indices(nF1, nF2);
+ aTolR3D=aFF.TolR3D();
+ //
+ if (aMF.Add(nF1)) {
+ myDS->UpdateFaceInfoOn(nF1);
+ }
+ if (aMF.Add(nF2)) {
+ myDS->UpdateFaceInfoOn(nF2);
+ }
+ //
+ // Collect old vertices that are shared for nF1, nF2 ->aMI;
+ BOPCol_MapOfInteger aMI;
+ BOPCol_MapIteratorOfMapOfInteger aItMI;
+ //
+ BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
+ BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
+ //
+ const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
+ const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
+ const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
+ const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
+ //
+ for (j=0; j<2; ++j) {
+ const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1;
+ aItMI.Initialize(aMV1);
+ for (; aItMI.More(); aItMI.Next()) {
+ nV=aItMI.Value();
+ if (myDS->IsNewShape(nV)) {
+ continue;
+ }
+ if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
+ aMI.Add(nV);
+ }
+ }
+ }
+ //
+ // Try to put vertices aMI on curves
+ for (j=0; j<aNbC; ++j) {
+ BOPDS_Curve& aNC=aVC.ChangeValue(j);
+ //const IntTools_Curve& aIC=aNC.Curve();
+ //
+ aItMI.Initialize(aMI);
+ for (; aItMI.More(); aItMI.Next()) {
+ nV=aItMI.Value();
+ //
+ bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
+ if (bHasShapeSD) {
+ continue;
+ }
+ //
+ bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D);
+ if (!bOnCurve) {
+ continue;
+ }
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+ aTolV=BRep_Tool::Tolerance(aV);
+ //
+ UpdateVertex(nV, aTolV);
+ }
+ }//for (j=0; j<aNbC; ++j) {
+ }//for (i=0; i<aNbFF; ++i) {
+ //
+ UpdateCommonBlocksWithSDVertices();
+}
+//=======================================================================
+//function : EstimatePaveOnCurve
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::EstimatePaveOnCurve
+ (const Standard_Integer nV,
+ BOPDS_Curve& aNC,
+ const Standard_Real aTolR3D)
+{
+ Standard_Boolean bIsVertexOnLine;
+ Standard_Real aT;
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+ const IntTools_Curve& aIC=aNC.Curve();
+ //
+ bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
+ return bIsVertexOnLine;
+}
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_Iterator.hxx>
+#include <Precision.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
Standard_Boolean bCB, bV1, bV2;
Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
Standard_Real aT1, aT2;
- BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
BOPDS_MapOfPaveBlock aMPB(100);
TopoDS_Vertex aV1, aV2;
TopoDS_Edge aE;
BOPAlgo_VectorOfSplitEdge aVBSE;
+ //
+ UpdateCommonBlocksWithSDVertices();
+ //
+ aNbPBP=aPBP.Extent();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
aPB->Indices(nV1, nV2);
bV1=myDS->IsNewShape(nV1);
bV2=myDS->IsNewShape(nV2);
+ bCB=myDS->IsCommonBlock(aPB);
//
- if (!(bV1 || bV2)) {
- nE=aPB->OriginalEdge();
- aPB->SetEdge(nE);
- continue;
+ if (!(bV1 || bV2)) { // no new vertices here
+ if (!myNonDestructive || (myNonDestructive && !bCB)) {
+ nE=aPB->OriginalEdge();
+ aPB->SetEdge(nE);
+ continue;
+ }
}
}
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
+ nE=aPB->OriginalEdge();
+ const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
+ if (aSIE.HasFlag()){
+ continue;
+ }
+ //
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
nSp=myDS->Append(aSI);
//
if (!aCBk.IsNull()) {
+ Standard_Real aTolCB = ComputeTolerance(aCBk);
+ myDS->UpdateEdgeTolerance(nSp, aTolCB);
aCBk->SetEdge(nSp);
}
else {
}
}
//=======================================================================
+//function : ComputeTolerance
+//purpose :
+//=======================================================================
+Standard_Real BOPAlgo_PaveFiller::ComputeTolerance
+ (const Handle(BOPDS_CommonBlock)& theCB)
+{
+ Standard_Integer nE, nF;
+ Standard_Real aTol, aTolMax;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ BOPCol_ListIteratorOfListOfInteger aItLI;
+ //
+ const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
+ nE = aPBR->OriginalEdge();
+ const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aTolMax = BRep_Tool::Tolerance(aEOr);
+ //
+ const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ if (aPB == aPBR) {
+ continue;
+ }
+ //
+ nE = aPB->OriginalEdge();
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aTol = BRep_Tool::Tolerance(aE);
+ if (aTol > aTolMax) {
+ aTolMax=aTol;
+ }
+ }
+ //
+ const BOPCol_ListOfInteger& aLFI = theCB->Faces();
+ aItLI.Initialize(aLFI);
+ for (; aItLI.More(); aItLI.Next()) {
+ nF = aItLI.Value();
+ const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
+ //
+ aTol=BRep_Tool::Tolerance(aF);
+ if (aTol > aTolMax) {
+ aTolMax=aTol;
+ }
+ }
+ return aTolMax;
+}
+//=======================================================================
// function: SplitEdge
// purpose:
//=======================================================================
//=======================================================================
void BOPAlgo_PaveFiller::Prepare()
{
+ if (myNonDestructive) {
+ // do not allow storing pcurves in original edges if non-destructive mode is on
+ return;
+ }
TopAbs_ShapeEnum aType[] = {
TopAbs_VERTEX,
TopAbs_EDGE,
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
//
// 1.Filling mySmartMap
- BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace);
- //
aIt.Initialize(myEdges);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
BOPAlgo_Builder_4.cxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_ListOfCheckResult.hxx
-
-
+BOPAlgo_PaveFiller_11.cxx
ListOfInteger from BOPCol,
MapOfInteger from BOPCol,
BaseAllocator from BOPCol,
+ DataMapOfIntegerListOfInteger from BOPCol,
--
ShapeInfo from BOPDS,
IndexRange from BOPDS,
---Purpose:
--- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
---
-
+ UpdatePaveBlocksWithSDVertices(me:out);
+
+ UpdatePaveBlockWithSDVertices(me:out;
+ thePB:PaveBlock from BOPDS);
+
+ UpdateCommonBlockWithSDVertices(me:out;
+ theCB:CommonBlock from BOPDS);
+
+ InitPaveBlocksForVertex(me:out;
+ theNV:Integer from Standard);
+
BuildBndBoxSolid (me:out;
theIndex:Integer from Standard;
theBox:out Box from Bnd)
--same domain shapes
myShapesSD : DataMapOfIntegerInteger from BOPCol is protected;
--
+ myMapVE: DataMapOfIntegerListOfInteger from BOPCol is protected;
+ --
--interferences
myInterfTB : MapOfPassKey from BOPDS is protected;
myInterfVV : VectorOfInterfVV from BOPDS is protected;
#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <algorithm>
//
-static
- inline void ResetShape(const TopoDS_Shape& aS);
-
-static
- inline void ResetShapes(const TopoDS_Shape& aS);
static
void TotalShapes(const TopoDS_Shape& aS,
- Standard_Integer& aNbS);
+ Standard_Integer& aNbS,
+ BOPCol_MapOfShape& aMS);
static
Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myPaveBlocksPool.Clear();
myFaceInfoPool.Clear();
myShapesSD.Clear();
+ myMapVE.Clear();
myMapPBCB.Clear();
myInterfTB.Clear();
myInterfVV.Clear();
}
return iRet;
}
-
//=======================================================================
//function : Init
//purpose :
BOPCol_ListIteratorOfListOfShape aIt;
BOPDS_IndexRange aR;
Handle(NCollection_BaseAllocator) aAllocator;
+ BOPCol_MapOfShape aMS;
//
// 1 Append Source Shapes
aNb=myArguments.Extent();
//
myRanges.SetIncrement(aNb);
//
- aIt.Initialize(myArguments);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aSx=aIt.Value();
- ResetShapes(aSx);
- }
- //
aNbS=0;
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
//
aNbSx=0;
- TotalShapes(aSx, aNbSx);
+ TotalShapes(aSx, aNbSx, aMS);
+ //
aNbS=aNbS+aNbSx;
}
+ aMS.Clear();
//
myLines.SetIncrement(2*aNbS);
//-----------------------------------------------------scope_1 f
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
const TopoDS_Shape& aS=aSI.Shape();
- ResetShape(aS);
//
aTS=aSI.ShapeType();
//
const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
aTol = TV->Tolerance();
- //
+ // TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TV->Tolerance(aTol);
const Handle(BRep_TEdge)& TE =
*((Handle(BRep_TEdge)*)&aE.TShape());
aTol = TE->Tolerance();
- //
+ // TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TE->Tolerance(aTol);
const Handle(BRep_TFace)& TF =
*((Handle(BRep_TFace)*)&aF.TShape());
aTol = TF->Tolerance();
- //
+ // TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TF->Tolerance(aTol);
}//for (j=0; j<myNbSourceShapes; ++j) {
//
aMI.Clear();
+ //-----------------------------------------------------
+ //
+ for (nE=0; nE<myNbSourceShapes; ++nE) {
+ BOPDS_ShapeInfo& aSI=ChangeShapeInfo(nE);
+ if (aSI.ShapeType()!=TopAbs_EDGE) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
+ aIt1.Initialize(aLV);
+ for (; aIt1.More(); aIt1.Next()) {
+ nV=aIt1.Value();
+ if (myMapVE.IsBound(nV)) {
+ BOPCol_ListOfInteger& aLE=myMapVE.ChangeFind(nV);
+ aLE.Append(nE);
+ }
+ else {
+ BOPCol_ListOfInteger aLE(myAllocator);
+ //
+ aLE.Append(nE);
+ myMapVE.Bind(nV, aLE);
+ }
+ }
+ }
+ //
+ BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItDMILI;
+ aItDMILI.Initialize(myMapVE);
+ for(; aItDMILI.More(); aItDMILI.Next()) {
+ BOPCol_MapOfInteger aMFence;
+ BOPCol_ListOfInteger aLEx;
+ //
+ nV=aItDMILI.Key();
+ BOPCol_ListOfInteger& aLE=aItDMILI.ChangeValue();
+ aIt1.Initialize(aLE);
+ for (; aIt1.More(); aIt1.Next()) {
+ nE=aIt1.Value();
+ if(aMFence.Add(nE)) {
+ aLEx.Append(nE);
+ }
+ }
+ //
+ aLE.Clear();
+ aIt1.Initialize(aLEx);
+ for (; aIt1.More(); aIt1.Next()) {
+ nE=aIt1.Value();
+ aLE.Append(nE);
+ }
+ }
//-----------------------------------------------------scope_1 t
// 3 myPaveBlocksPool
// 4. myFaceInfoPool
}
return sLPB;
}
+
//=======================================================================
//function : ChangePaveBlocks
//purpose :
BOPDS_InterfVF& aVF=aVFs(i);
if(aVF.Contains(theF)) {
nV=aVF.OppositeIndex(theF);
+ if (HasShapeSD(nV, nVSD)) {
+ nV=nVSD;
+ }
theMI.Add(nV);
}
}
//purpose :
//=======================================================================
void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_ListOfInteger& theLI,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+ const Standard_Integer nF2,
+ BOPCol_ListOfInteger& theLI,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer nE, nSp;
BOPCol_ListIteratorOfListOfInteger aItLI;
return bRet;
}
-
//=======================================================================
// function: Paves
// purpose:
theLP.Append(pPaves(i));
}
}
-
//=======================================================================
// function: UpdateTolerance
// purpose:
}
}
}
-
//=======================================================================
//function : TotalShapes
//purpose :
//=======================================================================
void TotalShapes(const TopoDS_Shape& aS,
- Standard_Integer& aNbS)
+ Standard_Integer& aNbS,
+ BOPCol_MapOfShape& aMS)
{
- TopoDS_Shape *pS;
- //
- pS=(TopoDS_Shape *)&aS;
- if (!pS->Checked()) {
+ if (aMS.Add(aS)) {
TopoDS_Iterator aIt;
- //
- pS->Checked(1);
++aNbS;
aIt.Initialize(aS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
- TotalShapes(aSx, aNbS);
+ TotalShapes(aSx, aNbS, aMS);
}
}
}
-//=======================================================================
-//function : ResetShape
-//purpose :
-//=======================================================================
-void ResetShape(const TopoDS_Shape& aS)
-{
- TopoDS_Shape *pS;
- //
- pS=(TopoDS_Shape *)&aS;
- pS->Checked(0);
-}
-//=======================================================================
-//function : ResetShape
-//purpose :
-//=======================================================================
-void ResetShapes(const TopoDS_Shape& aS)
-{
- TopoDS_Iterator aIt;
- //
- ResetShape(aS);
- aIt.Initialize(aS);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aSx=aIt.Value();
- ResetShape(aSx);
- }
-}
+
//=======================================================================
//function : ComputeParameter
//purpose :
}
}
}
+
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlocksWithSDVertices()
+{
+ Standard_Integer i, aNbPBP;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ //
+ BOPDS_VectorOfListOfPaveBlock& aPBP=myPaveBlocksPool;
+ //
+ aNbPBP=aPBP.Size();
+ for (i = 0; i < aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
+ //
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ Handle(BOPDS_PaveBlock)& aPB = aItPB.ChangeValue();
+ UpdatePaveBlockWithSDVertices(aPB);
+ }// for (; aItPB.More(); aItPB.Next()) {
+ }// for (i = 0; i < aNbPBP; ++i) {
+}
+//=======================================================================
+//function : UpdatePaveBlockWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlockWithSDVertices
+ (const Handle(BOPDS_PaveBlock)& thePB)
+{
+ Standard_Integer nV1, nV2;
+ BOPDS_Pave aPave1, aPave2;
+ //
+ aPave1 = thePB->Pave1();
+ aPave2 = thePB->Pave2();
+ //
+ nV1 = aPave1.Index();
+ nV2 = aPave2.Index();
+ //
+ if (HasShapeSD(nV1, nV1)) {
+ aPave1.SetIndex(nV1);
+ thePB->SetPave1(aPave1);
+ }
+ //
+ if (HasShapeSD(nV2, nV2)) {
+ aPave2.SetIndex(nV2);
+ thePB->SetPave2(aPave2);
+ }
+}
+//=======================================================================
+//function : UpdateCommonBlockWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdateCommonBlockWithSDVertices
+ (const Handle(BOPDS_CommonBlock)& theCB)
+{
+ const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ UpdatePaveBlockWithSDVertices(aPB);
+ }
+}
+//=======================================================================
+//function : InitPaveBlocksForVertex
+//purpose :
+//=======================================================================
+void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV)
+{
+ Standard_Integer nE;
+ BOPCol_ListIteratorOfListOfInteger aItLE;
+ //
+ if (myMapVE.IsBound(theNV)) {
+ const BOPCol_ListOfInteger& aLE=myMapVE.Find(theNV);
+ aItLE.Initialize(aLE);
+ for (; aItLE.More(); aItLE.Next()) {
+ nE=aItLE.Value();
+ ChangePaveBlocks(nE);
+ }
+ }
+}
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
+#include <stdio.h>
+#include <string.h>
static
void ConvertList(const BOPCol_ListOfShape& aLSB,
- TopTools_ListOfShape& aLS);
+ BOPCol_ListOfShape& aLS);
static Standard_Integer bapibuild(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bapibop (Draw_Interpretor&, Standard_Integer, const char**);
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
- TopTools_ListOfShape aLS, aLT;
+ BOPCol_ListOfShape aLS, aLT;
ConvertList(aLSB, aLS);
ConvertList(aLTB, aLT);
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
- TopTools_ListOfShape aLS;
+ BOPCol_ListOfShape aLS;
ConvertList(aLSB, aLS);
ConvertList(aLTB, aLS);
//
//purpose :
//=======================================================================
void ConvertList(const BOPCol_ListOfShape& aLSB,
- TopTools_ListOfShape& aLS)
+ BOPCol_ListOfShape& aLS)
{
BOPCol_ListIteratorOfListOfShape aItB;
//
theS :out Shape from TopoDS);
CorrectTolerances (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001;
- theRunParallel: Boolean from Standard=Standard_False);
-
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001;
+ theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- <theTolMax> is max value of the tolerance that can be
-- perform.
CorrectCurveOnSurface (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001;
- theRunParallel: Boolean from Standard=Standard_False);
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001;
+ theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- in terms of BRepCheck_InvalidCurveOnSurface.
CorrectPointOnCurve (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001;
- theRunParallel: Boolean from Standard=Standard_False);
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001;
+ theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- in terms of BRepCheck_InvalidPointOnCurve.
-
+
MakeNewVertex (myclass;
aP1 : Pnt from gp;
aTol: Real from Standard;
CorrectShapeTolerances (myclass;
theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
#include <TopExp_Explorer.hxx>
#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
Standard_Boolean IsClosed(const TopoDS_Edge& ,
const TopoDS_Face& );
-
//=======================================================================
//function : AttachExistingPCurve
//purpose :
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aCtx)
{
- Standard_Boolean bIsToReverse, bIsClosed;
+ Standard_Boolean bIsToReverse, bIsClosed, bComp;
Standard_Integer iRet;
Standard_Real aTol, aT11, aT12, aT21, aT22, aTolPPC;
+ Standard_Real aTolSP, aTMax;
Handle(Geom2d_Curve) aC2Dold, aC2DoldC;
Handle(Geom2d_TrimmedCurve) aC2DT;
BRep_Builder aBB;
//
aC2DT=new Geom2d_TrimmedCurve(aC2DoldC, aT21, aT22);
//
- aTol=BRep_Tool::Tolerance(aE1);
- BRep_Tool::Range (aE1, aT11, aT12);
- aBB.SameRange(aE1, Standard_False);
- aBB.SameParameter(aE1, Standard_False);
-
aTolPPC=Precision::PConfusion();
//
+ Handle(Geom_Curve) aCE1 = BRep_Tool::Curve(aE1, aT11, aT12);
+ //
GeomLib::SameRange(aTolPPC, aC2DT, aT21, aT22, aT11, aT12, aC2DT);
//
if (aC2DT.IsNull()){
return iRet;
}
//
+ // check the curves on same parameter to prevent
+ // big tolerance increasing
+ Handle(Geom_Surface) aSF = BRep_Tool::Surface(aF);
+ //
+ bComp = IntTools_Tools::ComputeTolerance
+ (aCE1, aC2DT, aSF, aT11, aT12, aTolSP, aTMax);
+ if (!bComp) {
+ iRet = 3;
+ return iRet;
+ }
+ //
+ aTol = BRep_Tool::Tolerance(aE1);
+ //
+ if ((aTolSP > 10.*aTol) && aTolSP > 0.1) {
+ iRet = 4;
+ return iRet;
+ }
+ //
+ aBB.SameRange(aE1, Standard_False);
+ aBB.SameParameter(aE1, Standard_False);
+ //
aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
BRepLib::SameParameter(aE1);
BRepLib::SameRange(aE1);
//
- bIsClosed=IsClosed(aE2, aF);
+ bIsClosed = IsClosed(aE2, aF);
if (bIsClosed) {
- iRet=UpdateClosedPCurve(aE2, aE1, aF, aCtx);
+ iRet = UpdateClosedPCurve(aE2, aE1, aF, aCtx);
if(iRet) {
- iRet=3;
+ iRet = 5;
}
}
//
}
return bRet;
}
-
static
void CheckEdge (const TopoDS_Edge& E,
- const Standard_Real aMaxTol);
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
- const Standard_Real aMaxTol);
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_Curve& Other,
Standard_Real& aNewTolerance);
static
- void CorrectVertexTolerance(const TopoDS_Edge& aE);
+ void CorrectVertexTolerance(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
- void CorrectWires(const TopoDS_Face& aF);
+ void CorrectWires(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
- void UpdateEdges(const TopoDS_Face& aF);
+ void UpdateEdges(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
+
+static
+ void UpdateShape(const TopoDS_Shape& aS,
+ const Standard_Real aTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
class BOPTools_CPC {
public:
BOPTools_CPC()
- : myMaxTol(1.e-7) {
+ : myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~BOPTools_CPC() {
return myMaxTol;
}
//
+ void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+ mypMapToAvoid = &aMapToAvoid;
+ }
+ //
void Perform() {
- CheckEdge(myEdge, myMaxTol);
+ Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+ CheckEdge(myEdge, myMaxTol, *mypMapToAvoid);
}
protected:
Standard_Real myMaxTol;
TopoDS_Edge myEdge;
+ const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//
//=======================================================================
//=======================================================================
class BOPTools_CWT {
public:
- BOPTools_CWT() {
+ BOPTools_CWT() : mypMapToAvoid(0L) {
}
//
~BOPTools_CWT() {
myFace=aF;
}
//
+ void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+ mypMapToAvoid = &aMapToAvoid;
+ }
+ //
void Perform() {
- CorrectWires(myFace);
+ Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+ CorrectWires(myFace, *mypMapToAvoid);
}
//
protected:
TopoDS_Face myFace;
+ const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CWT> BOPTools_VectorOfCWT;
class BOPTools_CDT {
public:
BOPTools_CDT()
- : myMaxTol(1.e-7) {
+ : myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~BOPTools_CDT() {
myMaxTol=aMaxTol;
}
//
+ void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+ mypMapToAvoid = &aMapToAvoid;
+ }
+ //
void Perform() {
- CorrectEdgeTolerance (myEdge, myFace, myMaxTol);
+ Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+ CorrectEdgeTolerance (myEdge, myFace, myMaxTol, *mypMapToAvoid);
}
//
protected:
Standard_Real myMaxTol;
TopoDS_Edge myEdge;
TopoDS_Face myFace;
+ const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CDT> BOPTools_VectorOfCDT;
//=======================================================================
class BOPTools_CVT {
public:
- BOPTools_CVT() {
+ BOPTools_CVT() : mypMapToAvoid(0L) {
}
//
~BOPTools_CVT() {
myEdge=aE;
}
//
+ void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+ mypMapToAvoid = &aMapToAvoid;
+ }
+ //
void Perform() {
- CorrectVertexTolerance(myEdge);
+ Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+ CorrectVertexTolerance(myEdge, *mypMapToAvoid);
}
//
protected:
TopoDS_Edge myEdge;
+ const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//
//=======================================================================
//=======================================================================
class BOPTools_CET {
public:
- BOPTools_CET() {
+ BOPTools_CET() : mypMapToAvoid(0L) {
}
//
~BOPTools_CET() {
myFace=aF;
}
//
+ void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
+ mypMapToAvoid = &aMapToAvoid;
+ }
+ //
void Perform() {
- UpdateEdges(myFace);
+ Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
+ UpdateEdges(myFace, *mypMapToAvoid);
}
//
protected:
TopoDS_Face myFace;
+ const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CET> BOPTools_VectorOfCET;
//=======================================================================
void BOPTools_AlgoTools::CorrectTolerances
(const TopoDS_Shape& aShape,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
- BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol, bRunParallel);
- BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol, bRunParallel);
+ BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMapToAvoid, aMaxTol, bRunParallel);
+ BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMapToAvoid, aMaxTol, bRunParallel);
}
//
//=======================================================================
//=======================================================================
void BOPTools_AlgoTools::CorrectPointOnCurve
(const TopoDS_Shape& aS,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
BOPTools_CPC& aCPC=aVCPC.Append1();
aCPC.SetEdge(aE);
aCPC.SetMaxTol(aMaxTol);
+ aCPC.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
//=======================================================================
void BOPTools_AlgoTools::CorrectCurveOnSurface
(const TopoDS_Shape& aS,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
//
BOPTools_CWT& aCWT=aVCWT.Append1();
aCWT.SetFace(aF);
+ aCWT.SetMapToAvoid(aMapToAvoid);
//
aExpE.Init(aF, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next()) {
aCDT.SetEdge(aE);
aCDT.SetFace(aF);
aCDT.SetMaxTol(aMaxTol);
+ aCDT.SetMapToAvoid(aMapToAvoid);
}
}
//
//=======================================================================
void BOPTools_AlgoTools::CorrectShapeTolerances
(const TopoDS_Shape& aShape,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Boolean bRunParallel)
{
TopExp_Explorer aExp;
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
BOPTools_CVT& aCVT=aVCVT.Append1();
aCVT.SetEdge(aE);
+ aCVT.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
BOPTools_CET& aCET=aVCET.Append1();
aCET.SetFace(aF);
+ aCET.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
// purpose : Correct tolerances for Vertices on Edge
//=======================================================================
void CheckEdge (const TopoDS_Edge& Ed,
- const Standard_Real aMaxTol)
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolE, aTol, aD2, aNewTolerance, dd;
gp_Pnt aPC;
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
aItPR.Next();
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
}
// Function : CorrectWires
// purpose :
//=======================================================================
-void CorrectWires(const TopoDS_Face& aFx)
+void CorrectWires(const TopoDS_Face& aFx,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Boolean bIsPeriodic;
Standard_Integer i, aNbV;
}// for (; aIt1.More(); aIt1.Next()) {
}// for (; aIt.More(); aIt.Next()) {
if (aD2max>aTol2) {
- BRep_Builder aBB;
- //
aTol=sqrt(aD2max);
- aBB.UpdateVertex(aV, aTol);
+ UpdateShape(aV, aTol, aMapToAvoid);
}
}// for (i=1; i<=aNbV; ++i) {
}
//=======================================================================
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
- const Standard_Real aMaxTol)
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
//
// 1. Minimum of conditions to Perform
Tol, SameParameter, aNewTol);
if (ok) {
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- //
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
if (ok) {
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
Tol,Standard_True, aNewTol);
if (okx) {
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
//function : CorrectVertexTolerance
//purpose :
//=======================================================================
-void CorrectVertexTolerance(const TopoDS_Edge& aE)
+void CorrectVertexTolerance(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolE, aTolV;
TopoDS_Iterator aIt;
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aIt.Value());
aTolV=BRep_Tool::Tolerance(aV);
if (aTolV<aTolE) {
- Handle(BRep_TVertex)& aTV= *((Handle(BRep_TVertex)*)&aV.TShape());
- aTV->UpdateTolerance(aTolE);
+ UpdateShape(aV, aTolE, aMapToAvoid);
}
}
}
// Function : UpdateEdges
// purpose :
//=======================================================================
-void UpdateEdges(const TopoDS_Face& aF)
+void UpdateEdges(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolF, aTolE, aTolV;
TopoDS_Iterator aItF, aItW, aItE;
- BRep_Builder aBB;
//
aTolE=aTolF= BRep_Tool::Tolerance(aF);
aItF.Initialize(aF);
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value());
aTolE = BRep_Tool::Tolerance(aE);
if (aTolE < aTolF) {
- aBB.UpdateEdge(aE, aTolF);
+ UpdateShape(aE, aTolF, aMapToAvoid);
aTolE = aTolF;
}
- //UpdateVertices(aE);
}
}
else {
const TopoDS_Vertex& aV=*(TopoDS_Vertex*)&aItF.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolF);
+ UpdateShape(aV, aTolF, aMapToAvoid);
}
}
}
}
//=======================================================================
+//function : UpdateShape
+//purpose :
+//=======================================================================
+void UpdateShape(const TopoDS_Shape& aS,
+ const Standard_Real aTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
+{
+ if (aMapToAvoid.Contains(aS)) {
+ return;
+ }
+ //
+ TopAbs_ShapeEnum aType;
+ BRep_Builder aBB;
+ //
+ aType=aS.ShapeType();
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE = *((TopoDS_Edge*)&aS);
+ aBB.UpdateEdge(aE, aTol);
+ }
+ else if (aType==TopAbs_VERTEX) {
+ const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&aS);
+ aBB.UpdateVertex(aV, aTol);
+ }
+}
+//=======================================================================
// Function : ComputeTolerance
// purpose :
//=======================================================================
Shape from TopoDS,
DataMapOfShapeShape from TopTools,
ListOfShape from TopTools,
+ ListOfShape from BOPCol,
--
Operation from BOPAlgo,
PaveFiller from BOPAlgo
---C++: return const &
SetTools(me:out;
- theLS: ListOfShape from TopTools);
+ theLS: ListOfShape from BOPCol);
---Purpose: Sets the tools
Tools(me)
- returns ListOfShape from TopTools;
+ returns ListOfShape from BOPCol;
---C++: return const &
---Purpose: Gets the tools
fields
- myTools : ListOfShape from TopTools is protected;
+ myTools : ListOfShape from BOPCol is protected;
myOperation: Operation from BOPAlgo is protected;
--
myBuilderCanWork : Boolean from Standard is protected;
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetTools
- (const TopTools_ListOfShape& theLS)
+ (const BOPCol_ListOfShape& theLS)
{
myTools=theLS;
}
//function : Tools
//purpose :
//=======================================================================
-const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
+const BOPCol_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
{
return myTools;
}
//
//-----------------------------------------------
TopTools_ListOfShape aLS;
- TopTools_ListIteratorOfListOfShape aIt;
+ BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
}
//
TopTools_IndexedMapOfShape mapOldEdges;
- TopTools_ListOfShape aLS;
- TopTools_ListIteratorOfListOfShape aIt;
+ BOPCol_ListOfShape aLS;
+ BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
uses
Shape from TopoDS,
ListOfShape from TopTools,
+ ListOfShape from BOPCol,
--
PPaveFiller from BOPAlgo,
PaveFiller from BOPAlgo,
---Purpose: Returns the additional tolerance
SetArguments(me:out;
- theLS: ListOfShape from TopTools);
+ theLS: ListOfShape from BOPCol);
---Purpose: Sets the arguments
Arguments(me)
- returns ListOfShape from TopTools;
+ returns ListOfShape from BOPCol;
---C++: return const &
---Purpose: Gets the arguments
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
- myArguments : ListOfShape from TopTools is protected;
+ myArguments : ListOfShape from BOPCol is protected;
end BuilderAlgo;
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetArguments
- (const TopTools_ListOfShape& theLS)
+ (const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
}
//function : Arguments
//purpose :
//=======================================================================
-const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
+const BOPCol_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
{
return myArguments;
}
default:
{
IntPatch_PrmPrmIntersection interpp;
- interpp.Perform(S1,D1,TolArc,TolTang,myFleche,myUVMaxStep);
+ interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep);
if (interpp.IsDone())
{
done = Standard_True;
ParamParamPerfom(theS1, theD1, theS2, theD2, TolArc,
TolTang, ListOfPnts, RestrictLine, typs1, typs2);
}
-}
+ }
//=======================================================================
//function : Perform
TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2);
}
}
-}
+ }
//=======================================================================
//function : ParamParamPerfom
Standard_Boolean ClearFlag = Standard_True;
if(!ListOfPnts.IsEmpty())
{
- interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
+ interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts, RestrictLine);
ClearFlag = Standard_False;
}
- interpp.Perform(theS1,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!!
+ interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag); //double call!!!!!!!
}
else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()))
{
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS);
- interpp.Perform(SS,theD1,theS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+ interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
}
else
{
const Standard_Real AP = Max(MU, MV);
Handle(Adaptor3d_HSurface) SS;
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS);
- interpp.Perform(theS1, theD1, SS, theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+ interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep);
}
}//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())
else
Handle(Adaptor3d_HSurface) nS1 = theS1;
Handle(Adaptor3d_HSurface) nS2 = theS2;
FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2);
- interpp.Perform(nS1,theD1,nS2,theD2,TolArc,TolTang,myFleche,myUVMaxStep);
+ interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
}// 'NON - COLLINEAR LINES'
}// both domains are infinite
}
JoinWLines( slin, spnt, theTolTang,
- theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
- theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
- theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
- theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
+ theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
+ theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
+ theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
+ theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
theS1->FirstUParameter(), theS1->LastUParameter(),
theS1->FirstVParameter(), theS1->LastVParameter(),
theS2->FirstUParameter(), theS2->LastUParameter(),
else
{
IntPatch_PrmPrmIntersection interpp;
- interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolArc,TolTang,myFleche,myUVMaxStep);
+ interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolTang,TolArc,myFleche,myUVMaxStep);
if (interpp.IsDone())
{
done = Standard_True;
for (; i<=nblm; i++) slin.Append(interpp.Line(i));
}
}
-}
+ }
//======================================================================
#include <IntPatch_IType.hxx>
#include <IntPatch_LineConstructor.hxx>
NR1[nbR1]=0;
nbR1++;
}
- for(D2->Init();D2->More() && nbR2<MAXR; D2->Next()) {
+ for(D2->Init();D2->More() && nbR2<MAXR; D2->Next()) {
R2[nbR2]=D2->Value();
NR2[nbR2]=0;
nbR2++;
const Handle(IntPatch_WLine) &theWLine,
const Standard_Real Deflection);
+static void SeveralWlinesProcessing(const Handle(Adaptor3d_HSurface)& theSurf1,
+ const Handle(Adaptor3d_HSurface)& theSurf2,
+ const IntPatch_SequenceOfLine& theSLin,
+ const Standard_Real* const thePeriodsArr,
+ const IntSurf_TypeTrans theTrans1,
+ const IntSurf_TypeTrans theTrans2,
+ const Standard_Real theTol,
+ const Standard_Real theMaxStepS1,
+ const Standard_Real theMaxStepS2,
+ Handle(IntPatch_WLine)& theWLline)
+{
+ if(theSLin.Length() == 0)
+ return;
+
+ Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
+
+ Standard_Integer cnbV = theWLline->NbVertex();
+ Standard_Integer ciV;
+ for( ciV = 1; ciV <= cnbV; ciV++ )
+ {
+ Standard_Real pntDMin = 1.e+100;
+ Standard_Integer VDMin = 0;
+ Standard_Integer WLDMin = 0;
+ gp_Pnt cPV = theWLline->Vertex(ciV).Value();
+ theWLline->Vertex(ciV).Parameters(aU1, aV1, aU2, aV2);
+ const gp_Pnt2d aPCS1(aU1, aV1), aPCS2(aU2, aV2);
+ Standard_Integer iL;
+ for( iL = 1; iL <= theSLin.Length(); iL++)
+ {
+ const Handle(IntPatch_Line)& aSLine = theSLin.Value(iL);
+ IntPatch_IType aType = aSLine->ArcType();
+ if( aType != IntPatch_Walking)
+ continue;
+ const Handle(IntPatch_WLine) aWLine = Handle(IntPatch_WLine)::DownCast(aSLine);
+ Standard_Integer tnbV = aWLine->NbVertex();
+ Standard_Integer tiV;
+ for( tiV = 1; tiV <= tnbV; tiV++ )
+ {
+ gp_Pnt tPV = aWLine->Vertex(tiV).Value();
+
+ aWLine->Vertex(tiV).Parameters(aU1, aV1, aU2, aV2);
+ const gp_Pnt2d aPTS1(aU1, aV1), aPTS2(aU2, aV2);
+
+ Standard_Real tDistance = cPV.Distance(tPV);
+ Standard_Real uRs1 = theSurf1->Surface().UResolution(tDistance);
+ Standard_Real vRs1 = theSurf1->Surface().VResolution(tDistance);
+ Standard_Real uRs2 = theSurf2->Surface().UResolution(tDistance);
+ Standard_Real vRs2 = theSurf2->Surface().VResolution(tDistance);
+ Standard_Real RmaxS1 = Max(uRs1,vRs1);
+ Standard_Real RmaxS2 = Max(uRs2,vRs2);
+
+ if(RmaxS1 < theMaxStepS1 && RmaxS2 < theMaxStepS2)
+ {
+ if( pntDMin > tDistance && tDistance > Precision::PConfusion())
+ {
+ const Standard_Real aSqDist1 = aPCS1.SquareDistance(aPTS1),
+ aSqDist2 = aPCS2.SquareDistance(aPTS2);
+ if((aSqDist1 < RmaxS1*RmaxS1) && (aSqDist2 < RmaxS2*RmaxS2))
+ {
+ pntDMin = tDistance;
+ VDMin = tiV;
+ WLDMin = iL;
+ }
+ }
+ }
+ }
+ }
+
+ if( VDMin != 0 )
+ {
+ const Handle(IntPatch_Line)& aSLine = theSLin.Value(WLDMin);
+ const Handle(IntPatch_WLine) aWLine = Handle(IntPatch_WLine)::DownCast(aSLine);
+ Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
+ Standard_Integer ciVpar = (Standard_Integer)theWLline->Vertex(ciV).ParameterOnLine();
+ Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
+ Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
+ theWLline->Point(ciVpar).Parameters(u11,v11,u12,v12);
+ aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
+
+ Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
+ IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
+ Standard_Integer cNbP = theWLline->NbPnts();
+
+ TColStd_SequenceOfInteger VPold;
+ Standard_Integer iPo;
+ for( iPo = 1; iPo <= cnbV; iPo++ )
+ {
+ Standard_Real Po = theWLline->Vertex(iPo).ParameterOnLine();
+ Standard_Integer IPo = (Standard_Integer) Po;
+ VPold.Append(IPo);
+ }
+
+ Standard_Boolean removeNext = Standard_False;
+ Standard_Boolean removePrev = Standard_False;
+ if( ciV == 1)
+ {
+ Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
+ if(dPar > 10)
+ {
+ removeNext = Standard_True;
+ for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+ VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+ }
+ }
+ else if( ciV == cnbV)
+ {
+ Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+ if(dPar > 10)
+ {
+ removePrev = Standard_True;
+ VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+ }
+ }
+ else
+ {
+ Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
+ Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
+ if(dParMi > 10)
+ {
+ removePrev = Standard_True;
+ VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
+ }
+
+ if(dParMa > 10)
+ {
+ removeNext = Standard_True;
+ for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+ {
+ if(dParMi > 10)
+ VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
+ else
+ VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+ }
+ }
+ else
+ {
+ if(dParMi > 10)
+ for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
+ VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
+ }
+ }
+
+ Standard_Integer pI = ciVpar;
+
+ Standard_Integer iP;
+ for( iP = 1; iP <= cNbP; iP++)
+ {
+ if( pI == iP )
+ {
+ IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, theWLline->Point(iP), thePeriodsArr);
+ newL2s->Add(newPnt);
+ }
+ else if(removeNext && iP == (pI + 1))
+ continue;
+ else if(removePrev && iP == (pI - 1))
+ continue;
+ else
+ newL2s->Add(theWLline->Point(iP));
+ }
+
+ IntPatch_Point newVtx;
+ gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
+ newVtx.SetValue(Pnt3dV,theTol,Standard_False);
+ newVtx.SetParameters(u21,v21,u22,v22);
+ newVtx.SetParameter(VPold.Value(ciV));
+
+ Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,theTrans1,theTrans2);
+
+ Standard_Integer iV;
+ for( iV = 1; iV <= cnbV; iV++ )
+ {
+ if( iV == ciV )
+ NWLine->AddVertex(newVtx);
+ else
+ {
+ IntPatch_Point theVtx = theWLline->Vertex(iV);
+ theVtx.SetParameter(VPold.Value(iV));
+ NWLine->AddVertex(theVtx);
+ }
+ }
+
+ theWLline = NWLine;
+ }//if( VDMin != 0 )
+ }//for( ciV = 1; ciV <= cnbV; ciV++ )
+}
+
//=======================================================================
//function : DublicateOfLinesProcessing
//purpose : Decides, if rejecting current line is necessary
wline->AddVertex(vtx);
}
- Standard_Integer slinlen = SLin.Length();
- if( slinlen > 0 ) {
- Standard_Integer cnbV = wline->NbVertex();
- Standard_Integer ciV;
- for( ciV = 1; ciV <= cnbV; ciV++ ) {
- Standard_Real pntDMin = 1.e+100;
- Standard_Integer VDMin = 0;
- Standard_Integer WLDMin = 0;
- gp_Pnt cPV = wline->Vertex(ciV).Value();
- Standard_Integer iL;
- for( iL = 1; iL <= slinlen; iL++) {
- const Handle(IntPatch_Line)& aSLine = SLin.Value(iL);
- IntPatch_IType aType = aSLine->ArcType();
- if( aType != IntPatch_Walking)
- continue;
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
- Standard_Integer tnbV = aWLine->NbVertex();
- Standard_Integer tiV;
- for( tiV = 1; tiV <= tnbV; tiV++ ) {
- gp_Pnt tPV = aWLine->Vertex(tiV).Value();
- Standard_Real tDistance = cPV.Distance(tPV);
- Standard_Real uRs1 = Surf1->Surface().UResolution(tDistance);
- Standard_Real vRs1 = Surf1->Surface().VResolution(tDistance);
- Standard_Real uRs2 = Surf2->Surface().UResolution(tDistance);
- Standard_Real vRs2 = Surf2->Surface().VResolution(tDistance);
- Standard_Real RmaxS1 = Max(uRs1,vRs1);
- Standard_Real RmaxS2 = Max(uRs2,vRs2);
- if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4) {
- if( pntDMin > tDistance && tDistance > 1.e-9) {
- pntDMin = tDistance;
- VDMin = tiV;
- WLDMin = iL;
- }
- }
- }
- }
-
- if( VDMin != 0 ) {
- const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
- Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
- Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
- Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
- Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
- wline->Point(ciVpar).Parameters(u11,v11,u12,v12);
- aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
-
- Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
- IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
- Standard_Integer cNbP = wline->NbPnts();
-
- TColStd_SequenceOfInteger VPold;
- Standard_Integer iPo;
- for( iPo = 1; iPo <= cnbV; iPo++ ) {
- Standard_Real Po = wline->Vertex(iPo).ParameterOnLine();
- Standard_Integer IPo = (Standard_Integer) Po;
- VPold.Append(IPo);
- }
-
- Standard_Boolean removeNext = Standard_False;
- Standard_Boolean removePrev = Standard_False;
- if( ciV == 1) {
- Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
- if(dPar > 10) {
- removeNext = Standard_True;
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
- else if( ciV == cnbV) {
- Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
- if(dPar > 10) {
- removePrev = Standard_True;
- VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
- }
- }
- else {
- Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
- Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
- if(dParMi > 10) {
- removePrev = Standard_True;
- VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
- }
- if(dParMa > 10) {
- removeNext = Standard_True;
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ ) {
- if(dParMi > 10)
- VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
- else
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
- else {
- if(dParMi > 10)
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
- Standard_Integer pI = (Standard_Integer) ciVpar;
-
- Standard_Integer iP;
- for( iP = 1; iP <= cNbP; iP++) {
- if( pI == iP )
- {
- IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
- newL2s->Add(newPnt);
- }
- else if(removeNext && iP == (pI + 1))
- continue;
- else if(removePrev && iP == (pI - 1))
- continue;
- else
- newL2s->Add(wline->Point(iP));
- }
-
- IntPatch_Point newVtx;
- gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
- newVtx.SetValue(Pnt3dV,TolTang,Standard_False);
- newVtx.SetParameters(u21,v21,u22,v22);
- newVtx.SetParameter(VPold.Value(ciV));
-
- Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,trans1,trans2);
-
- Standard_Integer iV;
- for( iV = 1; iV <= cnbV; iV++ ) {
- if( iV == ciV )
- NWLine->AddVertex(newVtx);
- else {
- IntPatch_Point theVtx = wline->Vertex(iV);
- theVtx.SetParameter(VPold.Value(iV));
- NWLine->AddVertex(theVtx);
- }
- }
-
- wline = NWLine;
- }
- }
- }// SLin.Length > 0
+ SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
+ TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
+ Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
lignetrouvee = Standard_True;
- Standard_Integer slinlen = SLin.Length();
- if( slinlen > 0 )
- {
- Standard_Integer cnbV = wline->NbVertex();
- Standard_Integer ciV;
- for( ciV = 1; ciV <= cnbV; ciV++ )
- {
- Standard_Real pntDMin = 1.e+100;
- Standard_Integer VDMin = 0;
- Standard_Integer WLDMin = 0;
- gp_Pnt cPV = wline->Vertex(ciV).Value();
- Standard_Integer iL;
- for( iL = 1; iL <= slinlen; iL++)
- {
- const Handle(IntPatch_Line)& aSLine = SLin.Value(iL);
- IntPatch_IType aType = aSLine->ArcType();
- if( aType != IntPatch_Walking)
- continue;
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
- Standard_Integer tnbV = aWLine->NbVertex();
- Standard_Integer tiV;
- for( tiV = 1; tiV <= tnbV; tiV++ )
- {
- gp_Pnt tPV = aWLine->Vertex(tiV).Value();
- Standard_Real tDistance = cPV.Distance(tPV);
- Standard_Real uRs1 = Surf1->Surface().UResolution(tDistance);
- Standard_Real vRs1 = Surf1->Surface().VResolution(tDistance);
- Standard_Real uRs2 = Surf2->Surface().UResolution(tDistance);
- Standard_Real vRs2 = Surf2->Surface().VResolution(tDistance);
- Standard_Real RmaxS1 = Max(uRs1,vRs1);
- Standard_Real RmaxS2 = Max(uRs2,vRs2);
- if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4)
- {
- if( pntDMin > tDistance && tDistance > 1.e-9)
- {
- pntDMin = tDistance;
- VDMin = tiV;
- WLDMin = iL;
- }
- }
- }
- }
-
- if( VDMin != 0 )
- {
- const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
- Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
- Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
- Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
- Standard_Real u21 = 0., u22 = 0., v21 = 0., v22 = 0.;
- wline->Point(ciVpar).Parameters(u11,v11,u12,v12);
- aWLine->Point(tiVpar).Parameters(u21,v21,u22,v22);
-
- Handle(IntSurf_LineOn2S) newL2s = new IntSurf_LineOn2S();
- IntSurf_PntOn2S replacePnt = aWLine->Point(tiVpar);
- Standard_Integer cNbP = wline->NbPnts();
-
- TColStd_SequenceOfInteger VPold;
- Standard_Integer iPo;
- for( iPo = 1; iPo <= cnbV; iPo++ )
- {
- Standard_Real Po = wline->Vertex(iPo).ParameterOnLine();
- Standard_Integer IPo = (Standard_Integer) Po;
- VPold.Append(IPo);
- }
-
- Standard_Boolean removeNext = Standard_False;
- Standard_Boolean removePrev = Standard_False;
- if( ciV == 1)
- {
- Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
- if(dPar > 10)
- {
- removeNext = Standard_True;
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
- else if( ciV == cnbV)
- {
- Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
- if(dPar > 10)
- {
- removePrev = Standard_True;
- VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
- }
- }
- else
- {
- Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
- Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
- if(dParMi > 10)
- {
- removePrev = Standard_True;
- VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
- }
-
- if(dParMa > 10)
- {
- removeNext = Standard_True;
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
- {
- if(dParMi > 10)
- VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
- else
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
- else
- {
- if(dParMi > 10)
- for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
- VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
- }
- }
-
- Standard_Integer pI = ciVpar;
-
- Standard_Integer iP;
- for( iP = 1; iP <= cNbP; iP++)
- {
- if( pI == iP )
- {
- IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
- newL2s->Add(newPnt);
- }
- else if(removeNext && iP == (pI + 1))
- continue;
- else if(removePrev && iP == (pI - 1))
- continue;
- else
- newL2s->Add(wline->Point(iP));
- }
-
- IntPatch_Point newVtx;
- gp_Pnt Pnt3dV = aWLine->Vertex(VDMin).Value();
- newVtx.SetValue(Pnt3dV,TolTang,Standard_False);
- newVtx.SetParameters(u21,v21,u22,v22);
- newVtx.SetParameter(VPold.Value(ciV));
-
- Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,trans1,trans2);
-
- Standard_Integer iV;
- for( iV = 1; iV <= cnbV; iV++ )
- {
- if( iV == ciV )
- NWLine->AddVertex(newVtx);
- else
- {
- IntPatch_Point theVtx = wline->Vertex(iV);
- theVtx.SetParameter(VPold.Value(iV));
- NWLine->AddVertex(theVtx);
- }
- }
-
- wline = NWLine;
- }//if( VDMin != 0 )
- }//for( ciV = 1; ciV <= cnbV; ciV++ )
- }// SLin.Length > 0
+ SeveralWlinesProcessing(Surf1, Surf2, SLin, Periods, trans1, trans2,
+ TolTang, Max(PW.MaxStep(0), PW.MaxStep(1)),
+ Max(PW.MaxStep(2), PW.MaxStep(3)), wline);
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
--- 2. the edge does not contain 3d curve and pcurves (-2)
--- 3. projection algorithm failed (-3)
---
-
+
+ ComputeVE (me:mutable;
+ aV : Vertex from TopoDS;
+ aE : Edge from TopoDS;
+ aT :out Real from Standard;
+ aTolVnew:out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes parameter of the vertex aV on
+ --- the edge aE.
+ --- Returns zero if the distance between vertex
+ --- and edge is less than sum of tolerances,
+ --- otherwise and for following conditions returns
+ --- negative value
+ --- 1. the edge is degenerated (-1)
+ --- 2. the edge does not contain 3d curve and pcurves (-2)
+ --- 3. projection algorithm failed (-3)
+
ComputeVF (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
--- 2. distance is more than sum of tolerances (-2)
--- 3. projection point out or on the boundaries of face (-3)
---
+
+ ComputeVF (me:mutable;
+ aV : Vertex from TopoDS;
+ aF : Face from TopoDS;
+ U : out Real from Standard;
+ V : out Real from Standard;
+ aTolVnew:out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes UV parameters of the vertex aV on face aF
+ --- Returns zero if the distance between vertex and face is
+ --- less than or equal the sum of tolerances and the projection
+ --- point lays inside boundaries of the face.
+ --- For following conditions returns negative value
+ --- 1. projection algorithm failed (-1)
+ --- 2. distance is more than sum of tolerances (-2)
+ --- 3. projection point out or on the boundaries of face (-3)
StatePointFace(me:mutable;
aF : Face from TopoDS;
(const TopoDS_Vertex& aV1,
const TopoDS_Edge& aE2,
Standard_Real& aT)
+{
+ Standard_Real aTolVnew;
+ //
+ return ComputeVE(aV1, aE2, aT, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVE
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVE
+ (const TopoDS_Vertex& aV1,
+ const TopoDS_Edge& aE2,
+ Standard_Real& aT,
+ Standard_Real& aTolVnew)
{
if (BRep_Tool::Degenerated(aE2)) {
return -1;
aTolE2=BRep_Tool::Tolerance(aE2);
aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
//
+ aTolVnew=aDist+aTolE2;
+ //
aT=aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
return -4;
return 0;
}
//=======================================================================
-//function : ComputeVS
+//function : ComputeVF
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVF
const TopoDS_Face& aF2,
Standard_Real& U,
Standard_Real& V)
+{
+ Standard_Real aTolVnew;
+ //
+ return ComputeVF(aV1, aF2, U, V, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVF
+//purpose :
+//=======================================================================
+Standard_Integer IntTools_Context::ComputeVF
+ (const TopoDS_Vertex& aV1,
+ const TopoDS_Face& aF2,
+ Standard_Real& U,
+ Standard_Real& V,
+ Standard_Real& aTolVnew)
{
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
gp_Pnt aP;
aTolV1=BRep_Tool::Tolerance(aV1);
aTolF2=BRep_Tool::Tolerance(aF2);
- aTolSum=aTolV1+aTolF2;
+ //
+ aTolSum=aTolV1 + aTolF2 + Precision::Confusion();
+ aTolVnew=aDist+aTolF2;
+ //
if (aDist > aTolSum) {
// the distance is too large
return -2;
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
const TopoDS_Face& aFace);
-//
static
Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
const Standard_Real aT,
GeomAPI_ProjectPointOnSurf& theProjPS);
+
static
Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theC,
const Standard_Real theFirst,
const Standard_Real theLast,
GeomAPI_ProjectPointOnSurf& theProjPS,
const Standard_Real theEps);
+
static
Standard_Real FindMaxDistance(const Handle(Geom_Curve)& theCurve,
const Standard_Real theFirst,
aS1 = myHS1->ChangeSurface().Surface();
aS2 = myHS2->ChangeSurface().Surface();
//
- for (i = 1; i <= aNbLin; ++i) {
+ for (i = 1; i <= aNbLin; ++i)
+ {
const IntTools_Curve& aIC = mySeqOfCurve(i);
const Handle(Geom_Curve)& aC3D = aIC.Curve();
- if (aC3D.IsNull()) {
+ if (aC3D.IsNull())
+ {
continue;
}
//
const Handle(Geom2d_Curve)& aC2D1 = aIC.FirstCurve2d();
const Handle(Geom2d_Curve)& aC2D2 = aIC.SecondCurve2d();
//
- for (j = 0; j < 2; ++j) {
+ for (j = 0; j < 2; ++j)
+ {
const Handle(Geom2d_Curve)& aC2D = !j ? aC2D1 : aC2D2;
const Handle(Geom_Surface)& aS = !j ? aS1 : aS2;
//
- if (!aC2D.IsNull()) {
+ if (!aC2D.IsNull())
+ {
if (IntTools_Tools::ComputeTolerance
- (aC3D, aC2D, aS, aFirst, aLast, aD, aT)) {
- if (aD > aDMax) {
+ (aC3D, aC2D, aS, aFirst, aLast, aD, aT))
+ {
+ if (aD > aDMax)
+ {
aDMax = aD;
}
}
}
- //
- const TopoDS_Face& aF = !i ? myFace1 : myFace2;
- aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
- if (aD > aDMax) {
- aDMax = aD;
- }
+ else
+ {
+ const TopoDS_Face& aF = !j ? myFace1 : myFace2;
+ aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
+ if (aD > aDMax)
+ {
+ aDMax = aD;
+ }
+ }
}
}
//
//=======================================================================
void IntTools_FaceFace::ComputeTolReached3d()
{
- Standard_Integer aNbLin, i;
+ Standard_Integer aNbLin;
GeomAbs_SurfaceType aType1, aType2;
//
aNbLin=myIntersector.NbLines();
aType1=myHS1->Surface().GetType();
aType2=myHS2->Surface().GetType();
//
- if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
- if (aNbLin==2){
+ if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder)
+ {
+ if (aNbLin==2)
+ {
Handle(IntPatch_Line) aIL1, aIL2;
IntPatch_IType aTL1, aTL2;
//
aL2=Handle(IntPatch_GLine)::DownCast(aIL2)->Line();
aD=aL1.Distance(aL2);
aD=0.5*aD;
- if (aD<aDTresh) {
+ if (aD<aDTresh)
+ {//In order to avoid creation too thin face
myTolReached3d=aD+dTol;
}
- return;
}
}
- //ZZ
- if (aNbLin) {// Check the distances
- Standard_Real aDMax;
- //
- aDMax = ComputeTolerance();
- if (aDMax > 0.) {
- myTolReached3d = aDMax;
- }
- }// if (aNbLin)
}// if (aType1==GeomAbs_Cylinder && aType2==GeomAbs_Cylinder) {
//
- //904/G3 f
- else if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
- Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
- //
- aTolTresh=1.e-7;
- //
- aTolF1 = BRep_Tool::Tolerance(myFace1);
- aTolF2 = BRep_Tool::Tolerance(myFace2);
- aTolFMax=Max(aTolF1, aTolF2);
- //
- if (aTolFMax>aTolTresh) {
- myTolReached3d=aTolFMax;
- }
- }//if (aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
- //t
- //IFV Bug OCC20297
- else if((aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane) ||
- (aType2 == GeomAbs_Cylinder && aType1 == GeomAbs_Plane)) {
- if(aNbLin == 1) {
- const Handle(IntPatch_Line)& aIL1 = myIntersector.Line(1);
- if(aIL1->ArcType() == IntPatch_Circle) {
- gp_Circ aCir = Handle(IntPatch_GLine)::DownCast(aIL1)->Circle();
- gp_XYZ aCirDir = aCir.Axis().Direction().XYZ();
- gp_XYZ aPlDir;
- gp_Pln aPln;
- if(aType1 == GeomAbs_Plane) {
- aPln = myHS1->Surface().Plane();
- }
- else {
- aPln = myHS2->Surface().Plane();
- }
- aPlDir = aPln.Axis().Direction().XYZ();
- Standard_Real cs = aCirDir*aPlDir;
- if(cs < 0.) aPlDir.Reverse();
- Standard_Real eps = 1.e-14;
- if(!aPlDir.IsEqual(aCirDir, eps)) {
- Standard_Integer aNbP = 11;
- Standard_Real dt = 2.*M_PI / (aNbP - 1), t;
- for(t = 0.; t < 2.*M_PI; t += dt) {
- Standard_Real d = aPln.Distance(ElCLib::Value(t, aCir));
- if(myTolReached3d < d) myTolReached3d = d;
- }
- myTolReached3d *= 1.1;
- }
- } //aIL1->ArcType() == IntPatch_Circle
- } //aNbLin == 1
- } // aType1 == GeomAbs_Cylinder && aType2 == GeomAbs_Plane)
- //End IFV Bug OCC20297
- //
- else if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
- (aType2==GeomAbs_Plane && aType1==GeomAbs_Torus)) {
- aNbLin=mySeqOfCurve.Length();
- if (aNbLin!=1) {
- return;
- }
- //
- Standard_Integer aNbP;
- Standard_Real aT, aT1, aT2, dT, aUT, aVT, aUP, aVP;
- Standard_Real aDP, aDT, aDmax;
- gp_Pln aPln;
- gp_Torus aTorus;
- gp_Pnt aP, aPP, aPT;
- //
- const IntTools_Curve& aIC=mySeqOfCurve(1);
- const Handle(Geom_Curve)& aC3D=aIC.Curve();
- const Handle(Geom_BSplineCurve)& aBS=
- Handle(Geom_BSplineCurve)::DownCast(aC3D);
- if (aBS.IsNull()) {
- return;
- }
- //
- aT1=aBS->FirstParameter();
- aT2=aBS->LastParameter();
- //
- aPln =(aType1==GeomAbs_Plane) ? myHS1->Plane() : myHS2->Plane();
- aTorus=(aType1==GeomAbs_Plane) ? myHS2->Torus() : myHS1->Torus();
- //
- aDmax=-1.;
- aNbP=11;
- dT=(aT2-aT1)/(aNbP-1);
- for (i=0; i<aNbP; ++i) {
- aT=aT1+i*dT;
- if (i==aNbP-1) {
- aT=aT2;
- }
- //
- aC3D->D0(aT, aP);
- //
- ElSLib::Parameters(aPln, aP, aUP, aVP);
- aPP=ElSLib::Value(aUP, aVP, aPln);
- aDP=aP.SquareDistance(aPP);
- if (aDP>aDmax) {
- aDmax=aDP;
- }
- //
- ElSLib::Parameters(aTorus, aP, aUT, aVT);
- aPT=ElSLib::Value(aUT, aVT, aTorus);
- aDT=aP.SquareDistance(aPT);
- if (aDT>aDmax) {
- aDmax=aDT;
- }
- }
- //
- if (aDmax > myTolReached3d*myTolReached3d) {
- myTolReached3d=sqrt(aDmax);
- myTolReached3d=1.1*myTolReached3d;
- }
- }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
- //
- else if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
- (aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder) ||
- (aType1==GeomAbs_Plane && aType2==GeomAbs_Sphere) ||
- (aType2==GeomAbs_Plane && aType1==GeomAbs_Sphere) ||
- (aType1==GeomAbs_Plane && aType2==GeomAbs_SurfaceOfExtrusion) ||
- (aType2==GeomAbs_Plane && aType1==GeomAbs_SurfaceOfExtrusion) ||
- (aType1==GeomAbs_Plane && aType2==GeomAbs_BSplineSurface) ||
- (aType2==GeomAbs_Plane && aType1==GeomAbs_BSplineSurface) ||
- !myApprox) {
- //
- Standard_Real aDMax;
- //
- aDMax = ComputeTolerance();
- if (aDMax > myTolReached3d) {
+
+ Standard_Real aDMax = ComputeTolerance();
+ if (aDMax > myTolReached3d)
+ {
myTolReached3d = aDMax;
}
}
-}
//=======================================================================
//function : MakeCurve
}
aV2D.SetCoord(aC[0], aC[1]);
}
+
//=======================================================================
// Function : FindMaxDistance
// purpose :
//
return aDMax;
}
+
//=======================================================================
// Function : FindMaxDistance
// purpose :
//
return aF;
}
+
//=======================================================================
// Function : MaxDistance
// purpose :
return;
}
//
- aTol1 = aTolV1+aTolE;
- aTol2 = aTolV2+aTolE;
+ //aTol1 = aTolV1+aTolE;
+ //aTol2 = aTolV2+aTolE;
+ aTol1 = Max(aTolV1, aTolE);
+ aTol2 = Max(aTolV2, aTolE);
//
aCoeff1 = (aTolE>0.05) ? 1. : 2.;
aCoeff2 = aCoeff1;
is
enumeration StatusDeflection is
- PasTropGrand, PointConfondu, ArretSurPointPrecedent,
+ PasTropGrand, StepTooSmall, PointConfondu, ArretSurPointPrecedent,
ArretSurPoint, OK;
--- StepTooGreat, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
+-- StepTooGreat, StepTooSmall, ConfusedPoint, StopOnPreviousPoint, StopOnPoint, OK
--class of result objects marching on a biparametric surface
raises NotDone from StdFail
is static;
+
+
+ MaxStep(me ; Index : Integer from Standard)
+
+ ---Purpose: Returns the point of range Index on the polyline.
+ -- An exception is raised if IsDone returns False.
+ -- An exception is raised if Index<=0 or Index>NbPoints.
+ returns Real from Standard
+ ---C++: inline
+
+ raises OutOfRange from Standard
+
+ is static;
+
TangentAtLine(me; Index: out Integer from Standard)
POn2S : PntOn2S from IntSurf ) ;
---C++: inline
+ ComputePasInit(me : in out;
+ theDeltaU1, theDeltaV1, theDeltaU2, theDeltaV2: Real from Standard)
+
+ is protected;
+
+
ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric from IntImp;
theDirectionFlag: Boolean from Standard)
returns Boolean from Standard
fleche : Real from Standard; -- max possible vector
pasMax : Real from Standard; -- max possible uv ratio
tolconf : Real from Standard; -- tol of confusion of 2 points
+ myTolTang : Real from Standard;
pasuv : Real from Standard[4];-- uv step on squares
pasSav : Real from Standard[4];-- first saved step
pasInit : Real from Standard[4];-- saving of steps
+ myStepMin : Real from Standard[4];
Um1 : Real from Standard;
UM1 : Real from Standard;
#include <Extrema_GenLocateExtPS.hxx>
//==================================================================================
-// function : IntWalk_PWalking::IntWalk_PWalking
-// purpose :
-// estimate of max step : To avoid abrupt changes
-// during change of isos
+// function : ComputePasInit
+// purpose : estimate of max step : To avoid abrupt changes during change of isos
//==================================================================================
-void ComputePasInit(Standard_Real *pasuv,
- Standard_Real Um1,Standard_Real UM1,
- Standard_Real Vm1,Standard_Real VM1,
- Standard_Real Um2,Standard_Real UM2,
- Standard_Real Vm2,Standard_Real VM2,
- Standard_Real _Um1,Standard_Real _UM1,
- Standard_Real _Vm1,Standard_Real _VM1,
- Standard_Real _Um2,Standard_Real _UM2,
- Standard_Real _Vm2,Standard_Real _VM2,
- const Handle(Adaptor3d_HSurface)& Caro1,
- const Handle(Adaptor3d_HSurface)& Caro2,
- const Standard_Real Increment,
- const Standard_Real tolconf)
-{
- Standard_Real du1=Abs(UM1-Um1);
- Standard_Real dv1=Abs(VM1-Vm1);
- Standard_Real du2=Abs(UM2-Um2);
- Standard_Real dv2=Abs(VM2-Vm2);
-
- Standard_Real _du1=Abs(_UM1-_Um1);
- Standard_Real _dv1=Abs(_VM1-_Vm1);
- Standard_Real _du2=Abs(_UM2-_Um2);
- Standard_Real _dv2=Abs(_VM2-_Vm2);
+void IntWalk_PWalking::ComputePasInit(const Standard_Real theDeltaU1,
+ const Standard_Real theDeltaV1,
+ const Standard_Real theDeltaU2,
+ const Standard_Real theDeltaV2)
+{
+ const Standard_Real aRangePart = 0.01;
+ const Standard_Real Increment = 2.0*pasMax;
+ const Handle(Adaptor3d_HSurface)&
+ Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
+ const Handle(Adaptor3d_HSurface)&
+ Caro2 = myIntersectionOn2S.Function().AuxillarSurface2();
+
+ const Standard_Real aDeltaU1=Abs(UM1-Um1);
+ const Standard_Real aDeltaV1=Abs(VM1-Vm1);
+ const Standard_Real aDeltaU2=Abs(UM2-Um2);
+ const Standard_Real aDeltaV2=Abs(VM2-Vm2);
//-- limit the reduction of uv box estimate to 0.01 natural box
- //-- du1 : On box of Inter
- //-- _du1 : On parametric space
- if(_du1<1e50 && du1<0.01*_du1) du1=0.01*_du1;
- if(_dv1<1e50 && dv1<0.01*_dv1) dv1=0.01*_dv1;
- if(_du2<1e50 && du2<0.01*_du2) du2=0.01*_du2;
- if(_dv2<1e50 && dv2<0.01*_dv2) dv2=0.01*_dv2;
-
- pasuv[0]=Increment*du1;
- pasuv[1]=Increment*dv1;
- pasuv[2]=Increment*du2;
- pasuv[3]=Increment*dv2;
-
- Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
- Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
- Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
- Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
-
- if (pasuv[0] < 2*ResoU1tol)
- pasuv[0] = 2*ResoU1tol;
- if (pasuv[1] < 2*ResoV1tol)
- pasuv[1] = 2*ResoV1tol;
- if (pasuv[2] < 2*ResoU2tol)
- pasuv[2] = 2*ResoU2tol;
- if (pasuv[3] < 2*ResoV2tol)
- pasuv[3] = 2*ResoV2tol;
+ //-- theDeltaU1 : On box of Inter
+ //-- aDeltaU1 : On parametric space
+ if(!Precision::IsInfinite(aDeltaU1))
+ pasuv[0]=Max(Increment*Max(theDeltaU1, aRangePart*aDeltaU1), pasuv[0]);
+ else
+ pasuv[0]=Max(Increment*theDeltaU1, pasuv[0]);
+
+ if(!Precision::IsInfinite(aDeltaV1))
+ pasuv[1]=Max(Increment*Max(theDeltaV1, aRangePart*aDeltaV1), pasuv[1]);
+ else
+ pasuv[1]=Max(Increment*theDeltaV1, pasuv[1]);
+
+ if(!Precision::IsInfinite(aDeltaU2))
+ pasuv[2]=Max(Increment*Max(theDeltaU2, aRangePart*aDeltaU2), pasuv[2]);
+ else
+ pasuv[2]=Max(Increment*theDeltaU2, pasuv[2]);
+
+ if(!Precision::IsInfinite(aDeltaV2))
+ pasuv[3]=Max(Increment*Max(theDeltaV2, aRangePart*aDeltaV2), pasuv[3]);
+ else
+ pasuv[3]=Max(Increment*theDeltaV2, pasuv[3]);
+
+ const Standard_Real ResoU1tol = Adaptor3d_HSurfaceTool::UResolution(Caro1, tolconf);
+ const Standard_Real ResoV1tol = Adaptor3d_HSurfaceTool::VResolution(Caro1, tolconf);
+ const Standard_Real ResoU2tol = Adaptor3d_HSurfaceTool::UResolution(Caro2, tolconf);
+ const Standard_Real ResoV2tol = Adaptor3d_HSurfaceTool::VResolution(Caro2, tolconf);
+
+ myStepMin[0] = Max(myStepMin[0], 2.0*ResoU1tol);
+ myStepMin[1] = Max(myStepMin[1], 2.0*ResoV1tol);
+ myStepMin[2] = Max(myStepMin[2], 2.0*ResoU2tol);
+ myStepMin[3] = Max(myStepMin[3], 2.0*ResoV2tol);
+
+ for(Standard_Integer i = 0; i < 4; i++)
+ {
+ pasuv[i]=Max(myStepMin[i], pasuv[i]);
+ }
}
//=======================================================================
close(Standard_False),
fleche(Deflection),
tolconf(Epsilon),
+myTolTang(TolTangency),
sensCheminement(1),
myIntersectionOn2S(Caro1,Caro2,TolTangency),
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
}
}
+ myStepMin[0] = 100.0*ResoU1;
+ myStepMin[1] = 100.0*ResoV1;
+ myStepMin[2] = 100.0*ResoU2;
+ myStepMin[3] = 100.0*ResoV2;
+
//-- ComputePasInit(pasuv,Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2);
for (Standard_Integer i = 0; i<=3;i++) {
close(Standard_False),
fleche(Deflection),
tolconf(Epsilon),
+myTolTang(TolTangency),
sensCheminement(1),
myIntersectionOn2S(Caro1,Caro2,TolTangency),
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
if(ResoV1>0.0001*pasuv[1]) ResoV1=0.00001*pasuv[1];
if(ResoU2>0.0001*pasuv[2]) ResoU2=0.00001*pasuv[2];
if(ResoV2>0.0001*pasuv[3]) ResoV2=0.00001*pasuv[3];
+
+ myStepMin[0] = 100.0*ResoU1;
+ myStepMin[1] = 100.0*ResoV1;
+ myStepMin[2] = 100.0*ResoU2;
+ myStepMin[3] = 100.0*ResoV2;
+
//
TColStd_Array1OfReal Par(1,4);
Par(1) = U1;
const Standard_Real theV10,
const Standard_Real theU20,
const Standard_Real theV20,
+ const Standard_Real theToler,
const Standard_Real theArrStep[])
{
{
}
}
- const Standard_Real aSQToler = 4.0e-14;
+ //For two faces (2^2 = 4)
+ const Standard_Real aSQToler = 4.0*theToler*theToler;
const Standard_Integer aNbItems = 4;
const Standard_Real aParUS1[aNbItems] = { theU10 + theArrStep[0],
theU10 - theArrStep[0],
const Standard_Real ULast2 = Adaptor3d_HSurfaceTool::LastUParameter (Caro2);
const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter (Caro2);
//
- ComputePasInit(pasuv,u1min,u1max,v1min,v1max,u2min,u2max,v2min,v2max,
- Um1,UM1,Vm1,VM1,Um2,UM2,Vm2,VM2,Caro1,Caro2,pasMax+pasMax,tolconf);
- //
- if(pasuv[0]<100.0*ResoU1) {
- pasuv[0]=100.0*ResoU1;
- }
- if(pasuv[1]<100.0*ResoV1) {
- pasuv[1]=100.0*ResoV1;
- }
- if(pasuv[2]<100.0*ResoU2) {
- pasuv[2]=100.0*ResoU2;
- }
- if(pasuv[3]<100.0*ResoV2) {
- pasuv[3]=100.0*ResoV2;
- }
- //
+ ComputePasInit(u1max - u1min,v1max - v1min,u2max - u2min,v2max - v2min);
+
for (Standard_Integer i=0; i<4; ++i)
{
if(pasuv[i]>10)
previousPoint.Parameters(Param(1),Param(2),Param(3),Param(4));
- if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), pasuv))
+ if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), myTolTang, pasuv))
return;
AddAPoint(line,previousPoint);
{
pastroppetit=Standard_True;
- if(pasuv[0]<pasInit[0])
- {
- pasuv[0]+=(pasInit[0]-pasuv[0])*0.25;
- pastroppetit=Standard_False;
- }
-
- if(pasuv[1]<pasInit[1])
- {
- pasuv[1]+=(pasInit[1]-pasuv[1])*0.25;
- pastroppetit=Standard_False;
- }
-
- if(pasuv[2]<pasInit[2])
- {
- pasuv[2]+=(pasInit[2]-pasuv[2])*0.25;
- pastroppetit=Standard_False;
- }
-
- if(pasuv[3]<pasInit[3])
+ for(Standard_Integer i = 0; i < 4; i++)
{
- pasuv[3]+=(pasInit[3]-pasuv[3])*0.25;
- pastroppetit=Standard_False;
+ if(pasuv[i]<pasInit[i])
+ {
+ pasuv[i]+=(pasInit[i]-pasuv[i])*0.25;
+ pastroppetit=Standard_False;
+ }
}
if(pastroppetit)
break;
}
+ case IntWalk_StepTooSmall:
+ {
+ Standard_Boolean hasStepBeenIncreased = Standard_False;
+
+ for(Standard_Integer i = 0; i < 4; i++)
+ {
+ const Standard_Real aNewStep = Min(1.5*pasuv[i], pasInit[i]);
+ if(aNewStep > pasuv[i])
+ {
+ pasuv[i] = aNewStep;
+ hasStepBeenIncreased = Standard_True;
+ }
+ }
+
+ if(hasStepBeenIncreased)
+ {
+ Param(1)=SvParam[0];
+ Param(2)=SvParam[1];
+ Param(3)=SvParam[2];
+ Param(4)=SvParam[3];
+
+ LevelOfIterWithoutAppend = 0;
+
+ break;
+ }
+ }
case IntWalk_OK:
case IntWalk_ArretSurPoint://006
{
if(RejectIndex >= RejectIndexMAX)
{
+ Arrive = Standard_True;
break;
}
if(RejectIndex >= RejectIndexMAX)
{
+ Arrive = Standard_True;
break;
}
if(RejectIndex >= RejectIndexMAX)
{
+ Arrive = Standard_True;
break;
}
aS1 = theASurf1->Surface().BSpline();
break;
default:
- return Standard_True;
+ return Standard_True;
}
switch(theASurf2->GetType())
aS2 = theASurf2->Surface().BSpline();
break;
default:
- return Standard_True;
+ return Standard_True;
}
Standard_Boolean aStatus = Standard_False;
}
IntWalk_StatusDeflection Status = IntWalk_OK;
- Standard_Real FlecheCourante ,Ratio;
+ Standard_Real FlecheCourante , Ratio = 1.0;
const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point();
const gp_Dir& TgCourante = myIntersectionOn2S.Direction();
+ const Standard_Real aCosBetweenTangent = TgCourante.Dot(previousd);
+
//==================================================================================
//========= R i s k o f i n f l e x i o n p o i n t ============
//==================================================================================
- if (TgCourante.Dot(previousd)<0) {
+ if (aCosBetweenTangent < 0) {
//------------------------------------------------------------
//-- Risk of inflexion point : Divide the step by 2
//-- Initialize STATIC_PRECEDENT_INFLEXION so that
else
return IntWalk_PasTropGrand;
}
-
else {
if(STATIC_PRECEDENT_INFLEXION > 0) {
STATIC_PRECEDENT_INFLEXION -- ;
//========= D e t e c t c o n f u s e d P o in t s ===========
//==================================================================================
- Standard_Real Dist = previousPoint.Value().
+ const Standard_Real aSqDist = previousPoint.Value().
SquareDistance(CurrentPoint.Value());
- if (Dist < tolconf*tolconf ) {
+ if (aSqDist < tolconf*tolconf) {
pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0]));
pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1]));
pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2]));
//-- Estimate of the vector --
//---------------------------------------
FlecheCourante =
- Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.;
+ Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*aSqDist))/8.;
if ( FlecheCourante<= fleche*0.5) { //-- Current step too small
if(FlecheCourante>1e-16) {
Ratio = 0.75 * (fleche / FlecheCourante);
}
}
- pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
- pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
- pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
- pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
+
+ if(Status != IntWalk_PointConfondu)
+ {
+ //Here, aCosBetweenTangent >= 0.0 definitely.
+
+ /*
+ Brief algorithm description.
+ We have two (not-coincindent) intersection point (P1 and P2). In every point,
+ vector of tangent (to the intersection curve) is known (vectors T1 and T2).
+ Basing on these data, we create osculating circle.
+
+ * - arc of osculating circle
+ * *
+ P1 x----------x P2
+ / \
+ / \
+ Vec(T1) Vec(T2)
+
+ Let me draw your attention to the following facts:
+ 1. Vectors T1 and T2 direct FROM (not TO) points P1 and P2. Therefore,
+ one of previously computed vector should be reversed.
+
+ In this case, the absolute (!) value of the deflection between the arc of
+ the osculating circle and the P1P2 segment can be computed as follows:
+ e = d*(1-sin(B/2))/(2*cos(B/2)), (1)
+ where d is the length of P1P2 segment, B is the angle between vectors T1 and T2.
+ At that,
+ pi/2 <= B <= pi,
+ cos(B/2) >= 0,
+ sin(B/2) > 0,
+ sin(B) > 0,
+ cos(B) < 0.
+
+ Later, the normal state of algorithm work is (as we apply)
+ tolconf/2 <= e <= tolconf.
+ In this case, we keep previous step.
+
+ If e < tolconf/2 then the local curvature of the intersection curve is small.
+ As result, the step should be increased.
+
+ If e > tolconf then the step is too big. Therefore, we should decrease one.
+
+ Condition (1) is equivalent to
+ sin(B/2) = 1 - 2/(1+(d/(2*e))^2) = Fs(e),
+ cos(B) = 1 - 2*Fs(e)^2 = Fd(e),
+ where Fs(e)and Fd(e) are some function with parameter "deflection".
+
+ Let mean that Fs(e) is decreasing function. Fd(e) is increasing function,
+ in the range, where Fs(e) > 0.0 (i.e. when e < d/2).
+
+ Now, let substitute required deflection (tolconf or tolconf/2) to z. Then
+ it is necessary to check if e < z or if e > z.
+
+ In this case, it is enough to comapare Fs(e) and Fs(z).
+ At that Fs(e) > 0 because sin(B/2) > 0 always.
+
+ Therefore, if Fs(z) < 0.0 then Fs(e) > Fs(z) ==> e < z definitely.
+ If Fs(z) > 0.0 then we can compare Fs(z)^2 and Fs(e)^2 or, in substance,
+ values Fd(e) and Fd(z). If Fd(e) > Fd(z) then e > z and vice versa.
+ */
+
+ //Fd(e) is already known (Fd(e) == -aCosBetweenTangent)
+
+ const Standard_Real anInvSqAbsArcDeflMax = 0.25*aSqDist/(tolconf*tolconf);
+ const Standard_Real aSinB2Max = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMax);
+
+ if(aSinB2Max >= 0.0 && (aCosBetweenTangent <= 2.0 * aSinB2Max * aSinB2Max - 1.0))
+ {//Real deflection is greater or equal than tolconf
+ Status = IntWalk_PasTropGrand;
+ }
+ else
+ {//Real deflection is less than tolconf
+ const Standard_Real anInvSqAbsArcDeflMin = 4.0*anInvSqAbsArcDeflMax;
+ const Standard_Real aSinB2Min = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMin);
+
+ if((aSinB2Min < 0.0) || (aCosBetweenTangent >= 2.0 * aSinB2Min * aSinB2Min - 1.0))
+ {//Real deflection is less than tolconf/2.0
+ Status = IntWalk_StepTooSmall;
+ }
+ }
+
+ if(Status == IntWalk_PasTropGrand)
+ {
+ pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
+ return Status;
+ }
+
+ if(Status == IntWalk_StepTooSmall)
+ {
+ pasuv[0] = Max(pasuv[0], AbsDu1);
+ pasuv[1] = Max(pasuv[1], AbsDv1);
+ pasuv[2] = Max(pasuv[2], AbsDu2);
+ pasuv[3] = Max(pasuv[3], AbsDv2);
+
+ pasInit[0] = Max(pasInit[0], AbsDu1);
+ pasInit[1] = Max(pasInit[1], AbsDv1);
+ pasInit[2] = Max(pasInit[2], AbsDu2);
+ pasInit[3] = Max(pasInit[3], AbsDv2);
+
+ return Status;
+ }
+ }
+
+ pasuv[0] = Max(myStepMin[0],Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
+ pasuv[1] = Max(myStepMin[1],Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
+ pasuv[2] = Max(myStepMin[2],Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
+ pasuv[3] = Max(myStepMin[3],Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
+
if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
return Status;
}
return tgdir;
}
+inline Standard_Real IntWalk_PWalking::MaxStep(Standard_Integer theIndex) const
+{
+ Standard_OutOfRange_Raise_if((theIndex < 0) || (theIndex > 3), "");
+ return pasInit[theIndex];
+}
+
#define REGLAGE 0
inline void IntWalk_PWalking::AddAPoint(Handle(IntSurf_LineOn2S)& theLine,
}
else
{
- theDI << "Info. Faulty shape if found in source shape\n";
+ theDI << "Info. Faulty shape is found in source shape\n";
}
}
}
}
else
{
- theDI << "Error. Problems are not detected. Test is not performed.";
+ theDI << "Problems are not detected. Test is not performed.";
}
return 0;
## Comment : From CV tests serie page 25/26
## ===========================================
+puts "TODO #OCC26740 ALL: Faulty shapes in variables faulty_1 to faulty_"
+
restore [locate_data_file CCV_1_h1_gsk.rle] s
explode s E
blend result s 30 s_14
-puts "TODO #23876 ALL: Error : The bopcut cannot be built."
-
restore [locate_data_file case_9_edge.brep] a
restore [locate_data_file case_9_wire3.brep] b
settolerance a 0.1
source [locate_data_file 20000_et1_401-ta6027.prt.2.gdml.tcl]
## image is differ from application
-set square 3.52888e+07
+set square 1.26259e+07
puts "TODO OCC26018 ALL: Error : The area of the resulting shape is"
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et3_401-ta6037.prt.2.gdml.tcl]
## image is differ from application
-puts "TODO ?OCC26017 Windows: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO ?OCC26017 Windows: Error : The area of the resulting shape is"
+puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO ?OCC26017 ALL: Error : The area of the resulting shape is"
puts "TODO ?OCC26017 ALL: Error : The gdml is not valid. The area is"
source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl]
-puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500.asm.1.gdml.tcl]
-
-puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500_piquage.prt.1.gdml.tcl]
-
puts "TODO OCC26020 ALL: Error: bopcheck failed"
puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 Linux: Error : The area of the resulting shape is"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
# planar face
plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339
# cone plane killed by cpulimit 300
# ? - because sometimes test is killed by elapsed time
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26020 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
puts "TODO ?OCC26020 Linux: \\*\\* Exception"
puts "TODO ?OCC26020 Linux: An exception"
# cone plane killed by cpulimit 300
# ? - because sometimes test is killed by elapsed time
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26020 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
# planar face
plane pln_f1 460.8377555733228 -1160 121.87519451048833 -0.17364817766693036 1.1223734950417248e-017 0.98480775301220813
# test script on make volume operation
# cone plane killed by cpulimit 300
-puts "TODO OCC26020 ALL: TEST INCOMPLETE"
-puts "TODO ?OCC26019 ALL: Process killed by CPU limit"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
# planar face
plane pln_f1 -460.8377555733228 -1160 -121.8751945104883 0.17364817766693036 -5.955424826592936e-017 -0.98480775301220813
# ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances
############################################################################
-restore [locate_data_file OCC26656_unify.input.brep] i
+restore [locate_data_file bug26656_unify.input.brep] i
set bug_info [tolerance i]
set value_1 [lindex $bug_info 1]
set nb_e_good 12
set nb_w_good 2
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
set 2dviewer 0
set nb_e_good 12
set nb_w_good 2
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 29
+set nb_shape_good 28
set 2dviewer 0
set nb_v_good 3
set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 9
+set nb_shape_good 8
set 2dviewer 0
set nb_v_good 5
set nb_e_good 4
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 0
set nb_v_good 3
set nb_e_good 2
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 7
+set nb_shape_good 6
set 2dviewer 0
set nb_e_good 12
set nb_w_good 4
set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 31
+set nb_shape_good 30
set 3dviewer 1
set nb_e_good 62
set nb_w_good 30
set nb_f_good 29
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 157
+set nb_shape_good 156
set 3dviewer 1
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
-set nb_shape_good 5
+set nb_w_good 0
+set nb_shape_good 4
+
set length 48.4459
set command bopfuse
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC25917 ALL: Error : The square of result shape is"
-if { [regexp {Debug mode} [dversion]] } {
- puts "TODO OCC25917 ALL: TEST INCOMPLETE"
- puts "TODO OCC25917 ALL: Tcl Exception"
-}
puts "========================"
puts " OCC472 "
-puts "TODO OCC25917 ALL: Error : The command is not valid. The square is"
-if { [regexp {Debug mode} [dversion]] } {
- puts "TODO OCC25917 ALL: TEST INCOMPLETE"
- puts "TODO OCC25917 ALL: Tcl Exception"
-}
+puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC25917 ALL: Error : The square of result shape is"
puts "========================"
puts " OCC472 "
-if { [regexp {Debug mode} [dversion]] } {
- puts "TODO OCC25917 ALL: TEST INCOMPLETE"
- puts "TODO OCC25917 ALL: Tcl Exception"
-}
-
+puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "========================"
puts " OCC472 "
puts "(case 3)"
bfuse result b1 b2
-set nb_v_good 66
-set nb_e_edge 107
-set square 31657.5
+set square 229.516
set 2dviewer 0
set nb_e_good 16
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 36
+set nb_shape_good 35
set 2dviewer 0
-puts "TODO OCC12345 ALL: Faulty : Result is BAD. Distance is more than MaxTolerance"
-puts "TODO OCC12345 ALL: Error : The length of result shape is"
-
puts "=========="
puts "PRO18892"
puts "=========="
puts "Faulty : Result is BAD. Distance is more than MaxTolerance"
}
-set length 0
+set length 6.46299
+checkshape result
+checksection result
bop b1 b2
bopfuse result
-set square 2415.65
+set square 2377.71
set 2dviewer 0
set nb_e_good 15
set nb_w_good 4
set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 34
+set nb_shape_good 33
set 2dviewer 0
# Analysis of "nbshapes result"
set nb_v_good 6
set nb_e_good 4
-set nb_w_good 2
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 13
+set nb_shape_good 11
set 2dviewer 1
###########################################################
# Wrong pcurve of the section curve
###########################################################
-set MaxTol 1.0e-7
+
+set ExpectedTol 0.00013092495734395759
set NbCurv_OK 1
restore [locate_data_file bug24585_b1.brep] b1
puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found."
}
-if {${Toler} > ${MaxTol}} {
- puts "Error: Tolerance is too big!"
-}
-
-#Theoretically, c2d1_1 must cover U-diapason of surface s1 fully.
-
-set log [dump c2d1_1]
-
-regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-puts "Degree=${Degree}"
-puts "Poles=${Poles}"
-puts "KnotsPoles=${KnotsPoles}"
-puts ""
-
-set Pole 1
-set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
-regexp ${exp_string} ${log} full U_begin V_begin
-
-puts "Pole=${Pole}"
-puts "U_begin=${U_begin}"
-puts "V_begin=${V_begin}"
-dset U_begin ${U_begin}
-puts ""
+set tol_abs 0.0
+set tol_rel 0.01
+checkreal "Tolerance Reached" ${Toler} ${ExpectedTol} ${tol_abs} ${tol_rel}
-set Pole ${Poles}
-set exp_string " +${Pole} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
-regexp ${exp_string} ${log} full U_end V_end
+bounds c2d1_1 U1 U2
+2dcvalue c2d1_1 U1 U_begin V_begin
+2dcvalue c2d1_1 U2 U_end V_end
-puts "Pole=${Pole}"
-puts "U_end=${U_end}"
-puts "V_end=${V_end}"
-dset U_end ${U_end}
-puts ""
+#Theoretically, c2d1_1 must cover U-diapason of surface s1 fully.
set delta_f [dval U1f_exp-U_begin]
puts "Error: Bad value. U_end = [dval U_end], Ulast = [dval U1l_exp]."
} else {
puts "OK: Good value. U_end matches with Ulast of surface."
-}
\ No newline at end of file
+}
+
+puts ""
+puts "Check if tangents in first and last point of line have the same directions"
+
+#See bug#26752
+cvalue c_1 U1 xx yy zz dx1 dy1 dz1
+cvalue c_1 U2 xx yy zz dx2 dy2 dz2
+
+set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
+if {${DP} < 0} {
+ puts "Error: Tangents are reversed. Bug 26752 is reproduced."
+} else {
+ puts "OK: Tangents are not reversed."
+}
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
set 2dviewer 1
bop curve circle
bopcut result
-explode result
-if { [llength [explode result_1]] != 4 } {
- puts "Error: wrong number of intersections. Should be result_1_1 result_1_2 result_1_3 result_1_4"
+if { [llength [explode result]] != 4 } {
+ puts "Error: wrong number of intersections. Should be result_1 result_2 result_3 result_4"
} else {
puts "OK: right number of intersections"
}
-explode result_1_2
-set info1 [dump result_1_2_1]
+explode result_2
+set info1 [dump result_2_1]
regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info1 full x1 y1 z1
regexp {Tolerance +: +([-0-9.+eE]+)} $info1 full tol1
}
-set info2 [dump result_1_2_2]
+set info2 [dump result_2_2]
regexp {Point 3D +: +([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} $info2 full x2 y2 z2
regexp {Tolerance +: +([-0-9.+eE]+)} $info2 full tol2
bfillds
bbop result 2
-set square 103838
-
-set nb_v_good 106
-set nb_e_good 164
-set nb_w_good 142
-set nb_f_good 80
-set nb_sh_good 3
-set nb_sol_good 3
+set square 142845
+
+set nb_v_good 108
+set nb_e_good 168
+set nb_w_good 152
+set nb_f_good 86
+set nb_sh_good 7
+set nb_sol_good 7
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 499
+set nb_shape_good 529
set 2dviewer 1
set nb_e_good 8
set nb_w_good 2
set nb_f_good 2
-set nb_sh_good 2
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 21
+set nb_shape_good 19
set 2dviewer 1
pload QAcommands
restore [locate_data_file bug25043.brep] a
+subshape a v 3
+settolerance a_3 0.0005
decho off
set info [OCC25043 a]
decho on
-if { [regexp "Faulty shape if found in source shape" ${info}] == 1 } {
+if { [regexp "Faulty shape is found in source shape" ${info}] == 1 } {
puts "OK : Good result"
-} else {
+} elseif { [regexp "Problems are not detected" $info] != 1 } {
puts "Error : Wrong result"
}
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
set 2dviewer 1
+puts "TODO OCC27116 ALL: Error: Summary length ="
+puts "TODO OCC27116 ALL: Error: 1 intersection curve\\(s\\) expected but"
+
puts "================"
puts "OCC25193"
puts "================"
# Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
#######################################################################
+puts ""
+
+pload QAcommands
+
+set GoodNbCurv 1
+set GoodTol 3.6570868343352305e-005
+set NbControlPts 10
+
restore [locate_data_file bug25193_s1t.draw] s1
restore [locate_data_file bug25193_s4t.draw] s4
-set CurveNumb [intersect i s1 s4 3.6570868343352305e-005]
+#Ethalon of intersection curve
+bounds s1 us1 us2 vs1 vs2
+uiso cc s1 us1
-if { [llength ${CurveNumb}] != 6 } {
- puts "Error : Bad Intersection curveobtained by Surface/Surface Intersection Algorithm"
+regexp {is ([-0-9.+eE]+)} [length cc 1.0e-4] full ExpLength
+puts "Expected length = $ExpLength"
+
+intersect res s1 s4 $GoodTol
+set che [whatis res]
+set ind [string first "3d curve" $che]
+
+set AllowRepeate 1
+set ic 1
+
+if {${ind} >= 0} {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+set SumLength 0
+
+while { $AllowRepeate != 0 } {
+ set che [whatis res_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeate 0
+ break
+ }
+
+ for {set jc 1} {$jc < $ic} {incr jc} {
+ mkedge e1 res_$ic
+ mkedge e2 res_$jc
+ set coe [checkoverlapedges e1 e2]
+
+ puts "res_$ic <-> res_$jc: $coe"
+ if { [regexp "Edges is not overlaped" $coe] != 1 } {
+ puts "Error: Overlapped intersection curves"
+ }
+ }
+
+ regexp {is ([-0-9.+eE]+)} [length res_$ic 1.0e-4] full ll
+
+ set SumLength [ expr $SumLength+$ll ]
+
+ bounds res_$ic U1 U2
+
+ set step [ dval (U2-U1)/$NbControlPts ]
+
+ if { $step < 1.0e-9*$NbControlPts } {
+ puts "Error: Wrong curve's range!"
+ }
+
+ set DPPrev 0
+ for {set par [dval U1]} {$par <= [dval U2]} {set par [expr $par+$step]} {
+ cvalue res_$ic $par xx yy zz dx1 dy1 dz1
+ regexp " parameter 1 = +(\[-0-9*\.+eE\]+)" [proj cc xx yy zz] full cpar
+ cvalue cc $cpar xx yy zz dx2 dy2 dz2
+
+ set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
+
+ if {$DPPrev*$DP < 0.0} {
+ puts "Error: Curve res_$ic changes its direction"
+ }
+
+ set DPPrev $DP
+ }
+
+ incr ic
+}
+
+if {[expr {$ic - 1}] == $GoodNbCurv} {
+ puts "OK: Good number of intersection curve(s) obtained by Surface/Surface Intersection Algorithm"
} else {
- puts "OK : Good Intersection curveobtained by Surface/Surface Intersection Algorithm"
+ puts "Error: $GoodNbCurv intersection curve(s) expected but [expr {$ic - 1}] found"
}
+checkreal "Summary length " ${SumLength} $ExpLength 0.0 1.0e-6
+
smallview
+donly res_* s1 s4
fit
set only_screen_axo 1
set nb_v_good 2
set nb_e_good 1
-set nb_w_good 1
+set nb_w_good 0
set nb_f_good 0
set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 5
+set nb_shape_good 4
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 1
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid.
-set MaxTol 1.5e-7
+set MaxTol 2.0e-7
#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid.
set GoodNbCurv 4
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid.
-set MaxTol 1.5e-7
+set MaxTol 2.0e-7
#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid.
set GoodNbCurv 4
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
-set MaxTol 1.0e-8
+set MaxTol 1.3e-7
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set GoodNbCurv 1
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
-set MaxTol 1.0e-8
+set MaxTol 1.3e-7
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set GoodNbCurv 1
+puts "TODO OCC26417 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 13 wires"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 80 shapes"
+
puts "================"
puts "OCC25319"
puts "================"
+puts "TODO OCC26417 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 13 wires"
+puts "TODO OCC26417 ALL: Error : Result shape is WRONG because it must contains 80 shapes"
+
puts "================"
puts "OCC25319"
puts "================"
set nb_e_good 6
set nb_w_good 3
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 18
+set nb_shape_good 17
set 2dviewer 1
set nb_e_good 3
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 10
+set nb_shape_good 9
set 2dviewer 1
set nb_e_good 12
set nb_w_good 4
set nb_f_good 4
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 30
+set nb_shape_good 29
set 3dviewer 1
set nb_e_good 4
set nb_w_good 1
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 12
+set nb_shape_good 11
set 3dviewer 1
bapibop result 0
set nb_v_good 1720
-set nb_e_good 3800
-set nb_w_good 1920
-set nb_f_good 1920
-set nb_sh_good 1
-set nb_sol_good 1
+set nb_e_good 4260
+set nb_w_good 3220
+set nb_f_good 3220
+set nb_sh_good 760
+set nb_sol_good 760
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 9363
+set nb_shape_good 13941
set 3dviewer 1
set nb_v_good 888
set nb_e_good 1412
-set nb_w_good 686
-set nb_f_good 686
-set nb_sh_good 82
-set nb_sol_good 82
+set nb_w_good 726
+set nb_f_good 726
+set nb_sh_good 121
+set nb_sol_good 121
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 3837
+set nb_shape_good 3995
set 3dviewer 1
bapibop result 3
set nb_v_good 2640
-set nb_e_good 5780
-set nb_w_good 2820
-set nb_f_good 2820
-set nb_sh_good 2
-set nb_sol_good 2
+set nb_e_good 5960
+set nb_w_good 3720
+set nb_f_good 3720
+set nb_sh_good 560
+set nb_sol_good 560
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 14065
+set nb_shape_good 17161
set 3dviewer 1
set nb_e_good 11
set nb_w_good 2
set nb_f_good 2
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 27
+set nb_shape_good 26
set 2dviewer 1
set nb_e_good 3
set nb_w_good 3
set nb_f_good 1
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 11
+set nb_shape_good 10
set 2dviewer 1
EDGE : 4
WIRE : 1
FACE : 1
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 12
+ SHAPE : 11
"
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
EDGE : 9
WIRE : 1
FACE : 1
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 22
+ SHAPE : 21
"
checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+explode b1 f
+copy b1_1 f
+explode b1 e
+copy b1_8 e
+
+box b2 10 5 5
+
+bclearobjects
+bcleartools
+baddobjects f e
+baddtools b2
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should edge and face
+
+set ShapeType "FACE"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "EDGE"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 5 0 0 10 10 10
+explode b2 sh
+copy b2_1 b2
+box b3 5 0 5 10 10 10
+
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should shell and two solids
+
+set ShapeType "SHELL"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_3]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+explode b1 f
+copy b1_1 f
+explode b1 e
+copy b1_8 e
+
+box b2 10 5 5
+shape sh sh
+add f sh
+copy sh f
+shape w w
+add e w
+copy w e
+
+bclearobjects
+bcleartools
+baddobjects f e
+baddtools b2
+
+bfillds
+bbop r 0
+
+nbshapes r
+
+bbop r 2
+
+nbshapes r
+explode r
+
+# should be shell and wire
+
+set ShapeType "SHELL"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "WIRE"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+bfillds
+
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 -5 2 3 30 6 4
+
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 5
+box b3 5 0 7 10 10 5
+bclearobjects
+bcleartools
+baddobjects b2 b3
+
+bfillds
+bbuild r
+
+explode r so
+shape b2 CS
+add r_1 b2
+add r_2 b2
+
+box b3 5 -2 -2 10 14 20
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be two compsolids
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b1 10 10 10
+box b2 10 0 0 10 5 5
+box b3 10 5 0 10 5 5
+box b4 10 0 5 10 10 5
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3 b4
+
+bfillds
+bbuild r
+
+explode r so
+shape b1 CS
+add r_1 b1
+add r_2 b1
+add r_3 b1
+add r_4 b1
+
+box b2 5 0 2 10 10 10
+box b3 -5 2 3 30 6 4
+bclearobjects
+bcleartools
+baddobjects b1 b2
+baddtools b3
+
+bfillds
+bbop r 2
+
+explode r
+
+# should be compsolid and solid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis r_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
+
+set ShapeType "SOLID"
+if { [regexp $ShapeType [whatis r_2]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
--- /dev/null
+puts "============"
+puts "OCC26565"
+puts "============"
+puts ""
+###############################
+## Compsolid after cut becomes compound of solids
+###############################
+
+box b 10 10 10
+explode b f
+mkshe profile b_1 b_3
+
+polyline spine 0 0 0 10 10 0
+
+pipe sh spine profile
+
+whatis sh
+plane pl 10 10 0 -1 -1 0 1 0 0
+mkface f pl
+mksol sl f
+
+bcut res sh sl
+
+explode res
+
+# should be compsolid
+
+set ShapeType "COMPSOLID"
+if { [regexp $ShapeType [whatis res_1]] == 1 } {
+ puts "OK : There is $ShapeType; Compsolid is good"
+} else {
+ puts "Error : There is not $ShapeType; Compsolid is bad"
+}
EDGE : 7
WIRE : 3
FACE : 3
- SHELL : 1
+ SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 20
+ SHAPE : 19
"
checknbshapes result -ref ${nbshapes_expected} -t -m "result obtained by Common operator"
--- /dev/null
+puts "============"
+puts "OCC26718"
+puts "============"
+puts ""
+#############################################################################################
+## Big tolerance value of the edge in the result of Genral Fuse operation
+#############################################################################################
+
+restore [locate_data_file bug26718_w6_b1.brep] b1
+restore [locate_data_file bug26718_w6_b2.brep] b2
+
+bclearobjects
+bcleartools
+baddobjects b1
+baddtools b2
+
+bfillds
+bbuild result
+
+set square 2.3834e+06
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX : 7
+ EDGE : 11
+ WIRE : 8
+ FACE : 5
+ SHELL : 2
+ SOLID : 2
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 36
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by General Fuse operation"
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTolerance
+puts "MaxTolerance=$MaxTolerance"
+
+set expected_MaxTolerance 0.317915740714732
+set tol_abs_MaxTolerance 0.01
+set tol_rel_MaxTolerance 0.01
+checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+set 3dviewer 1
--- /dev/null
+puts "========"
+puts "OCC26980"
+puts "========"
+puts ""
+#################################
+# Intersection part of Boolean algorithm spends much system time and system memory
+#################################
+
+cpulimit 5000
+
+set max_time 240
+set mem_max_wsetpeak 700000000
+
+
+bclearobjects;
+bcleartools;
+
+restore [locate_data_file bug26980-cmp.brep] cmp
+
+puts [nbshapes cmp -t]
+
+eval baddobjects [explode cmp]
+
+dchrono cr reset
+dchrono cr start
+
+bfillds
+bbuild result
+
+dchrono cr stop
+
+set mem_wsetpeak [meminfo wsetpeak]
+
+if { ${mem_wsetpeak} > ${mem_max_wsetpeak}} {
+ puts "Error : there is memory problem (${mem_wsetpeak} MBytes has been allocated)"
+}
+
+set chrono_info [dchrono cr show]
+regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
+if { $CPU_time > ${max_time} } {
+ puts "CPU user time of Boolean operation is more than ${max_time} seconds - Error"
+} else {
+ puts "CPU user time of Boolean operation is less than ${max_time} seconds - OK"
+}
+
+set nbshapes_expected "
+ VERTEX : 365
+ EDGE : 793
+ WIRE : 531
+ FACE : 531
+ SHELL : 102
+ SOLID : 101
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 2424
+"
+
+checknbshapes result -ref ${nbshapes_expected} -t
+
+smallview
+donly result
+fit
+
+set 2dviewer 1
set nb_e_good 10
set nb_w_good 8
set nb_f_good 6
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 32
+set nb_shape_good 31
set 3dviewer 1
set nb_e_good 39
set nb_w_good 4
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
set 3dviewer 1
set nb_e_good 39
set nb_w_good 4
set nb_f_good 3
-set nb_sh_good 1
+set nb_sh_good 0
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
-set nb_shape_good 85
+set nb_shape_good 84
set 3dviewer 1