mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
20 Commits
CR32829
...
NewGEOM_2.
Author | SHA1 | Date | |
---|---|---|---|
|
f76d42b445 | ||
|
0c129fdf43 | ||
|
1780d6cc29 | ||
|
5f4c2d0acf | ||
|
2bcaa8d588 | ||
|
0682b01634 | ||
|
b609dcabc2 | ||
|
bcf8e95ac2 | ||
|
d51b89a554 | ||
|
3c0d0ff7a0 | ||
|
46c3e95ee2 | ||
|
9f88d1ba02 | ||
|
c757ce233a | ||
|
87e6cca9a7 | ||
|
9d2f9eb5c3 | ||
|
d057720d07 | ||
|
84eea67f81 | ||
|
9d84c361f5 | ||
|
d486ae29c5 | ||
|
7c49995584 |
@@ -74,7 +74,7 @@ Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret
|
||||
@section upgrade_653 Upgrade to OCCT 6.5.3
|
||||
|
||||
Porting of user applications from an earlier OCCT version to version 6.5.3 requires taking into account the following major changes:
|
||||
* As a result of code clean-up and redesign of *TKOpenGl* driver, some obsolete functions and rendering primitives <i>(TriangleMesh, TriangleSet, Bezier, Polyline, Polygon, PolygonHoles, QuadrangleMesh</i> and *QuadrangleSet*) have been removed. Instead, the application developers should use primitive arrays that provide the same functionality but are hardware-accelerated. The details can be found in OCCT Visualization User's Guide, “Primitive Arrays” chapter.
|
||||
* As a result of code clean-up and redesign of *TKOpenGl* driver, some obsolete functions and rendering primitives <i>(TriangleMesh, TriangleSet, Bezier, Polyline, Polygon, PolygonHoles, QuadrangleMesh</i> and *QuadrangleSet*) have been removed. Instead, the application developers should use primitive arrays that provide the same functionality but are hardware-accelerated. The details can be found in OCCT Visualization User's Guide, ???Primitive Arrays??? chapter.
|
||||
* Applications should not call *AIS_InteractiveObject::SetPolygonOffsets()* method for an instance of *AIS_TexturedShape* class after it has been added to *AIS_InteractiveContext*. More generally, modification of *Graphic3d_AspectFillArea3d* parameters for the computed groups of any *AIS_InteractiveObject* subclass that uses texture mapping should be avoided, because this results in broken texture mapping (see issue 23118). It is still possible to apply non-default polygon offsets to *AIS_TexturedShape* by calling *SetPolygonOffsets()* before displaying the shape.
|
||||
* The applications that might have used internal functions provided by *TKOpenGl* or removed primitives will need to be updated.
|
||||
* In connection with the implementation of Z-layers it might be necessary to revise the application code or revise the custom direct descendant classes of *Graphic3d_GraphicDriver* and *Graphic3d_StructureManager* to use the Z-layer feature.
|
||||
@@ -169,7 +169,7 @@ Porting of user applications from an earlier OCCT version to version 6.7.0 requi
|
||||
@subsection upgrade_670_markers Redesign of markers presentation
|
||||
|
||||
* Due to the redesign of *Graphic3d_AspectMarker3d* class the code of custom markers initialization should be updated. Notice that you can reuse old markers definition code as *TColStd_HArray1OfByte*; however, *Image_PixMap* is now the preferred way (and supports full-color images on modern hardware).
|
||||
* Logics and arguments of methods *AIS_InteractiveContext::Erase()* and *AIS_InteractiveContext::EraseAll()* have been changed. Now these methods do not remove resources from *Graphic3d_Structure*; they simply change the visibility flag in it. Therefore, the code that deletes and reсomputes resources should be revised.
|
||||
* Logics and arguments of methods *AIS_InteractiveContext::Erase()* and *AIS_InteractiveContext::EraseAll()* have been changed. Now these methods do not remove resources from *Graphic3d_Structure*; they simply change the visibility flag in it. Therefore, the code that deletes and re??omputes resources should be revised.
|
||||
* *Graphic3d_Group::MarkerSet()* has been removed. *Graphic3d_Group::AddPrimitiveArray()* should be used instead to specify marker(s) array.
|
||||
|
||||
@subsection upgrade_670_views Default views are not created automatically
|
||||
@@ -304,10 +304,10 @@ SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (myCenter3d));
|
||||
~~~~
|
||||
|
||||
The interface of *SelectBasics_SensitiveEntity* now contains four new pure virtual functions that should be implemented by each custom sensitive:
|
||||
* <i>BoundingBox()</i> – returns a bounding box of the entity;
|
||||
* <i>Clear()</i> – clears up all the resources and memory allocated for complex sensitive entities;
|
||||
* <i>BVH()</i> – builds a BVH tree for complex sensitive entities, if it is needed;
|
||||
* <i>NbSubElements()</i> – returns atomic sub-entities of a complex sensitive entity, which will be used as primitives for BVH building. If the entity is simple and no BVH is required, this method returns 1.
|
||||
* <i>BoundingBox()</i> ??? returns a bounding box of the entity;
|
||||
* <i>Clear()</i> ??? clears up all the resources and memory allocated for complex sensitive entities;
|
||||
* <i>BVH()</i> ??? builds a BVH tree for complex sensitive entities, if it is needed;
|
||||
* <i>NbSubElements()</i> ??? returns atomic sub-entities of a complex sensitive entity, which will be used as primitives for BVH building. If the entity is simple and no BVH is required, this method returns 1.
|
||||
|
||||
Each sensitive entity now has its own tolerance, which can be overridden by method *SelectBasics_SensitiveEntity::SetSensitivityFactor()* called from constructor.
|
||||
|
||||
|
@@ -1080,9 +1080,11 @@ The input data for this step is a *BOPAlgo_Builder* object after building result
|
||||
* 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 arguments 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 a compound containing Wire.
|
||||
* For the arguments of collection type (WIRE, SHELL, COMPSOLID) containing overlapping parts the overlapping parts passed into result will be repeated for each container from the input shapes containing such parts.
|
||||
* The result of the operation Fuse for the arguments of collection type (WIRE, SHELL, COMPSOLID) will contain the same number of containers as the arguments. The overlapping parts (EDGES/FACES/SOLIDS) will be shared among them. For example, the result of Fuse operation between two wires will be two wires sharing coinciding edges if any.
|
||||
* The result of the operation Common for the arguments of collection type (WIRE, SHELL, COMPSOLID) will consist of the containers containing the same overlapping parts. For example, the result of Common operation between two fully/partially overlapping wires will be two wires containing the same edges.
|
||||
* For the arguments of collection type (WIRE, SHELL, COMPSOLID) containing overlapping parts the overlapping parts passed into result will be repeated for each container from the input shapes containing such parts. The containers completely included in other containers will be avoided in the result.
|
||||
* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the containers included into result will have the same orientation as the original containers from arguments. In case of duplication its orientation will be defined by the orientation of the first container in arguments. Each container included into result will have coherent orientation of its sub-shapes.
|
||||
* The result of the operation Fuse for the arguments of collection type (WIRE, SHELL) will consist of the shapes of the same collection type. The overlapping parts (EDGES/FACES) will be shared among containers, but duplicating containers will be avoided in the result. For example, the result of Fuse operation between two fully coinciding wires will be one wire, but the result of Fuse operation between two partially coinciding wires will be two wires sharing coinciding edges.
|
||||
* The result of the operation Fuse for the arguments of type COMPSOLID will consist of the compound containing COMPSOLIDs created from connexity blocks of fused solids.
|
||||
* The result of the operation Common for the arguments of collection type (WIRE, SHELL, COMPSOLID) will consist of the unique containers containing the overlapping parts. For example, the result of Common operation between two fully overlapping wires will be one wire containing all splits of edges. The number of wires in the result of Common operation between two partially overlapping wires will be equal to the number of connexity blocks of overlapping edges.
|
||||
|
||||
@subsection occt_algorithms_9_4 Examples
|
||||
|
||||
@@ -1555,7 +1557,7 @@ Let us consider two Wires that have overlapping edges, *W1* is the object and *W
|
||||
|
||||
@figure{/user_guides/boolean_operations/images/boolean_image140.png}
|
||||
|
||||
* The result of *Common* operation is a compound containing two Wires both consisting of an overlapping edge. The new Wires are created from the objects:
|
||||
* The result of *Common* operation is a compound containing one Wire consisting of an overlapping edge. The new Wire is created from the objects:
|
||||
|
||||
@figure{/user_guides/boolean_operations/images/boolean_image141.png}
|
||||
|
||||
@@ -2100,10 +2102,10 @@ With the Fuzzy option it is possible to get the expected result -- it is just ne
|
||||
|
||||
Fuzzy option is included in interface of Intersection Part (class *BOPAlgo_PaveFiller*) and application programming interface (class *BRepAlgoAPI_BooleanOperation*)
|
||||
|
||||
@subsection occt_algorithms_11a_2 Examples
|
||||
@subsubsection occt_algorithms_11a_1_1 Examples
|
||||
The following examples demonstrate the advantages of usage Fuzzy option operations over the Basic Operations in typical situations.
|
||||
|
||||
@subsubsection occt_algorithms_11a_1_1 Case 1
|
||||
#### Case 1
|
||||
|
||||
In this example the cylinder (shown in yellow and transparent) is subtracted from the box (shown in red). The cylinder is shifted by 5e<sup>-5</sup> relatively to the box along its axis (the distance between rear faces of the box and cylinder is 5e<sup>-5</sup>).
|
||||
|
||||
@@ -2117,7 +2119,7 @@ The following results are obtained using Basic Operations and the Fuzzy ones wit
|
||||
|
||||
In this example Fuzzy option allows eliminating a very thin part of the result shape produced by Basic algorithm due to misalignment of rear faces of the box and the cylinder.
|
||||
|
||||
@subsubsection occt_algorithms_11a_1_2 Case 2
|
||||
#### Case 2
|
||||
|
||||
In this example two boxes are fused. One of them has dimensions 10*10*10, and the other is 10*10.000001*10.000001 and adjacent to the first one. There is no gap in this case as the surfaces of the neighboring faces coincide, but one box is slightly greater than the other.
|
||||
|
||||
@@ -2131,7 +2133,7 @@ The following results are obtained using Basic Operations and the Fuzzy ones wit
|
||||
|
||||
In this example Fuzzy option allows eliminating an extremely narrow face in the result produced by Basic operation.
|
||||
|
||||
@subsubsection occt_algorithms_11a_1_3 Case 3
|
||||
#### Case 3
|
||||
|
||||
In this example the small planar face (shown in orange) is subtracted from the big one (shown in yellow). There is a gap 1e<sup>-5</sup> between the edges of these faces.
|
||||
|
||||
@@ -2145,7 +2147,7 @@ The following results are obtained using Basic Operations and the Fuzzy ones wit
|
||||
|
||||
In this example Fuzzy options eliminated a pin-like protrusion resulting from the gap between edges of the argument faces.
|
||||
|
||||
@subsubsection occt_algorithms_11a_1_4 Case 4
|
||||
#### Case 4
|
||||
|
||||
In this example the small edge is subtracted from the big one. The edges are overlapping not precisely, with max deviation between them equal to 5.28004e<sup>-5</sup>. We will use 6e<sup>-5</sup> value for Fuzzy option.
|
||||
|
||||
@@ -2159,6 +2161,224 @@ The following results are obtained using Basic Operations and the Fuzzy ones wit
|
||||
|
||||
This example stresses not only the validity, but also the performance issue. The usage of Fuzzy option with the appropriate value allows processing the case much faster than with the pure Basic operation. The performance gain for the case is 45 (Processor: Intel(R) Core(TM) i5-3450 CPU @ 3.10 GHz).
|
||||
|
||||
@subsection occt_algorithms_11a_2 Gluing Operation
|
||||
|
||||
The Gluing operation is the option of the Basic Operations, such as General Fuse, Boolean and Section operations.
|
||||
It has been designed to speed up the computation of the interferences among arguments of the operations on special cases, in which the arguments may be overlapping but do not have real intersections between their sub-shapes.
|
||||
|
||||
This option cannot be used on the shapes having real intersections, like intersection vertex between edges, or intersection vertex between edge and a face or intersection line between faces:
|
||||
@figure{/user_guides/boolean_operations/images/glue_options_image002.png, "Intersecting faces"}
|
||||
|
||||
There are two possibilities of overlapping shapes:
|
||||
* The shapes can be partially coinciding - the faces do not have intersection curves, but overlapping. The faces of such arguments will be split during the operation. The following picture illustrates such shapes:
|
||||
@figure{/user_guides/boolean_operations/images/glue_options_image001.png, "Partially coinciding faces"}
|
||||
* The shapes can be fully coinciding - there should be no partial overlapping of the faces, thus no intersection of type EDGE/FACE at all. In such cases the faces will not be split during the operation
|
||||
@figure{/user_guides/boolean_operations/images/glue_options_image003.png, "Full coinciding faces of the boxes"}
|
||||
|
||||
Thus, there are two possible options - for full and partial coincidence of the shapes.
|
||||
|
||||
Even though there are no real intersections on such cases without Gluing options the algorithm will still intersect the sub-shapes of the arguments with interfering bounding boxes.
|
||||
|
||||
The performance improvement in gluing mode is achieved by excluding the most time consuming computations and in some case can go up to 90%:
|
||||
* Exclude computation of FACE/FACE intersections for partial coincidence;
|
||||
* Exclude computation of VERTEX/FACE, EDGE/FACE and FACE/FACE intersections for full coincidence.
|
||||
|
||||
By setting the Gluing option for the operation user should guarantee that the arguments are really coinciding. The algorithm does not check this itself. Setting inappropriate option for the operation is likely to lead to incorrect result.
|
||||
|
||||
@subsubsection occt_algorithms_11a_2_1 Usage
|
||||
|
||||
The Gluing option is an enumeration implemented in BOPAlgo_GlueEnum.hxx:
|
||||
* BOPAlgo_GlueOff - default value for the algorithms, Gluing is switched off;
|
||||
* BOPAlgo_GlueShift - Glue option for shapes with partial coincidence;
|
||||
* BOPAlgo_GlueFull - Glue option for shapes with full coincidence.
|
||||
|
||||
#### API level
|
||||
For setting the Gluing options for the algorithm it is just necessary to call the SetGlue(const BOPAlgo_Glue) method with appropriate value:
|
||||
~~~~
|
||||
BOPAlgo_Builder aGF;
|
||||
//
|
||||
....
|
||||
// setting the gluing option to speed up intersection of the arguments
|
||||
aGF.SetGlue(BOPAlgo_GlueShift)
|
||||
//
|
||||
....
|
||||
~~~~
|
||||
|
||||
#### TCL level
|
||||
For setting the Gluing options in DRAW it is necessary to call the <i>bglue</i> command with appropriate value:
|
||||
* 0 - default value, Gluing is off;
|
||||
* 1 - for partial coincidence;
|
||||
* 2 - for full coincidence
|
||||
|
||||
~~~~
|
||||
bglue 1
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_algorithms_11a_2_2 Examples
|
||||
#### Case1 - Fusing the 64 bspline boxes into one solid
|
||||
@figure{/user_guides/boolean_operations/images/glue_options_image004.png, "BSpline Boxes with partial coincidence"}
|
||||
|
||||
Performance improvement from using the GlueShift option in this case is about 70 percent.
|
||||
|
||||
#### Case2 - Sewing faces of the shape after reading from IGES
|
||||
@figure{/user_guides/boolean_operations/images/glue_options_image005.png, "Faces with coinciding but not shared edges"}
|
||||
|
||||
Performance improvement in this case is also about 70 percent.
|
||||
|
||||
|
||||
@section occt_algorithms_history History Information
|
||||
|
||||
The chapter describes the rules for filling the History Information (or just History) for the arguments of the operations in Boolean Component.
|
||||
The History is available only for the VERTICES, EDGES, FACES and SOLIDS from the input arguments.
|
||||
|
||||
The History allows tracking the modification of the input shapes during the operation. It consists of the following information:
|
||||
* Information about Deleted shapes;
|
||||
* Information about Modified shapes;
|
||||
* Information about Generated shapes;
|
||||
|
||||
All History information is filled basing on the result of current operation. History cannot return any shapes not contained in the result.
|
||||
Thus if the result of the operation is empty shape, all input shapes will be considered as Deleted and none will have Modified and Generated shapes.
|
||||
|
||||
@subsection occt_algorithms_history_del Deleted shapes
|
||||
|
||||
The shape is considered as Deleted if the result shape do not contain the shape itself and none of its splits.
|
||||
For example, the result of CUT operation of two overlapping planar faces (see the example below) does not contain any parts from the tool face. Thus, the tool faces is considered as Deleted.
|
||||
If the faces are not fully coinciding, the result must contain some parts of the object face. In this case object face will be considered as not deleted.
|
||||
But if the faces are fully coinciding, the result must be empty, and both faces will be considered as Deleted.
|
||||
|
||||
To get the information about Deleted shapes it is necessary to use the method *Standard_Boolean IsDeleted(const TopoDS_Shape& theS)*.
|
||||
|
||||
To get the information about Deleted shapes in DRAW it is necessary to use the command *bisdeleted shape*.
|
||||
|
||||
Example of the overlapping faces:
|
||||
|
||||
~~~~
|
||||
plane p 0 0 0 0 0 1
|
||||
mkface f1 p -10 10 -10 10
|
||||
mkface f2 p 0 20 -10 10
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects f1
|
||||
baddtools f2
|
||||
bfillds
|
||||
bbop r 2
|
||||
|
||||
bisdeleted f1
|
||||
# Not deleted
|
||||
|
||||
bisdeleted f2
|
||||
# Deleted
|
||||
~~~~
|
||||
|
||||
@subsection occt_algorithms_history_modif Modified shapes
|
||||
|
||||
The shape is considered as Modified if the result shape contains any of the splits of the shape, not the shape itself. The shape can be modified only into the shapes with same dimension.
|
||||
The splits of the shape contained in the result shape are Modified from the shape.
|
||||
|
||||
For example, in the FUSE operation of two edges intersecting in one point (see the example below), both edges will be split by the intersection point. All these splits will be contained in the result.
|
||||
Thus, each of the input edges will be Modified into its two splits.
|
||||
But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes.
|
||||
|
||||
To get the information about Modified shapes it is necessary to use the method *const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)*.
|
||||
The list of Modified elements will contain only those which are contained in the result of the operation. If the list is empty the shape has not been modified and it is necessary to check if it has been Deleted.
|
||||
|
||||
To get the information about Modified shapes in DRAW it is necessary to use the command *bmodified modif shape*.
|
||||
|
||||
Example of the intersecting edges:
|
||||
|
||||
~~~~
|
||||
line l1 0 0 0 1 0 0
|
||||
mkedge e1 l1 -10 10
|
||||
|
||||
line l2 0 0 0 0 1 0
|
||||
mkedge e2 l2 -10 10
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects e1
|
||||
baddtools e2
|
||||
bfillds
|
||||
|
||||
# fuse operation
|
||||
bbop r 1
|
||||
|
||||
bmodified m1 e1
|
||||
nbshapes m1
|
||||
# EDGES: 2
|
||||
|
||||
bmodified m2 e2
|
||||
nbshapes m2
|
||||
# EDGES: 2
|
||||
|
||||
# cut operation
|
||||
bbop r 2
|
||||
|
||||
bmodified m1 e1
|
||||
nbshapes m1
|
||||
# EDGES: 2
|
||||
|
||||
bmodified m2 e2
|
||||
# The shape has not been modified
|
||||
|
||||
~~~~
|
||||
|
||||
|
||||
@subsection occt_algorithms_history_gen Generated shapes
|
||||
|
||||
In terms of the algorithms in Boolean Component the shape from the arguments can have Generated shapes only if these new shapes have been obtained as a result of pure intersection (not overlapping)
|
||||
of this shape with any other shapes from arguments. Thus, the Generated shapes are always:
|
||||
* VERTICES created from the intersection points and may be Generated from edges and faces only;
|
||||
* EDGES created from the intersection edges and may be Generated from faces only.
|
||||
|
||||
So, only EDGES and FACES could have information about Generated shapes. For all other types of shapes the list of Generated shapes will be empty.
|
||||
|
||||
For example, the two intersecting edges will both have the intersection vertices Generated from them.
|
||||
|
||||
To get the information about Generated shapes it is necessary to use the method *const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)*.
|
||||
The list of Generated elements will contain only those which are contained in the result of the operation. If the list is empty no new shapes have been Generated from the shape.
|
||||
|
||||
To get the information about Generated shapes in DRAW it is necessary to use the command *bgenerated gen shape*.
|
||||
|
||||
Example of interfering faces
|
||||
|
||||
~~~~
|
||||
plane p1 0 0 0 0 0 1
|
||||
mkface f1 p1 -10 10 -10 10
|
||||
|
||||
plane p2 0 0 0 1 0 0
|
||||
mkface f2 p2 -10 10 -10 10
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects f1
|
||||
baddtools f2
|
||||
bfillds
|
||||
|
||||
# fuse operation
|
||||
bbop r 1
|
||||
|
||||
bgenerated gf1 f1
|
||||
nbshapes gf1
|
||||
# EDGES: 1
|
||||
|
||||
bgenerated gf2 f2
|
||||
nbshapes gf2
|
||||
# EDGES: 1
|
||||
|
||||
|
||||
# common operation - result is empty
|
||||
bbop r 0
|
||||
|
||||
bgenerated gf1 f1
|
||||
# No shapes were generated from the shape
|
||||
|
||||
bgenerated gf2 f2
|
||||
# No shapes were generated from the shape
|
||||
|
||||
~~~~
|
||||
|
||||
|
||||
@section occt_algorithms_11b Usage
|
||||
|
||||
The chapter contains some examples of the OCCT Boolean Component usage. The usage is possible on two levels: C++ and Tcl.
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@@ -691,21 +691,9 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
FitTextAlignmentForLinear (theFirstPoint, theSecondPoint, theIsOneSide, aHorisontalTextPos,
|
||||
aLabelPosition, isArrowsExternal);
|
||||
|
||||
// compute dimension line points
|
||||
gp_Ax1 aPlaneNormal = GetPlane().Axis();
|
||||
gp_Dir aTargetPointsVector = gce_MakeDir (theFirstPoint, theSecondPoint);
|
||||
|
||||
// compute flyout direction vector
|
||||
gp_Dir aFlyoutVector = aPlaneNormal.Direction() ^ aTargetPointsVector;
|
||||
|
||||
// create lines for layouts
|
||||
gp_Lin aLine1 (theFirstPoint, aFlyoutVector);
|
||||
gp_Lin aLine2 (theSecondPoint, aFlyoutVector);
|
||||
|
||||
// Get flyout end points
|
||||
gp_Pnt aLineBegPoint = ElCLib::Value (ElCLib::Parameter (aLine1, theFirstPoint) + GetFlyout(), aLine1);
|
||||
gp_Pnt aLineEndPoint = ElCLib::Value (ElCLib::Parameter (aLine2, theSecondPoint) + GetFlyout(), aLine2);
|
||||
|
||||
// compute dimension line points
|
||||
gp_Pnt aLineBegPoint, aLineEndPoint;
|
||||
ComputeFlyoutLinePoints (theFirstPoint, theSecondPoint, aLineBegPoint, aLineEndPoint);
|
||||
gp_Lin aDimensionLine = gce_MakeLin (aLineBegPoint, aLineEndPoint);
|
||||
|
||||
// compute arrows positions and directions
|
||||
@@ -996,6 +984,27 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
|
||||
mySelectionGeom.IsComputed = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeFlyoutLinePoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Dimension::ComputeFlyoutLinePoints (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint,
|
||||
gp_Pnt& theLineBegPoint, gp_Pnt& theLineEndPoint)
|
||||
{
|
||||
// compute dimension line points
|
||||
gp_Ax1 aPlaneNormal = GetPlane().Axis();
|
||||
// compute flyout direction vector
|
||||
gp_Dir aTargetPointsVector = gce_MakeDir (theFirstPoint, theSecondPoint);
|
||||
gp_Dir aFlyoutVector = aPlaneNormal.Direction() ^ aTargetPointsVector;
|
||||
// create lines for layouts
|
||||
gp_Lin aLine1 (theFirstPoint, aFlyoutVector);
|
||||
gp_Lin aLine2 (theSecondPoint, aFlyoutVector);
|
||||
|
||||
// Get flyout end points
|
||||
theLineBegPoint = ElCLib::Value (ElCLib::Parameter (aLine1, theFirstPoint) + GetFlyout(), aLine1);
|
||||
theLineEndPoint = ElCLib::Value (ElCLib::Parameter (aLine2, theSecondPoint) + GetFlyout(), aLine2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeLinearFlyouts
|
||||
//purpose :
|
||||
|
@@ -463,6 +463,14 @@ protected:
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const Standard_Boolean theIsOneSide = Standard_False);
|
||||
|
||||
//! Computes points bounded the flyout line for linear dimension.
|
||||
//! @param theFirstPoint [in] the first attach point of linear dimension.
|
||||
//! @param theSecondPoint [in] the second attach point of linear dimension.
|
||||
//! @param theLineBegPoint [out] the first attach point of linear dimension.
|
||||
//! @param theLineEndPoint [out] the second attach point of linear dimension.
|
||||
Standard_EXPORT virtual void ComputeFlyoutLinePoints (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint,
|
||||
gp_Pnt& theLineBegPoint, gp_Pnt& theLineEndPoint);
|
||||
|
||||
//! Compute selection sensitives for linear dimension flyout lines (length, diameter, radius).
|
||||
//! Please note that this method uses base dimension properties: working plane and flyout length.
|
||||
//! @param theSelection [in] the selection structure to fill with selection primitives.
|
||||
|
@@ -2354,13 +2354,32 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainPM->Erase (theIObj, -1);
|
||||
|
||||
// Object removes from Detected sequence
|
||||
for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); ++aDetIter)
|
||||
Standard_Integer aDetIter = myDetectedSeq.Lower();
|
||||
while (aDetIter <= myDetectedSeq.Upper())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
|
||||
Handle(SelectMgr_EntityOwner) aPicked = myMainSel->Picked (myDetectedSeq (aDetIter));
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aPicked.IsNull())
|
||||
{
|
||||
anObj = Handle(AIS_InteractiveObject)::DownCast (aPicked->Selectable());
|
||||
}
|
||||
|
||||
if (!anObj.IsNull()
|
||||
&& anObj != theIObj)
|
||||
&& anObj == theIObj)
|
||||
{
|
||||
myDetectedSeq.Remove (aDetIter);
|
||||
if (myCurDetected == aDetIter)
|
||||
{
|
||||
myCurDetected = Min (myDetectedSeq.Upper(), aDetIter);
|
||||
}
|
||||
if (myCurHighlighted == aDetIter)
|
||||
{
|
||||
myCurHighlighted = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aDetIter++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2382,6 +2401,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
|| myLastPicked->IsSameSelectable(theIObj))
|
||||
{
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
}
|
||||
|
@@ -1205,6 +1205,9 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||
return;
|
||||
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
return;
|
||||
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
|
||||
Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
|
||||
|
@@ -44,7 +44,8 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_LengthDimension,AIS_Dimension)
|
||||
//=======================================================================
|
||||
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH),
|
||||
myHasCustomDirection (Standard_False)
|
||||
{
|
||||
SetMeasuredGeometry (theFirstFace, theSecondFace);
|
||||
SetFlyout (15.0);
|
||||
@@ -56,7 +57,8 @@ AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFirstFace,
|
||||
//=======================================================================
|
||||
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH),
|
||||
myHasCustomDirection (Standard_False)
|
||||
{
|
||||
SetMeasuredGeometry (theFace, theEdge);
|
||||
SetFlyout (15.0);
|
||||
@@ -69,7 +71,8 @@ AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Face& theFace,
|
||||
AIS_LengthDimension::AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& thePlane)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH),
|
||||
myHasCustomDirection (Standard_False)
|
||||
{
|
||||
SetMeasuredGeometry (theFirstPoint, theSecondPoint, thePlane);
|
||||
SetFlyout (15.0);
|
||||
@@ -82,7 +85,8 @@ AIS_LengthDimension::AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape,
|
||||
const gp_Pln& thePlane)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH),
|
||||
myHasCustomDirection (Standard_False)
|
||||
{
|
||||
SetCustomPlane (thePlane);
|
||||
SetMeasuredShapes (theFirstShape, theSecondShape);
|
||||
@@ -95,7 +99,8 @@ AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
|
||||
//=======================================================================
|
||||
AIS_LengthDimension::AIS_LengthDimension (const TopoDS_Edge& theEdge,
|
||||
const gp_Pln& thePlane)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH)
|
||||
: AIS_Dimension (AIS_KOD_LENGTH),
|
||||
myHasCustomDirection (Standard_False)
|
||||
{
|
||||
SetMeasuredGeometry (theEdge, thePlane);
|
||||
SetFlyout (15.0);
|
||||
@@ -261,7 +266,13 @@ void AIS_LengthDimension::SetDisplayUnits (const TCollection_AsciiString& theUni
|
||||
//=======================================================================
|
||||
Standard_Real AIS_LengthDimension::ComputeValue() const
|
||||
{
|
||||
return IsValid() ? myFirstPoint.Distance (mySecondPoint) : 0.0;
|
||||
if (!IsValid())
|
||||
return 0.0;
|
||||
|
||||
if (!myHasCustomDirection)
|
||||
return myFirstPoint.Distance (mySecondPoint);
|
||||
|
||||
return fabs (gp_Vec(myFirstPoint, mySecondPoint).Dot (myDirection));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -282,6 +293,35 @@ void AIS_LengthDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
DrawLinearDimension (thePresentation, theMode, myFirstPoint, mySecondPoint);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeFlyoutLinePoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_LengthDimension::ComputeFlyoutLinePoints (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint,
|
||||
gp_Pnt& theLineBegPoint, gp_Pnt& theLineEndPoint)
|
||||
{
|
||||
if (!myHasCustomDirection)
|
||||
{
|
||||
AIS_Dimension::ComputeFlyoutLinePoints (theFirstPoint, theSecondPoint, theLineBegPoint, theLineEndPoint);
|
||||
return;
|
||||
}
|
||||
|
||||
// find scalar of projection target vector (from start to second point) to flyout vector
|
||||
gp_Ax1 aPlaneNormal = GetPlane().Axis();
|
||||
gp_Vec aFlyoutNormalizedDir(aPlaneNormal.Direction() ^ myDirection);
|
||||
aFlyoutNormalizedDir.Normalize();
|
||||
Standard_Real aTargetProjectedToFlyout = gp_Vec(theFirstPoint, theSecondPoint).Dot (aFlyoutNormalizedDir);
|
||||
|
||||
gp_Dir aFlyoutVector = aFlyoutNormalizedDir;
|
||||
// create lines for layouts
|
||||
gp_Lin aLine1 (theFirstPoint, aFlyoutVector);
|
||||
gp_Lin aLine2 (theSecondPoint, aFlyoutVector);
|
||||
|
||||
// Get flyout end points
|
||||
theLineBegPoint = ElCLib::Value (ElCLib::Parameter (aLine1, theFirstPoint) + GetFlyout() + aTargetProjectedToFlyout, aLine1);
|
||||
theLineEndPoint = ElCLib::Value (ElCLib::Parameter (aLine2, theSecondPoint) + GetFlyout(), aLine2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeFlyoutSelection
|
||||
//purpose :
|
||||
@@ -773,3 +813,14 @@ void AIS_LengthDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDirection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_LengthDimension::SetDirection (const gp_Dir& theDirection, const Standard_Boolean theUseDirection)
|
||||
{
|
||||
myHasCustomDirection = theUseDirection;
|
||||
if (myHasCustomDirection)
|
||||
myDirection = theDirection;
|
||||
}
|
||||
|
@@ -194,6 +194,13 @@ public:
|
||||
|
||||
Standard_EXPORT virtual const gp_Pnt GetTextPosition() const Standard_OVERRIDE;
|
||||
|
||||
//! Set custom direction for dimension. If it is not set, the direction is obtained
|
||||
//! from the measured geometry (e.g. line between points of dimension)
|
||||
//! The direction does not change flyout direction of dimension.
|
||||
//! @param theDirection [in] the dimension direction.
|
||||
//! @param theUseDirection [in] boolean value if custom direction should be used.
|
||||
Standard_EXPORT void SetDirection (const gp_Dir& theDirection, const Standard_Boolean theUseDirection = Standard_True);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_LengthDimension,AIS_Dimension)
|
||||
@@ -205,12 +212,25 @@ protected:
|
||||
|
||||
Standard_EXPORT virtual gp_Pln ComputePlane(const gp_Dir& theAttachDir) const;
|
||||
|
||||
//! Computes distance between dimension points. If custom direction is defined, the distance
|
||||
//! is a projection value of the distance between points to this direction
|
||||
//! @return dimension value
|
||||
Standard_EXPORT Standard_Real ComputeValue() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
//! Computes points bounded the flyout line for linear dimension.
|
||||
//! Direction of flyout line equal to the custom direction of dimension if defined or
|
||||
//! parallel to the main direction line
|
||||
//! @param theFirstPoint [in] the first attach point of linear dimension.
|
||||
//! @param theSecondPoint [in] the second attach point of linear dimension.
|
||||
//! @param theLineBegPoint [out] the first attach point of linear dimension.
|
||||
//! @param theLineEndPoint [out] the second attach point of linear dimension.
|
||||
Standard_EXPORT virtual void ComputeFlyoutLinePoints (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint,
|
||||
gp_Pnt& theLineBegPoint, gp_Pnt& theLineEndPoint) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theEntityOwner) Standard_OVERRIDE;
|
||||
|
||||
@@ -263,6 +283,8 @@ private:
|
||||
gp_Pnt mySecondPoint;
|
||||
TopoDS_Shape myFirstShape;
|
||||
TopoDS_Shape mySecondShape;
|
||||
gp_Dir myDirection;
|
||||
Standard_Boolean myHasCustomDirection;
|
||||
};
|
||||
|
||||
#endif // _AIS_LengthDimension_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,18 +17,31 @@
|
||||
#ifndef _AIS_Trihedron_HeaderFile
|
||||
#define _AIS_Trihedron_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_DatumMode.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
class Geom_Axis2Placement;
|
||||
class AIS_InteractiveObject;
|
||||
class AIS_Axis;
|
||||
@@ -46,26 +59,24 @@ class AIS_Trihedron;
|
||||
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
|
||||
|
||||
//! Create a selectable trihedron
|
||||
//! there are 4 modes of selection :
|
||||
//! mode = 0 to select trihedron ,priority = 1
|
||||
//! mode = 1 to select its origin ,priority = 5
|
||||
//! mode = 2 to select its axis ,priority = 3
|
||||
//! mode = 3 to select its planes ,priority = 2
|
||||
//! a trihedron has 1 origin, 3 axes and 3 planes.
|
||||
//! The trihedron includes 1 origin, 3 axes and 3 labels.
|
||||
//! Default text of labels are "X", "Y", "Z".
|
||||
//! Color of origin and any axis, color of arrows and labels may be changed.
|
||||
//! Visual presentation might be shown in two, shading and wireframe modes(wireframe by default)
|
||||
//! There are 4 modes of selection :
|
||||
//! mode = 0 to select trihedron, priority = 1
|
||||
//! mode = 1 to select its origin, priority = 5
|
||||
//! mode = 2 to select its axis, priority = 3
|
||||
//! mode = 3 to select its planes, priority = 2
|
||||
//! Warning
|
||||
//! For the presentation of trihedra, the default unit of
|
||||
//! length is the millimeter, and the default value for the
|
||||
//! representation of axes is 10. To modify these
|
||||
//! For the presentation of trihedron, the default unit of
|
||||
//! length is the millimetre, and the default value for the
|
||||
//! representation of the axes is 100. If you modify these
|
||||
//! dimensions, you must temporarily recover the Drawer.
|
||||
//! From inside it, you take the aspect in which the values
|
||||
//! for length are stocked. For trihedra, this is FirstAxisLength from
|
||||
//! Prs3d_DatumAspect(). Change the
|
||||
//! for length are stocked. For trihedron, this is
|
||||
//! Prs3d_Drawer_LineAspect. You change the
|
||||
//! values inside this Aspect and recalculate the presentation.
|
||||
//! If you want to use extended selection modes, different than 0,
|
||||
//! you should take care of removing of the shapes from the interactive
|
||||
//! context that has been computed for selection; it might be necessary
|
||||
//! when you change selection mode. You can use methods Axis, Point,
|
||||
//! Plane to retrieve the shapes.
|
||||
class AIS_Trihedron : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
|
||||
@@ -75,18 +86,24 @@ public:
|
||||
//! Initializes a trihedron entity.
|
||||
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
|
||||
|
||||
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
|
||||
Standard_EXPORT void SetDatumDisplayMode(const Prs3d_DatumMode& theMode) { myDisplayMode = theMode; }
|
||||
|
||||
//! Returns datum display mode.
|
||||
Standard_EXPORT Prs3d_DatumMode DatumDisplayMode() const { return myDisplayMode; }
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
const Handle(Geom_Axis2Placement)& Component() const;
|
||||
|
||||
Standard_EXPORT const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
|
||||
|
||||
//! Constructs the right-handed coordinate system aComponent.
|
||||
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& aComponent);
|
||||
|
||||
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& theComponent);
|
||||
|
||||
//! Returns true if the trihedron object has a size other
|
||||
//! than the default size of 10 mm. along each axis.
|
||||
Standard_Boolean HasOwnSize() const;
|
||||
|
||||
//! than the default size of 100 mm. along each axis.
|
||||
Standard_Boolean HasOwnSize() const;
|
||||
|
||||
//! Sets the size aValue for the trihedron object.
|
||||
//! The default value is 10 mm.
|
||||
//! The default value is 100 mm.
|
||||
Standard_EXPORT void SetSize (const Standard_Real aValue);
|
||||
|
||||
//! Removes any non-default settings for size of this
|
||||
@@ -95,43 +112,9 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real Size() const;
|
||||
|
||||
//! Returns the "XAxis".
|
||||
Standard_EXPORT Handle(AIS_Axis) XAxis() const;
|
||||
|
||||
//! Returns the "YAxis".
|
||||
Standard_EXPORT Handle(AIS_Axis) YAxis() const;
|
||||
|
||||
//! Returns the main Axis.
|
||||
Standard_EXPORT Handle(AIS_Axis) Axis() const;
|
||||
|
||||
//! Returns the origine.
|
||||
Standard_EXPORT Handle(AIS_Point) Position() const;
|
||||
|
||||
//! Returns the "XYPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) XYPlane() const;
|
||||
|
||||
//! Returns the "XZPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) XZPlane() const;
|
||||
|
||||
//! Returns the "YZPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) YZPlane() const;
|
||||
|
||||
//! connection to <aCtx> default drawer implies a recomputation
|
||||
//! of SubObjects values.
|
||||
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the display mode selected, aMode, is
|
||||
//! valid for trihedron datums.
|
||||
Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the presentation according to a point of view
|
||||
//! given by <aProjector>.
|
||||
//! To be Used when the associated degenerated Presentations
|
||||
//! have been transformed by <aTrsf> which is not a Pure
|
||||
//! Translation. The HLR Prs can't be deducted automatically
|
||||
//! WARNING :<aTrsf> must be applied
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
||||
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
|
||||
@@ -139,63 +122,154 @@ public:
|
||||
//! Indicates that the type of Interactive Object is datum.
|
||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the color aColor for this trihedron object.
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor);
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor theColor);
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own text color
|
||||
Standard_EXPORT Standard_Boolean HasTextColor() const;
|
||||
|
||||
Standard_EXPORT Quantity_NameOfColor TextColor() const;
|
||||
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor);
|
||||
//! Returns trihedron text color
|
||||
Standard_EXPORT Quantity_Color TextColor() const;
|
||||
|
||||
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor theColor);
|
||||
|
||||
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own arrow color
|
||||
Standard_EXPORT Standard_Boolean HasArrowColor() const;
|
||||
|
||||
Standard_EXPORT Quantity_NameOfColor ArrowColor() const;
|
||||
|
||||
//! Returns the four extremities of the trihedron from the
|
||||
//! array of points, TheExtrem.
|
||||
Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const;
|
||||
//! Returns trihedron arrow color
|
||||
Standard_EXPORT Quantity_Color ArrowColor() const;
|
||||
|
||||
//! Removes the settings for color.
|
||||
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
//! Removes the non-default settings for width set in SetWidth.
|
||||
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
|
||||
//! Sets color of datum part: origin or some of trihedron axes.
|
||||
//! If presentation is shading mode, this color is set for both sides of facing model
|
||||
Standard_EXPORT void SetColor (const Prs3d_DatumParts& thePart,
|
||||
const Quantity_Color& theColor);
|
||||
|
||||
//! Returns color of datum part: origin or some of trihedron axes.
|
||||
Standard_EXPORT Quantity_Color Color (const Prs3d_DatumParts& thePart);
|
||||
|
||||
//! Sets color of origin.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetOriginColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of x-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetXAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of y-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetYAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of z-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets priority of selection for owner of the given type
|
||||
Standard_EXPORT void SetSelectionPriority(const Prs3d_DatumParts& thePart, const Standard_Integer thePriority)
|
||||
{
|
||||
mySelectionPriority.Bind(thePart, thePriority);
|
||||
}
|
||||
|
||||
//! Sets priority of selection for owner of the given type
|
||||
Standard_EXPORT Standard_Integer SelectionPriority(const Prs3d_DatumParts& thePart)
|
||||
{
|
||||
return mySelectionPriority.Find(thePart);
|
||||
}
|
||||
|
||||
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
Standard_EXPORT void SetLabel(const Prs3d_DatumParts& thePart, const TCollection_ExtendedString& thePriority)
|
||||
{
|
||||
myLabel.Bind(thePart, thePriority);
|
||||
}
|
||||
|
||||
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
Standard_EXPORT const TCollection_ExtendedString& Label(const Prs3d_DatumParts& thePart)
|
||||
{
|
||||
return myLabel.Find(thePart);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
||||
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE;
|
||||
|
||||
//! Method which clear all selected owners belonging
|
||||
//! to this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||
|
||||
//! Method which draws selected owners ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const SelectMgr_SequenceOfOwner& theOwners) Standard_OVERRIDE;
|
||||
|
||||
//! Method which hilight an owner belonging to
|
||||
//! this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||
//! Compute trihedron presentation.
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
//! This compute is unavailable for trihedron presentation.
|
||||
void Compute (const Handle(Prs3d_Projector)& , const Handle(Prs3d_Presentation)& ) Standard_OVERRIDE {}
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void LoadSubObjects();
|
||||
//! This compute is unavailable for trihedron presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection.
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Computes presentation for display mode equal 1.
|
||||
Standard_EXPORT void ComputePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs);
|
||||
|
||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||
|
||||
//! Created a sensitive entity for the datum part that will be used in selection owner creation
|
||||
Handle(SelectBasics_SensitiveEntity) CreateSensitiveEntity(const Prs3d_DatumParts& thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
Handle(AIS_InteractiveObject) myShapes[7];
|
||||
Standard_Boolean myHasOwnSize;
|
||||
Standard_Boolean myHasOwnTextColor;
|
||||
Quantity_NameOfColor myOwnTextColor;
|
||||
Standard_Boolean myHasOwnArrowColor;
|
||||
Quantity_NameOfColor myOwnArrowColor;
|
||||
|
||||
Prs3d_DatumMode myDisplayMode;
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Standard_Integer> mySelectionPriority;
|
||||
NCollection_DataMap<Prs3d_DatumParts, TCollection_ExtendedString> myLabel;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
||||
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
||||
|
||||
Handle(Prs3d_PointAspect) myPointAspect;
|
||||
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect; // internal container to set group selected
|
||||
Handle(Prs3d_LineAspect) myHighlightLineAspect; // internal container to set group selected
|
||||
Handle(Prs3d_PointAspect) myHighlightPointAspect; // internal container to set group selected
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_Trihedron.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_Trihedron_HeaderFile
|
||||
|
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
@@ -0,0 +1,66 @@
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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 <AIS_TrihedronOwner.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
|
||||
AIS_TrihedronOwner::AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Prs3d_DatumParts thePart,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner (theSelObject, thePriority),
|
||||
myDatumPart (thePart)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_TrihedronOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Selectable()->HilightOwnerWithColor (thePM, theStyle, this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_TrihedronOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return thePM->IsHighlighted (Selectable(), theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_TrihedronOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Unhighlight (Selectable());
|
||||
}
|
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
@@ -0,0 +1,56 @@
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef _AIS_TrihedronOwner_HeaderFile
|
||||
#define _AIS_TrihedronOwner_HeaderFile
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
|
||||
//! Entity owner for selection management of AIS_Trihedron object.
|
||||
class AIS_TrihedronOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
public:
|
||||
|
||||
//! Creates an owner of AIS_Trihedron object.
|
||||
Standard_EXPORT AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Prs3d_DatumParts theDatumPart,
|
||||
const Standard_Integer thePriority);
|
||||
|
||||
Standard_EXPORT const Prs3d_DatumParts& DatumPart() const { return myDatumPart; }
|
||||
|
||||
//! Highlights selectable object's presentation.
|
||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
//! Returns true if the presentation manager thePM
|
||||
//! highlights selections corresponding to the selection mode aMode.
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
|
||||
//! Removes highlighting from the owner of a detected
|
||||
//! selectable object in the presentation manager thePM.
|
||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
Prs3d_DatumParts myDatumPart; //! Part of datum selected
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
|
||||
#endif // _AIS_TrihedronOwner_HeaderFile
|
@@ -179,6 +179,8 @@ AIS_Triangulation.hxx
|
||||
AIS_Trihedron.cxx
|
||||
AIS_Trihedron.hxx
|
||||
AIS_Trihedron.lxx
|
||||
AIS_TrihedronOwner.cxx
|
||||
AIS_TrihedronOwner.hxx
|
||||
AIS_TypeFilter.cxx
|
||||
AIS_TypeFilter.hxx
|
||||
AIS_TypeOfAngle.hxx
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_SequenceOfShape.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
@@ -352,7 +352,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
|
||||
}
|
||||
//
|
||||
Standard_Integer iErr, n1, n2;
|
||||
BOPDS_MapIteratorMapOfPassKey aItMPK;
|
||||
BOPDS_MapIteratorOfMapOfPair aItMPK;
|
||||
BOPCol_ListOfShape anArgs;
|
||||
BOPAlgo_CheckerSI aChecker;
|
||||
//
|
||||
@@ -367,12 +367,12 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
|
||||
iErr=aChecker.ErrorStatus();
|
||||
//
|
||||
const BOPDS_DS& aDS=*(aChecker.PDS());
|
||||
const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
|
||||
const BOPDS_MapOfPair& aMPK=aDS.Interferences();
|
||||
//
|
||||
aItMPK.Initialize(aMPK);
|
||||
for (; aItMPK.More(); aItMPK.Next()) {
|
||||
const BOPDS_PassKey& aPK=aItMPK.Value();
|
||||
aPK.Ids(n1, n2);
|
||||
const BOPDS_Pair& aPK=aItMPK.Value();
|
||||
aPK.Indices(n1, n2);
|
||||
if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
@@ -384,12 +384,14 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
|
||||
if(ii == 0) {
|
||||
aResult.SetShape1(myShape1);
|
||||
aResult.AddFaultyShape1(aS1);
|
||||
aResult.AddFaultyShape1(aS2);
|
||||
if (!aS1.IsSame(aS2))
|
||||
aResult.AddFaultyShape1(aS2);
|
||||
}
|
||||
else {
|
||||
aResult.SetShape2(myShape2);
|
||||
aResult.AddFaultyShape2(aS1);
|
||||
aResult.AddFaultyShape2(aS2);
|
||||
if (!aS1.IsSame(aS2))
|
||||
aResult.AddFaultyShape2(aS2);
|
||||
}
|
||||
aResult.SetCheckStatus(BOPAlgo_SelfIntersect);
|
||||
myResult.Append(aResult);
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
typedef NCollection_IndexedDataMap
|
||||
<BOPTools_Set,
|
||||
@@ -49,7 +48,22 @@ static
|
||||
static
|
||||
void CollectContainers(const TopoDS_Shape& theS,
|
||||
BOPCol_ListOfShape& theLSC);
|
||||
|
||||
//
|
||||
static
|
||||
void RemoveDuplicates(BOPCol_ListOfShape& theContainers);
|
||||
//
|
||||
static
|
||||
void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
|
||||
const TopAbs_ShapeEnum theType);
|
||||
//
|
||||
static
|
||||
Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
|
||||
const BOPCol_MapOfShape& theM2);
|
||||
//
|
||||
static
|
||||
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
|
||||
BOPCol_IndexedMapOfShape& theMFI);
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -376,6 +390,7 @@ void BOPAlgo_BOP::Perform()
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
pPF->SetGlue(myGlue);
|
||||
//
|
||||
pPF->Perform();
|
||||
//
|
||||
@@ -545,10 +560,10 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
Standard_Integer i, j, aNb, iDim;
|
||||
Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
|
||||
BOPCol_IndexedMapOfShape aMArgs, aMTools;
|
||||
BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
//
|
||||
// prepare the building elements of arguments to get its splits
|
||||
BOPCol_IndexedMapOfShape aMArgs, aMTools;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
|
||||
BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
|
||||
@@ -563,9 +578,14 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
bCheckEdges = Standard_False;
|
||||
//
|
||||
// get splits of building elements
|
||||
BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
|
||||
BOPTools_IndexedDataMapOfSetShape aMSetArgs, aMSetTools;
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
|
||||
BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
|
||||
BOPTools_IndexedDataMapOfSetShape& aMSet = !i ? aMSetArgs : aMSetTools;
|
||||
//
|
||||
aNb = aMS.Extent();
|
||||
for (j = 1; j <= aNb; ++j) {
|
||||
@@ -589,6 +609,13 @@ void BOPAlgo_BOP::BuildRC()
|
||||
}
|
||||
else {
|
||||
aMSIm.Add(aS);
|
||||
if (aS.ShapeType() == TopAbs_SOLID) {
|
||||
BOPTools_Set aST;
|
||||
aST.Add(aS, TopAbs_FACE);
|
||||
if (!aMSet.Contains(aST)) {
|
||||
aMSet.Add(aST, aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,6 +630,7 @@ void BOPAlgo_BOP::BuildRC()
|
||||
//
|
||||
const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
|
||||
const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
|
||||
const BOPTools_IndexedDataMapOfSetShape& aMSetCheck = bCut21 ? aMSetArgs : aMSetTools;
|
||||
//
|
||||
BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
|
||||
//
|
||||
@@ -638,6 +666,12 @@ void BOPAlgo_BOP::BuildRC()
|
||||
const TopoDS_Shape& aS = aMItExp(i);
|
||||
//
|
||||
bContains = aMCheckExp.Contains(aS);
|
||||
if (!bContains && aS.ShapeType() == TopAbs_SOLID) {
|
||||
BOPTools_Set aST;
|
||||
aST.Add(aS, TopAbs_FACE);
|
||||
bContains = aMSetCheck.Contains(aST);
|
||||
}
|
||||
//
|
||||
if (bCommon) {
|
||||
if (bContains) {
|
||||
aBB.Add(aC, aS);
|
||||
@@ -732,15 +766,12 @@ void BOPAlgo_BOP::BuildShape()
|
||||
//
|
||||
Standard_Integer i;
|
||||
TopAbs_ShapeEnum aType, aT1, aT2;
|
||||
TopTools_ListOfShape aLSC, aLCB;
|
||||
BOPCol_ListOfShape aLSC, aLCB;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS, aItLSIm, aItLCB;
|
||||
TopoDS_Iterator aIt;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Shape aRC, aRCB;
|
||||
//
|
||||
TopoDS_Compound aResult;
|
||||
aBB.MakeCompound(aResult);
|
||||
//
|
||||
BOPCol_MapOfShape aMSRC;
|
||||
BOPTools::MapShapes(myRC, aMSRC);
|
||||
//
|
||||
@@ -756,6 +787,7 @@ void BOPAlgo_BOP::BuildShape()
|
||||
}
|
||||
}
|
||||
// make containers
|
||||
BOPCol_ListOfShape aLCRes;
|
||||
aItLS.Initialize(aLSC);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSC = aItLS.Value();
|
||||
@@ -766,7 +798,7 @@ void BOPAlgo_BOP::BuildShape()
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
if (myImages.IsBound(aS)) {
|
||||
const TopTools_ListOfShape& aLSIm = myImages.Find(aS);
|
||||
const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
|
||||
//
|
||||
aItLSIm.Initialize(aLSIm);
|
||||
for (; aItLSIm.More(); aItLSIm.Next()) {
|
||||
@@ -816,14 +848,31 @@ void BOPAlgo_BOP::BuildShape()
|
||||
aBB.Add(aRCB, aCBS);
|
||||
}
|
||||
//
|
||||
if (aType == TopAbs_SHELL) {
|
||||
if (aType == TopAbs_WIRE) {
|
||||
// reorient wire
|
||||
BOPTools_AlgoTools::OrientEdgesOnWire(aRCB);
|
||||
}
|
||||
else if (aType == TopAbs_SHELL) {
|
||||
BOPTools_AlgoTools::OrientFacesOnShell(aRCB);
|
||||
}
|
||||
//
|
||||
aBB.Add(aResult, aRCB);
|
||||
aRCB.Orientation(aSC.Orientation());
|
||||
//
|
||||
aLCRes.Append(aRCB);
|
||||
}
|
||||
}
|
||||
//
|
||||
RemoveDuplicates(aLCRes);
|
||||
//
|
||||
// add containers to result
|
||||
TopoDS_Compound aResult;
|
||||
aBB.MakeCompound(aResult);
|
||||
//
|
||||
aItLS.Initialize(aLCRes);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
aBB.Add(aResult, aItLS.Value());
|
||||
}
|
||||
//
|
||||
// add the rest of the shapes into result
|
||||
BOPCol_MapOfShape aMSResult;
|
||||
BOPTools::MapShapes(aResult, aMSResult);
|
||||
@@ -831,7 +880,7 @@ void BOPAlgo_BOP::BuildShape()
|
||||
aIt.Initialize(myRC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
if (!aMSResult.Contains(aS)) {
|
||||
if (aMSResult.Add(aS)) {
|
||||
aBB.Add(aResult, aS);
|
||||
}
|
||||
}
|
||||
@@ -844,122 +893,107 @@ void BOPAlgo_BOP::BuildShape()
|
||||
//=======================================================================
|
||||
void BOPAlgo_BOP::BuildSolid()
|
||||
{
|
||||
Standard_Boolean bHasInterf, bHasSharedFaces;
|
||||
Standard_Integer i, aNbF, aNbSx, iX, iErr, aNbZ;
|
||||
TopAbs_Orientation aOr, aOr1;
|
||||
TopoDS_Iterator aIt;
|
||||
TopoDS_Shape aRC;
|
||||
BRep_Builder aBB;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_IndexedMapOfShape aMFI;
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMFS, aMEF;
|
||||
// Containers
|
||||
BOPCol_ListOfShape aLSC;
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
BOPCol_ListOfShape aSFS;
|
||||
BOPAlgo_BuilderSolid aSB;
|
||||
BOPCol_MapOfShape aMSA, aMZ;
|
||||
BOPTools_IndexedDataMapOfSetShape aDMSTS;
|
||||
TopExp_Explorer aExp;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
// Map of of Solids of Arguments
|
||||
for (i=0; i<2; ++i) {
|
||||
const BOPCol_ListOfShape& aLSA=(i) ? myArguments : myTools;
|
||||
// Get solids from input arguments
|
||||
BOPCol_MapOfShape aMSA;
|
||||
// Map the arguments to find shared faces
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
|
||||
for (Standard_Integer i = 0; i < 2; ++i) {
|
||||
const BOPCol_ListOfShape& aLSA = (i) ? myArguments : myTools;
|
||||
aItLS.Initialize(aLSA);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSA=aItLS.Value();
|
||||
const TopoDS_Shape& aSA = aItLS.Value();
|
||||
aExp.Init(aSA, TopAbs_SOLID);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aZA=aExp.Current();
|
||||
aMSA.Add(aZA);
|
||||
//
|
||||
BOPTools::MapShapesAndAncestors(aZA,
|
||||
TopAbs_FACE,
|
||||
TopAbs_SOLID,
|
||||
aMFS);
|
||||
const TopoDS_Shape& aSol = aExp.Current();
|
||||
aMSA.Add(aSol);
|
||||
BOPTools::MapShapesAndAncestors(aSol, TopAbs_FACE, TopAbs_SOLID, aMFS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aNbF=aMFS.Extent();
|
||||
for (i=1; i<aNbF; ++i) {
|
||||
//const TopoDS_Shape& aFA=aMFZA.FindKey(i);
|
||||
const BOPCol_ListOfShape& aLZA=aMFS(i);
|
||||
aNbZ=aLZA.Extent();
|
||||
if (aNbZ > 1) {
|
||||
aItLS.Initialize(aLZA);
|
||||
for(; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aZA=aItLS.Value();
|
||||
aMZ.Add(aZA);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aMFS.Clear();
|
||||
//
|
||||
aIt.Initialize(myRC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
if (aMSA.Contains(aSx)) {
|
||||
iX=myDS->Index(aSx);
|
||||
bHasInterf=myDS->HasInterf(iX);
|
||||
bHasSharedFaces=aMZ.Contains(aSx);
|
||||
//
|
||||
if (!bHasInterf && !bHasSharedFaces) {
|
||||
// It means that the solid aSx will be added
|
||||
// to the result as is.
|
||||
// The solid aSx will not participate
|
||||
// in creation of a new solid(s).
|
||||
BOPTools_Set aST;
|
||||
//
|
||||
aST.Add(aSx, TopAbs_FACE);
|
||||
//
|
||||
if (!aDMSTS.Contains(aST)) {
|
||||
aDMSTS.Add(aST, aSx);
|
||||
}
|
||||
|
||||
continue;
|
||||
// get Compsolids from input arguments
|
||||
CollectContainers(aSA, aLSC);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Find solids in input arguments sharing faces with other solids
|
||||
BOPCol_MapOfShape aMTSols;
|
||||
Standard_Integer i, aNb = aMFS.Extent();
|
||||
for (i = 1; i < aNb; ++i) {
|
||||
const BOPCol_ListOfShape& aLSols = aMFS(i);
|
||||
if (aLSols.Extent() > 1) {
|
||||
aItLS.Initialize(aLSols);
|
||||
for(; aItLS.More(); aItLS.Next()) {
|
||||
aMTSols.Add(aItLS.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Possibly untouched solids - to be added to results as is
|
||||
BOPCol_IndexedMapOfShape aMUSols;
|
||||
// Use map to chose the most outer faces to build result solids
|
||||
aMFS.Clear();
|
||||
// Internal faces
|
||||
BOPCol_IndexedMapOfShape aMFI;
|
||||
//
|
||||
TopoDS_Iterator aIt(myRC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx = aIt.Value();
|
||||
if (aMSA.Contains(aSx)) {
|
||||
if (!aMTSols.Contains(aSx)) {
|
||||
aMUSols.Add(aSx);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//
|
||||
MapFacesToBuildSolids(aSx, aMFS, aMFI);
|
||||
} // for (; aIt.More(); aIt.Next()) {
|
||||
//
|
||||
// Process possibly untouched solids.
|
||||
// Really untouched solids will be added into result as is.
|
||||
// Others will be processed by BuilderSolid.
|
||||
BOPTools_IndexedDataMapOfSetShape aDMSTS;
|
||||
//
|
||||
aNb = aMUSols.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const TopoDS_Shape& aSx = aMUSols(i);
|
||||
//
|
||||
aExp.Init(aSx, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aFx=aExp.Current();
|
||||
//
|
||||
aOr=aFx.Orientation();
|
||||
if (aOr==TopAbs_INTERNAL) {
|
||||
aMFI.Add(aFx);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (!aMFS.Contains(aFx)) {
|
||||
BOPCol_ListOfShape aLSx;
|
||||
//
|
||||
aLSx.Append(aSx);
|
||||
aMFS.Add(aFx, aLSx);
|
||||
}
|
||||
else {
|
||||
iX=aMFS.FindIndex(aFx);
|
||||
const TopoDS_Shape& aFx1=aMFS.FindKey(iX);
|
||||
aOr1=aFx1.Orientation();
|
||||
if (aOr1!=aOr) {
|
||||
BOPCol_ListOfShape& aLSx=aMFS.ChangeFromKey(aFx);
|
||||
aLSx.Append(aSx);
|
||||
aMFS.Add(aFx, aLSx);
|
||||
}
|
||||
if (aMFS.Contains(aExp.Current())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for (; aIt.More(); aIt.Next()) {
|
||||
//faces that will be added in the end;
|
||||
BOPCol_ListOfShape aLF, aLFx;
|
||||
// SFS
|
||||
aNbF=aMFS.Extent();
|
||||
for (i=1; i<=aNbF; ++i) {
|
||||
const TopoDS_Shape& aFx=aMFS.FindKey(i);
|
||||
const BOPCol_ListOfShape& aLSx=aMFS(i);
|
||||
aNbSx=aLSx.Extent();
|
||||
if (aNbSx==1) {
|
||||
BOPTools::MapShapesAndAncestors
|
||||
(aFx,TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
//
|
||||
if (aExp.More()) {
|
||||
MapFacesToBuildSolids(aSx, aMFS, aMFI);
|
||||
}
|
||||
else {
|
||||
BOPTools_Set aST;
|
||||
aST.Add(aSx, TopAbs_FACE);
|
||||
if (!aDMSTS.Contains(aST)) {
|
||||
aDMSTS.Add(aST, aSx);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
|
||||
// Split faces will be added in the end
|
||||
// to avoid errors in BuilderSolid algorithm
|
||||
BOPCol_ListOfShape aLF, aLFx;
|
||||
aNb = aMFS.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const BOPCol_ListOfShape& aLSx = aMFS(i);
|
||||
if (aLSx.Extent() == 1) {
|
||||
const TopoDS_Shape& aFx = aMFS.FindKey(i);
|
||||
BOPTools::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
||||
if (IsBoundSplits(aFx, aMEF)){
|
||||
aLFx.Append(aFx);
|
||||
continue;
|
||||
@@ -967,57 +1001,151 @@ void BOPAlgo_BOP::BuildSolid()
|
||||
aLF.Append(aFx);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Faces to build result solids
|
||||
BOPCol_ListOfShape aSFS;
|
||||
aItLS.Initialize(aLF);
|
||||
for(; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aFx=aItLS.Value();
|
||||
const TopoDS_Shape& aFx = aItLS.Value();
|
||||
aSFS.Append(aFx);
|
||||
}
|
||||
// add faces from aLFx to aSFS;
|
||||
//
|
||||
// Split faces
|
||||
aItLS.Initialize(aLFx);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aFx=aItLS.Value();
|
||||
const TopoDS_Shape& aFx = aItLS.Value();
|
||||
aSFS.Append(aFx);
|
||||
}
|
||||
//
|
||||
aNbF=aMFI.Extent();
|
||||
for (i=1; i<=aNbF; ++i) {
|
||||
TopoDS_Shape aFx;
|
||||
// Internal faces
|
||||
aNb = aMFI.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
TopoDS_Shape aFx = aMFI.FindKey(i);
|
||||
aSFS.Append(aFx.Oriented(TopAbs_FORWARD));
|
||||
aSFS.Append(aFx.Oriented(TopAbs_REVERSED));
|
||||
}
|
||||
//
|
||||
TopoDS_Shape aRC;
|
||||
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
|
||||
if (aSFS.Extent()) {
|
||||
// Build solids from set of faces
|
||||
BOPAlgo_BuilderSolid aSB;
|
||||
aSB.SetContext(myContext);
|
||||
aSB.SetShapes(aSFS);
|
||||
aSB.Perform();
|
||||
if (aSB.ErrorStatus()) {
|
||||
myErrorStatus = 30; // SolidBuilder failed
|
||||
return;
|
||||
}
|
||||
// new solids
|
||||
const BOPCol_ListOfShape& aLSR = aSB.Areas();
|
||||
//
|
||||
aFx=aMFI.FindKey(i);
|
||||
aFx.Orientation(TopAbs_FORWARD);
|
||||
aSFS.Append(aFx);
|
||||
aFx.Orientation(TopAbs_REVERSED);
|
||||
aSFS.Append(aFx);
|
||||
// add new solids to result
|
||||
aItLS.Initialize(aLSR);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSR = aItLS.Value();
|
||||
aBB.Add(aRC, aSR);
|
||||
}
|
||||
}
|
||||
//
|
||||
// BuilderSolid
|
||||
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
|
||||
//
|
||||
aSB.SetContext(myContext);
|
||||
aSB.SetShapes(aSFS);
|
||||
aSB.Perform();
|
||||
iErr=aSB.ErrorStatus();
|
||||
if (iErr) {
|
||||
myErrorStatus=30; // SolidBuilder failed
|
||||
return;
|
||||
}
|
||||
//
|
||||
const BOPCol_ListOfShape& aLSR=aSB.Areas();
|
||||
//
|
||||
aItLS.Initialize(aLSR);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSR=aItLS.Value();
|
||||
aBB.Add(aRC, aSR);
|
||||
}
|
||||
//
|
||||
aNbSx = aDMSTS.Extent();
|
||||
for (i = 1; i <= aNbSx; ++i) {
|
||||
// add untouched solids to result
|
||||
aNb = aDMSTS.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const TopoDS_Shape& aSx = aDMSTS(i);
|
||||
aBB.Add(aRC, aSx);
|
||||
}
|
||||
//
|
||||
myShape=aRC;
|
||||
if (aLSC.IsEmpty()) {
|
||||
// no Compsolids in arguments
|
||||
myShape = aRC;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// build new Compsolids from new solids containing splits
|
||||
// of faces from arguments of type Compsolid
|
||||
//
|
||||
TopoDS_Shape aResult;
|
||||
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aResult);
|
||||
//
|
||||
aIt.Initialize(aRC);
|
||||
if (!aIt.More()) {
|
||||
// no solids in the result
|
||||
myShape = aRC;
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSol1 = aIt.Value();
|
||||
aIt.Next();
|
||||
//
|
||||
// optimization for one solid in the result
|
||||
if (!aIt.More()) {
|
||||
TopoDS_Shape aCS;
|
||||
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPSOLID, aCS);
|
||||
aBB.Add(aCS, aSol1);
|
||||
//
|
||||
aBB.Add(aResult, aCS);
|
||||
myShape = aResult;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// get splits of faces of the Compsolid arguments
|
||||
BOPCol_MapOfShape aMFCs;
|
||||
aItLS.Initialize(aLSC);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aCs = aItLS.Value();
|
||||
aExp.Init(aCs, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF = aExp.Current();
|
||||
const BOPCol_ListOfShape* pLFIm = myImages.Seek(aF);
|
||||
if (!pLFIm) {
|
||||
aMFCs.Add(aF);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListIteratorOfListOfShape aItLFIm(*pLFIm);
|
||||
for (; aItLFIm.More(); aItLFIm.Next()) {
|
||||
aMFCs.Add(aItLFIm.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// build connexity blocks from new solids
|
||||
BOPCol_ListOfShape aLCBS;
|
||||
BOPTools_AlgoTools::MakeConnexityBlocks(aRC, TopAbs_FACE, TopAbs_SOLID, aLCBS);
|
||||
//
|
||||
aItLS.Initialize(aLCBS);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aCB = aItLS.Value();
|
||||
//
|
||||
// check if the Compsolid should be created
|
||||
aExp.Init(aCB, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
if (aMFCs.Contains(aExp.Current())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!aExp.More()) {
|
||||
// add solids directly into result as their origins are not Compsolids
|
||||
for (aIt.Initialize(aCB); aIt.More(); aIt.Next()) {
|
||||
aBB.Add(aResult, aIt.Value());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make Compsolid
|
||||
TopoDS_Shape aCS;
|
||||
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPSOLID, aCS);
|
||||
//
|
||||
aIt.Initialize(aCB);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aBB.Add(aCS, aIt.Value());
|
||||
}
|
||||
//
|
||||
aBB.Add(aResult, aCS);
|
||||
}
|
||||
//
|
||||
myShape = aResult;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsBoundSplits
|
||||
@@ -1120,3 +1248,155 @@ void CollectContainers(const TopoDS_Shape& theS,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveDuplicates
|
||||
//purpose : Filters the containers with identical contents
|
||||
//=======================================================================
|
||||
void RemoveDuplicates(BOPCol_ListOfShape& theContainers)
|
||||
{
|
||||
RemoveDuplicates(theContainers, TopAbs_WIRE);
|
||||
RemoveDuplicates(theContainers, TopAbs_SHELL);
|
||||
RemoveDuplicates(theContainers, TopAbs_COMPSOLID);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveDuplicates
|
||||
//purpose : Filters the containers of given type with identical contents
|
||||
//=======================================================================
|
||||
void RemoveDuplicates(BOPCol_ListOfShape& theContainers,
|
||||
const TopAbs_ShapeEnum theType)
|
||||
{
|
||||
// get containers of given type
|
||||
BOPCol_ListOfShape aLC;
|
||||
BOPCol_ListIteratorOfListOfShape aItLC(theContainers);
|
||||
for (; aItLC.More(); aItLC.Next()) {
|
||||
const TopoDS_Shape& aC = aItLC.Value();
|
||||
if (aC.ShapeType() == theType) {
|
||||
aLC.Append(aC);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aLC.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// map containers to compare its contents
|
||||
NCollection_IndexedDataMap<TopoDS_Shape, BOPCol_MapOfShape> aContents;
|
||||
//
|
||||
aItLC.Initialize(aLC);
|
||||
for (; aItLC.More(); aItLC.Next()) {
|
||||
const TopoDS_Shape& aC = aItLC.Value();
|
||||
//
|
||||
BOPCol_MapOfShape& aMC = aContents(aContents.Add(aC, BOPCol_MapOfShape()));
|
||||
//
|
||||
TopoDS_Iterator aIt(aC);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aMC.Add(aIt.Value());
|
||||
}
|
||||
}
|
||||
//
|
||||
// compare the contents of the containers and find duplicates
|
||||
BOPCol_MapOfShape aDuplicates;
|
||||
//
|
||||
Standard_Integer i, j, aNb = aContents.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const TopoDS_Shape& aCi = aContents.FindKey(i);
|
||||
if (aDuplicates.Contains(aCi)) {
|
||||
continue;
|
||||
}
|
||||
const BOPCol_MapOfShape& aMi = aContents(i);
|
||||
Standard_Integer aNbi = aMi.Extent();
|
||||
//
|
||||
for (j = i + 1; j <= aNb; ++j) {
|
||||
const TopoDS_Shape& aCj = aContents.FindKey(j);
|
||||
if (aDuplicates.Contains(aCj)) {
|
||||
continue;
|
||||
}
|
||||
const BOPCol_MapOfShape& aMj = aContents(j);
|
||||
Standard_Integer aNbj = aMj.Extent();
|
||||
//
|
||||
Standard_Integer aNbCommon = NbCommonItemsInMap(aMi, aMj);
|
||||
//
|
||||
if (aNbj == aNbCommon) {
|
||||
aDuplicates.Add(aCj);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aNbi == aNbCommon) {
|
||||
aDuplicates.Add(aCi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aDuplicates.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// remove duplicating containers
|
||||
aItLC.Initialize(theContainers);
|
||||
for (; aItLC.More(); ) {
|
||||
const TopoDS_Shape& aC = aItLC.Value();
|
||||
if (aDuplicates.Contains(aC)) {
|
||||
theContainers.Remove(aItLC);
|
||||
continue;
|
||||
}
|
||||
aItLC.Next();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbCommonItemsInMap
|
||||
//purpose : Counts the items contained in both maps
|
||||
//=======================================================================
|
||||
Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
|
||||
const BOPCol_MapOfShape& theM2)
|
||||
{
|
||||
const BOPCol_MapOfShape* aMap1 = &theM1;
|
||||
const BOPCol_MapOfShape* aMap2 = &theM2;
|
||||
//
|
||||
if (theM2.Extent() < theM1.Extent()) {
|
||||
aMap1 = &theM2;
|
||||
aMap2 = &theM1;
|
||||
}
|
||||
//
|
||||
Standard_Integer iCommon = 0;
|
||||
for (BOPCol_MapIteratorOfMapOfShape aIt(*aMap1); aIt.More(); aIt.Next()) {
|
||||
if (aMap2->Contains(aIt.Value())) {
|
||||
++iCommon;
|
||||
}
|
||||
}
|
||||
return iCommon;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MapFacesToBuildSolids
|
||||
//purpose : Stores the faces of the given solid into outgoing maps:
|
||||
// <theMFS> - not internal faces with reference to solid;
|
||||
// <theMFI> - internal faces.
|
||||
//=======================================================================
|
||||
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
|
||||
BOPCol_IndexedMapOfShape& theMFI)
|
||||
{
|
||||
TopExp_Explorer aExp(theSol, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF = aExp.Current();
|
||||
//
|
||||
if (aF.Orientation() == TopAbs_INTERNAL) {
|
||||
theMFI.Add(aF);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape* pLSol = theMFS.ChangeSeek(aF);
|
||||
if (!pLSol) {
|
||||
pLSol = &theMFS(theMFS.Add(aF, BOPCol_ListOfShape()));
|
||||
pLSol->Append(theSol);
|
||||
}
|
||||
else {
|
||||
const TopoDS_Shape& aF1 = theMFS.FindKey(theMFS.FindIndex(aF));
|
||||
if (aF1.Orientation() != aF.Orientation()) {
|
||||
pLSol->Append(theSol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,8 @@ BOPAlgo_Builder::BOPAlgo_Builder()
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myNonDestructive(Standard_False)
|
||||
myNonDestructive(Standard_False),
|
||||
myGlue(BOPAlgo_GlueOff)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -71,7 +72,8 @@ BOPAlgo_Builder::BOPAlgo_Builder
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myNonDestructive(Standard_False)
|
||||
myNonDestructive(Standard_False),
|
||||
myGlue(BOPAlgo_GlueOff)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -200,6 +202,22 @@ Standard_Boolean BOPAlgo_Builder::NonDestructive() const
|
||||
return myNonDestructive;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetGlue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Builder::SetGlue(const BOPAlgo_GlueEnum theGlue)
|
||||
{
|
||||
myGlue=theGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Glue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPAlgo_GlueEnum BOPAlgo_Builder::Glue() const
|
||||
{
|
||||
return myGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: CheckData
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
@@ -268,6 +286,7 @@ void BOPAlgo_Builder::Perform()
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
pPF->SetGlue(myGlue);
|
||||
//
|
||||
pPF->Perform();
|
||||
//
|
||||
@@ -283,6 +302,7 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
|
||||
myEntryPoint=0;
|
||||
myNonDestructive = theFiller.NonDestructive();
|
||||
myFuzzyValue = theFiller.FuzzyValue();
|
||||
myGlue = theFiller.Glue();
|
||||
PerformInternal(theFiller);
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPAlgo_PPaveFiller.hxx>
|
||||
#include <BOPAlgo_GlueEnum.hxx>
|
||||
#include <BOPDS_PDS.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
@@ -107,6 +108,11 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
|
||||
//! a copy of a sub-shape is created in the result if it is needed to be updated.
|
||||
Standard_EXPORT Standard_Boolean NonDestructive() const;
|
||||
|
||||
//! Sets the glue option for the algorithm
|
||||
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
|
||||
|
||||
//! Returns the glue option of the algorithm
|
||||
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -167,6 +173,7 @@ protected:
|
||||
BOPCol_DataMapOfShapeListOfShape mySplits;
|
||||
BOPCol_DataMapOfShapeShape myOrigins;
|
||||
Standard_Boolean myNonDestructive;
|
||||
BOPAlgo_GlueEnum myGlue;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -348,6 +348,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
|
||||
//
|
||||
aWSp.SetWES(aWES);
|
||||
aWSp.SetRunParallel(myRunParallel);
|
||||
aWSp.SetContext(myContext);
|
||||
aWSp.Perform();
|
||||
iErr=aWSp.ErrorStatus();
|
||||
if (iErr) {
|
||||
@@ -839,7 +840,7 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
|
||||
if (!BRep_Tool::Degenerated(aE)) {
|
||||
//
|
||||
aT=BOPTools_AlgoTools2D::IntermediatePoint(aE);
|
||||
BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV);
|
||||
BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV, theContext);
|
||||
aP2D.SetCoord(aU, aV);
|
||||
//
|
||||
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
|
||||
|
@@ -122,6 +122,7 @@
|
||||
{
|
||||
myHistShapes.Clear();
|
||||
myMapShape.Clear();
|
||||
myImagesResult.Clear();
|
||||
myHasDeleted=Standard_False;
|
||||
myHasGenerated=Standard_False;
|
||||
myHasModified=Standard_False;
|
||||
|
@@ -715,7 +715,7 @@ void BOPAlgo_Builder::FillImagesFaces1()
|
||||
}
|
||||
else {
|
||||
aFSD=(*(TopoDS_Face*)(&myShapesSD.Find(aFSp)));
|
||||
iSense=BOPTools_AlgoTools::Sense(aFSp, aFSD);
|
||||
iSense=BOPTools_AlgoTools::Sense(aFSp, aFSD, myContext);
|
||||
if (iSense<0) {
|
||||
aFSD.Reverse();
|
||||
}
|
||||
|
@@ -17,12 +17,12 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_Builder.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -32,9 +32,112 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BOPAlgo_Builder::Generated
|
||||
(const TopoDS_Shape&)
|
||||
(const TopoDS_Shape& theS)
|
||||
{
|
||||
// The rules for Generated shapes are these:
|
||||
// 1. The EDGE may be generated from the FACES as an intersection edge;
|
||||
// 2. The VERTEX may be generated from the EDGES and FACES as an intersection vertex.
|
||||
//
|
||||
// The list of generated elements will contain only those which are contained
|
||||
// in the result of the operation.
|
||||
|
||||
myHistShapes.Clear();
|
||||
|
||||
if (!myHasGenerated)
|
||||
return myHistShapes;
|
||||
|
||||
if (theS.IsNull())
|
||||
return myHistShapes;
|
||||
|
||||
// Only EDGES and FACES should be considered
|
||||
TopAbs_ShapeEnum aType = theS.ShapeType();
|
||||
if (aType != TopAbs_EDGE && aType != TopAbs_FACE)
|
||||
// Wrong type
|
||||
return myHistShapes;
|
||||
|
||||
// Check that DS contains the shape, i.e. it is from the arguments of the operation
|
||||
Standard_Integer nS = myDS->Index(theS);
|
||||
if (nS < 0)
|
||||
// Unknown shape
|
||||
return myHistShapes;
|
||||
|
||||
// Check that the shape has participated in any intersections
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nS);
|
||||
if (!aSI.HasReference())
|
||||
// Untouched shape
|
||||
return myHistShapes;
|
||||
|
||||
// Analyze all types of Interferences which can produce
|
||||
// new vertices - Edge/Edge and Edge/Face
|
||||
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
|
||||
BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF();
|
||||
|
||||
// Fence map to avoid duplicates in the list of Generated;
|
||||
BOPCol_MapOfInteger aMFence;
|
||||
|
||||
// Analyze each interference and find those in which the given shape has participated
|
||||
|
||||
// No need to analyze Edge/Edge interferences for the shapes of type FACE
|
||||
Standard_Boolean isFace = (aType == TopAbs_FACE);
|
||||
|
||||
for (Standard_Integer k = (isFace ? 1 : 0); k < 2; ++k)
|
||||
{
|
||||
Standard_Integer aNbLines = !k ? aEEs.Length() : aEFs.Length();
|
||||
for (Standard_Integer i = 0; i < aNbLines; ++i)
|
||||
{
|
||||
BOPDS_Interf *aInt = !k ? (BOPDS_Interf*)(&aEEs(i)) : (BOPDS_Interf*)(&aEFs(i));
|
||||
if (!aInt->HasIndexNew())
|
||||
// No new vertices created
|
||||
continue;
|
||||
|
||||
if (!aInt->Contains(nS))
|
||||
continue;
|
||||
|
||||
Standard_Integer nVNew = aInt->IndexNew();
|
||||
myDS->HasShapeSD(nVNew, nVNew);
|
||||
if (!aMFence.Add(nVNew))
|
||||
continue;
|
||||
|
||||
// Get the new vertex
|
||||
const TopoDS_Shape& aVNew = myDS->Shape(nVNew);
|
||||
|
||||
// Check that the result shape contains vertex
|
||||
if (myMapShape.Contains(aVNew))
|
||||
// Save the vertex as generated
|
||||
myHistShapes.Append(aVNew);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFace)
|
||||
return myHistShapes;
|
||||
|
||||
// For the FACE it is also necessary to collect all
|
||||
// section elements created in FACE/FACE interferences.
|
||||
// This information is available in the FaceInfo structure.
|
||||
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
|
||||
|
||||
// Section edges of the face
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
|
||||
// Save section edges contained in the result shape
|
||||
Standard_Integer aNb = aMPBSc.Extent();
|
||||
for (Standard_Integer i = 1; i <= aNb; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aENew = myDS->Shape(aMPBSc(i)->Edge());
|
||||
if (myMapShape.Contains(aENew))
|
||||
myHistShapes.Append(aENew);
|
||||
}
|
||||
|
||||
// Section vertices of the face
|
||||
const BOPCol_MapOfInteger& aMVSc = aFI.VerticesSc();
|
||||
// Save section vertices contained in the result shape
|
||||
BOPCol_MapOfInteger::Iterator aItM(aMVSc);
|
||||
for (; aItM.More(); aItM.Next())
|
||||
{
|
||||
const TopoDS_Shape& aVNew = myDS->Shape(aItM.Value());
|
||||
if (myMapShape.Contains(aVNew))
|
||||
myHistShapes.Append(aVNew);
|
||||
}
|
||||
|
||||
return myHistShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -44,99 +147,51 @@ const TopTools_ListOfShape& BOPAlgo_Builder::Generated
|
||||
const TopTools_ListOfShape& BOPAlgo_Builder::Modified
|
||||
(const TopoDS_Shape& theS)
|
||||
{
|
||||
Standard_Boolean bHasImage, bToReverse;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myHistShapes.Clear();
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
|
||||
if (!myHasModified)
|
||||
// No modified elements
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
bHasImage=myImages.IsBound(theS);
|
||||
if (!bHasImage) {
|
||||
|
||||
const BOPCol_ListOfShape* pLSp = myImagesResult.Seek(theS);
|
||||
if (!pLSp)
|
||||
// No track in the result -> no modified
|
||||
return myHistShapes;
|
||||
|
||||
// For modification check if the shape is not linked to itself
|
||||
if (pLSp->Extent() == 1)
|
||||
{
|
||||
if (theS.IsSame(pLSp->First()) && !myImages.IsBound(theS))
|
||||
// Shape is not modified
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
aType=theS.ShapeType();
|
||||
//
|
||||
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
//PrepareHistory();
|
||||
//
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aSp=aIt.Value();
|
||||
if (myShapesSD.IsBound(aSp)) {
|
||||
aSp = myShapesSD.Find(aSp);
|
||||
}
|
||||
//
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=
|
||||
BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
|
||||
// Iterate on all splits and save them with proper orientation into the result list
|
||||
BOPCol_ListIteratorOfListOfShape aIt(*pLSp);
|
||||
for (; aIt.More(); aIt.Next())
|
||||
{
|
||||
TopoDS_Shape aSp = aIt.Value();
|
||||
// Use the orientation of the input shape
|
||||
TopAbs_ShapeEnum aType = aSp.ShapeType();
|
||||
if (aType == TopAbs_VERTEX || aType == TopAbs_SOLID)
|
||||
aSp.Orientation(theS.Orientation());
|
||||
else if (BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext))
|
||||
aSp.Reverse();
|
||||
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
//
|
||||
|
||||
return myHistShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsDeleted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_Builder::IsDeleted
|
||||
(const TopoDS_Shape& theS)
|
||||
Standard_Boolean BOPAlgo_Builder::IsDeleted(const TopoDS_Shape& theS)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
bRet = Standard_True;
|
||||
//
|
||||
if (theS.IsNull()) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
aType = theS.ShapeType();
|
||||
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
if (!myImages.IsBound(theS)) {
|
||||
bRet = !myMapShape.Contains(theS);
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp = aIt.Value();
|
||||
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
|
||||
myShapesSD.Find(aSp) : aSp;
|
||||
//
|
||||
if (myMapShape.Contains(aSpR)) {
|
||||
bRet = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
// The shape is considered as Deleted if the result shape
|
||||
// does not contain the shape itself and none of its splits
|
||||
return myHasDeleted && !myImagesResult.Contains(theS);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PrepareHistory
|
||||
@@ -144,85 +199,103 @@ Standard_Boolean BOPAlgo_Builder::IsDeleted
|
||||
//=======================================================================
|
||||
void BOPAlgo_Builder::PrepareHistory()
|
||||
{
|
||||
if (!myFlagHistory) {
|
||||
if (!myFlagHistory)
|
||||
{
|
||||
// Clearing
|
||||
BOPAlgo_BuilderShape::PrepareHistory();
|
||||
return;
|
||||
}
|
||||
//
|
||||
if(myShape.IsNull()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_MapOfShape aMS;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_MapIteratorOfMapOfShape aItM;
|
||||
//
|
||||
// 1. Clearing
|
||||
|
||||
// Clearing from previous operations
|
||||
BOPAlgo_BuilderShape::PrepareHistory();
|
||||
//
|
||||
// 2. myMapShape - all shapes of result with theirs sub-shapes
|
||||
BOPTools::MapShapes(myShape, myMapShape);
|
||||
//
|
||||
// 3. MS - all argument shapes with theirs sub-shapes
|
||||
const BOPCol_ListOfShape& aArguments=myDS->Arguments();
|
||||
aIt.Initialize(aArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
BOPTools::MapShapes(aSx, aMS);
|
||||
myFlagHistory = Standard_True;
|
||||
|
||||
if (myShape.IsNull() ||
|
||||
BOPTools_AlgoTools3D::IsEmptyShape(myShape))
|
||||
{
|
||||
// The result shape is a null shape or empty shape,
|
||||
// thus, no modified, no generated, all deleted
|
||||
myHasModified = Standard_False;
|
||||
myHasGenerated = Standard_False;
|
||||
myHasDeleted = Standard_True;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 4. Treatment
|
||||
aItM.Initialize(aMS);
|
||||
for (; aItM.More(); aItM.Next()) {
|
||||
const TopoDS_Shape& aSx=aItM.Key();
|
||||
aType = aSx.ShapeType();
|
||||
if (!(aType == TopAbs_VERTEX || aType == TopAbs_EDGE ||
|
||||
aType == TopAbs_FACE || aType == TopAbs_SOLID)) {
|
||||
|
||||
// Map the result shape
|
||||
BOPTools::MapShapes(myShape, myMapShape);
|
||||
|
||||
// Among all input shapes find those that have any trace in the result
|
||||
// and save them into myImagesResult map with connection to parts
|
||||
// kept in the result shape.
|
||||
// Also, set the proper values to the history flags:
|
||||
// - myHasDeleted for Deleted shapes;
|
||||
// - myHasModified for Modified shapes;
|
||||
// - myHasGenerated for Generated shapes.
|
||||
Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aS = myDS->Shape(i);
|
||||
|
||||
// History information is only available for the shapes of type
|
||||
// VERTEX, EDGE, FACE and SOLID. Skip all shapes of different type.
|
||||
TopAbs_ShapeEnum aType = aS.ShapeType();
|
||||
if (!(aType == TopAbs_VERTEX ||
|
||||
aType == TopAbs_EDGE ||
|
||||
aType == TopAbs_FACE ||
|
||||
aType == TopAbs_SOLID))
|
||||
continue;
|
||||
|
||||
// Check if the shape has any splits
|
||||
const BOPCol_ListOfShape* pLSp = myImages.Seek(aS);
|
||||
if (!pLSp)
|
||||
{
|
||||
// No splits, check if the result shape contains the shape itself
|
||||
if (myMapShape.Contains(aS))
|
||||
// Shape has passed into result without modifications -> link the shape to itself
|
||||
myImagesResult(myImagesResult.Add(aS, BOPCol_ListOfShape())).Append(aS);
|
||||
else
|
||||
// No trace of the shape in the result -> Deleted element is found
|
||||
myHasDeleted = Standard_True;
|
||||
}
|
||||
//
|
||||
// 4.1 .myImagesResult
|
||||
bHasImage=myImages.IsBound(aSx);
|
||||
//
|
||||
BOPCol_ListOfShape aLSx;
|
||||
if (!bHasImage) {
|
||||
if (myMapShape.Contains(aSx)) {
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
else
|
||||
{
|
||||
// Find all splits of the shape which are kept in the result
|
||||
BOPCol_ListOfShape *pLSpKept = NULL;
|
||||
BOPCol_ListIteratorOfListOfShape aIt(*pLSp);
|
||||
for (; aIt.More(); aIt.Next())
|
||||
{
|
||||
TopoDS_Shape aSp = aIt.Value();
|
||||
|
||||
// Check SD shapes
|
||||
const TopoDS_Shape* pSpSD = myShapesSD.Seek(aSp);
|
||||
if (pSpSD)
|
||||
aSp = *pSpSD;
|
||||
|
||||
// Check if the result shape contains the split
|
||||
if (myMapShape.Contains(aSp))
|
||||
{
|
||||
if (!pLSpKept)
|
||||
pLSpKept = &myImagesResult(myImagesResult.Add(aS, BOPCol_ListOfShape()));
|
||||
|
||||
// Link the shape to the split
|
||||
pLSpKept->Append(aSp);
|
||||
}
|
||||
}
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
// <- A
|
||||
//
|
||||
// 4.2 As it was
|
||||
if (!myHasDeleted) {
|
||||
myHasDeleted=IsDeleted(aSx);
|
||||
}
|
||||
//
|
||||
if (!myHasModified && bHasImage) {
|
||||
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
|
||||
if (pLSpKept)
|
||||
// Modified element is found
|
||||
myHasModified = Standard_True;
|
||||
}
|
||||
else
|
||||
// Deleted element is found
|
||||
myHasDeleted = Standard_True;
|
||||
}
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
if (aType==TopAbs_FACE) {
|
||||
const TopTools_ListOfShape& aLG = Generated(aSx);
|
||||
myHasGenerated = aLG.Extent() > 0;
|
||||
}
|
||||
|
||||
// Try to find generated shapes
|
||||
if (!myHasGenerated)
|
||||
{
|
||||
// Temporarily set the HasGenerated flag to look for the shapes generated from aS
|
||||
myHasGenerated = Standard_True;
|
||||
myHasGenerated = (Generated(aS).Extent() > 0);
|
||||
}
|
||||
}
|
||||
myFlagHistory=Standard_True;
|
||||
}
|
||||
|
@@ -21,8 +21,11 @@
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
|
||||
#include <BOPAlgo_BuilderSolid.hxx>
|
||||
|
||||
@@ -48,7 +51,7 @@ BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder()
|
||||
myIndex(100, myAllocator),
|
||||
myMaterials(100, myAllocator),
|
||||
myShapeMaterial(100, myAllocator),
|
||||
myMapGenerated(100, myAllocator)
|
||||
myMapModified(100, myAllocator)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder
|
||||
myIndex(100, myAllocator),
|
||||
myMaterials(100, myAllocator),
|
||||
myShapeMaterial(100, myAllocator),
|
||||
myMapGenerated(100, myAllocator)
|
||||
myMapModified(100, myAllocator)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -88,7 +91,7 @@ void BOPAlgo_CellsBuilder::Clear()
|
||||
myIndex.Clear();
|
||||
myMaterials.Clear();
|
||||
myShapeMaterial.Clear();
|
||||
myMapGenerated.Clear();
|
||||
myMapModified.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -313,7 +316,7 @@ void BOPAlgo_CellsBuilder::AddAllToResult(const Standard_Integer theMaterial,
|
||||
aBB.MakeCompound(aResult);
|
||||
myShapeMaterial.Clear();
|
||||
myMaterials.Clear();
|
||||
myMapGenerated.Clear();
|
||||
myMapModified.Clear();
|
||||
//
|
||||
TopoDS_Iterator aIt(myAllParts);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
@@ -453,7 +456,7 @@ void BOPAlgo_CellsBuilder::RemoveAllFromResult()
|
||||
//
|
||||
myMaterials.Clear();
|
||||
myShapeMaterial.Clear();
|
||||
myMapGenerated.Clear();
|
||||
myMapModified.Clear();
|
||||
//
|
||||
PrepareHistory();
|
||||
}
|
||||
@@ -669,195 +672,234 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
||||
const TopoDS_Shape& aSS = aMG(i);
|
||||
const TopoDS_Shape& aSGen = anUnify.Generated(aSS);
|
||||
if (!aSGen.IsNull() && !aSS.IsSame(aSGen)) {
|
||||
myMapGenerated.Bind(aSS, aSGen);
|
||||
myMapModified.Bind(aSS, aSGen);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aType == TopAbs_SOLID) {
|
||||
// build all solids from the faces
|
||||
BOPCol_ListOfShape aLSF;
|
||||
BRep_Builder aBB;
|
||||
TopoDS_Compound aSolids;
|
||||
aBB.MakeCompound(aSolids);
|
||||
//
|
||||
for (BOPCol_ListIteratorOfListOfShape aIt(theLS); aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
BOPCol_ListIteratorOfListOfShape aItLS(theLS);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSol = aItLS.Value();
|
||||
aBB.Add(aSolids, aSol);
|
||||
}
|
||||
//
|
||||
// Make connexity blocks of solids to create from each isolated block one solid.
|
||||
// It will allow attaching internal entities of the solids to new solid.
|
||||
BOPCol_ListOfShape aLCB;
|
||||
BOPTools_AlgoTools::MakeConnexityBlocks(aSolids, TopAbs_FACE, TopAbs_SOLID, aLCB);
|
||||
//
|
||||
// for each block remove internal faces
|
||||
BOPCol_ListIteratorOfListOfShape aItLCB(aLCB);
|
||||
for (; aItLCB.More(); aItLCB.Next()) {
|
||||
const TopoDS_Shape& aCB = aItLCB.Value();
|
||||
//
|
||||
aExp.Init(aS, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF = aExp.Current();
|
||||
aLSF.Append(aF);
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPAlgo_BuilderSolid aBS;
|
||||
aBS.SetShapes(aLSF);
|
||||
aBS.Perform();
|
||||
//
|
||||
iErr = aBS.ErrorStatus();
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
theLSNew = aBS.Areas();
|
||||
if (theLSNew.Extent() == 1) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
// result is a list of solids. we need to select external faces.
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aDMFS;
|
||||
BOPCol_ListOfShape aLFNew;
|
||||
Standard_Integer i, aNb;
|
||||
//
|
||||
// map faces and solids
|
||||
for (BOPCol_ListIteratorOfListOfShape aIt(theLSNew); aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
// Map faces and solids to find boundary faces that can be removed
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aDMFS;
|
||||
// internal entities
|
||||
BOPCol_ListOfShape aLSInt;
|
||||
//
|
||||
aExp.Init(aS, TopAbs_FACE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
const TopoDS_Shape& aF = aExp.Current();
|
||||
if (aDMFS.Contains(aF)) {
|
||||
BOPCol_ListOfShape& aLFS = aDMFS.ChangeFromKey(aF);
|
||||
aLFS.Append(aS);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape aLFS;
|
||||
aLFS.Append(aS);
|
||||
aDMFS.Add(aF, aLFS);
|
||||
TopoDS_Iterator aItS(aCB);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSol = aItS.Value();
|
||||
//
|
||||
TopoDS_Iterator aItIS(aSol);
|
||||
for (; aItIS.More(); aItIS.Next()) {
|
||||
const TopoDS_Shape& aSI = aItIS.Value();
|
||||
if (aSI.Orientation() == TopAbs_INTERNAL) {
|
||||
aLSInt.Append(aSI);
|
||||
}
|
||||
else {
|
||||
TopoDS_Iterator aItF(aSI);
|
||||
for (; aItF.More(); aItF.Next()) {
|
||||
const TopoDS_Shape& aF = aItF.Value();
|
||||
BOPCol_ListOfShape *pLSols = aDMFS.ChangeSeek(aF);
|
||||
if (!pLSols) {
|
||||
pLSols = &aDMFS(aDMFS.Add(aF, BOPCol_ListOfShape()));
|
||||
}
|
||||
pLSols->Append(aSol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// select faces attached to only one solid
|
||||
aNb = aDMFS.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const BOPCol_ListOfShape& aLS = aDMFS(i);
|
||||
if (aLS.Extent() == 1) {
|
||||
const TopoDS_Shape& aF = aDMFS.FindKey(i);
|
||||
aLFNew.Append(aF);
|
||||
//
|
||||
// to build unified solid, select only faces attached to only one solid
|
||||
BOPCol_ListOfShape aLFUnique;
|
||||
Standard_Integer i, aNb = aDMFS.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
if (aDMFS(i).Extent() == 1) {
|
||||
aLFUnique.Append(aDMFS.FindKey(i));
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aNb == aLFUnique.Extent()) {
|
||||
// no faces to remove
|
||||
aItS.Initialize(aCB);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
theLSNew.Append(aItS.Value());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// build new solid
|
||||
BOPAlgo_BuilderSolid aBS;
|
||||
aBS.SetShapes(aLFUnique);
|
||||
aBS.Perform();
|
||||
//
|
||||
iErr = aBS.ErrorStatus();
|
||||
if (!iErr && aBS.Areas().Extent() != 1)
|
||||
iErr = 1;
|
||||
if (iErr)
|
||||
return iErr;
|
||||
|
||||
TopoDS_Solid& aSNew = *(TopoDS_Solid*)&aBS.Areas().First();
|
||||
//
|
||||
// put all internal parts into new solid
|
||||
aSNew.Free(Standard_True);
|
||||
BOPCol_ListIteratorOfListOfShape aItLSI(aLSInt);
|
||||
for (; aItLSI.More(); aItLSI.Next()) {
|
||||
aBB.Add(aSNew, aItLSI.Value());
|
||||
}
|
||||
aSNew.Free(Standard_False);
|
||||
//
|
||||
theLSNew.Append(aSNew);
|
||||
|
||||
// Save information about the fuse of the solids into a history map
|
||||
aItS.Initialize(aCB);
|
||||
for (; aItS.More(); aItS.Next())
|
||||
myMapModified.Bind(aItS.Value(), aSNew);
|
||||
}
|
||||
//
|
||||
if (aNb == aLFNew.Extent()) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
// build new solid
|
||||
BOPAlgo_BuilderSolid aBS1;
|
||||
aBS1.SetShapes(aLFNew);
|
||||
aBS1.Perform();
|
||||
//
|
||||
iErr = aBS1.ErrorStatus();
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
theLSNew = aBS1.Areas();
|
||||
}
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDeleted
|
||||
//function : PrepareHistory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_CellsBuilder::IsDeleted(const TopoDS_Shape& theS)
|
||||
void BOPAlgo_CellsBuilder::PrepareHistory()
|
||||
{
|
||||
Standard_Boolean bRet = Standard_True;
|
||||
if (theS.IsNull()) {
|
||||
return bRet;
|
||||
if (!myFlagHistory)
|
||||
{
|
||||
// Clearing
|
||||
BOPAlgo_BuilderShape::PrepareHistory();
|
||||
return;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = theS.ShapeType();
|
||||
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
|
||||
return bRet;
|
||||
|
||||
// Clearing from previous operations
|
||||
BOPAlgo_BuilderShape::PrepareHistory();
|
||||
myFlagHistory = Standard_True;
|
||||
|
||||
if (myShape.IsNull() ||
|
||||
BOPTools_AlgoTools3D::IsEmptyShape(myShape))
|
||||
{
|
||||
// The result shape is a null shape or empty shape,
|
||||
// thus, no modified, no generated, all deleted
|
||||
myHasModified = Standard_False;
|
||||
myHasGenerated = Standard_False;
|
||||
myHasDeleted = Standard_True;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage, bHasGenerated;
|
||||
//
|
||||
bHasImage = myImages.IsBound(theS);
|
||||
bHasGenerated = myMapGenerated.IsBound(theS);
|
||||
if (!bHasImage && !bHasGenerated) {
|
||||
bRet = !myMapShape.Contains(theS);
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
if (bHasGenerated) {
|
||||
const TopoDS_Shape& aSG = myMapGenerated.Find(theS);
|
||||
if (myMapShape.Contains(aSG)) {
|
||||
bRet = Standard_False;
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (bHasImage) {
|
||||
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
|
||||
BOPCol_ListIteratorOfListOfShape aIt(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSp = aIt.Value();
|
||||
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
|
||||
myShapesSD.Find(aSp) : aSp;
|
||||
//
|
||||
const TopoDS_Shape& aSpRG = myMapGenerated.IsBound(aSpR) ?
|
||||
myMapGenerated.Find(aSpR) : aSpR;
|
||||
if (myMapShape.Contains(aSpRG)) {
|
||||
bRet = Standard_False;
|
||||
break;
|
||||
|
||||
// Map the result shape
|
||||
BOPTools::MapShapes(myShape, myMapShape);
|
||||
|
||||
// Among all input shapes find those that have any trace in the result
|
||||
// and save them into myImagesResult map with connection to parts
|
||||
// kept in the result shape.
|
||||
// Also, set the proper values to the history flags:
|
||||
// - myHasDeleted for Deleted shapes;
|
||||
// - myHasModified for Modified shapes;
|
||||
// - myHasGenerated for Generated shapes.
|
||||
Standard_Integer aNbS = myDS->NbSourceShapes();
|
||||
for (Standard_Integer i = 0; i < aNbS; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aS = myDS->Shape(i);
|
||||
|
||||
// History information is only available for the shapes of type
|
||||
// VERTEX, EDGE, FACE and SOLID. Skip all shapes of different type.
|
||||
TopAbs_ShapeEnum aType = aS.ShapeType();
|
||||
if (!(aType == TopAbs_VERTEX ||
|
||||
aType == TopAbs_EDGE ||
|
||||
aType == TopAbs_FACE ||
|
||||
aType == TopAbs_SOLID))
|
||||
continue;
|
||||
|
||||
// Check if the shape has any splits
|
||||
const BOPCol_ListOfShape* pLSp = myImages.Seek(aS);
|
||||
if (!pLSp)
|
||||
{
|
||||
// No splits from GF builder.
|
||||
// Check if the shape has been locally modified,
|
||||
// i.e. has participated in the Removal of internal boundaries
|
||||
// and have been unified with other shapes
|
||||
const TopoDS_Shape* pSU = myMapModified.Seek(aS);
|
||||
// Check if the result contains the shape or its unified image
|
||||
const TopoDS_Shape* pSR = !pSU ? &aS : pSU;
|
||||
if (myMapShape.Contains(*pSR))
|
||||
{
|
||||
// Link the shape to itself or to its unified image
|
||||
myImagesResult(myImagesResult.Add(aS, BOPCol_ListOfShape())).Append(*pSR);
|
||||
if (pSU)
|
||||
// Modified element is found
|
||||
myHasModified = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No trace of the shape in the result -> Deleted element is found
|
||||
myHasDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find all splits of the shape which are kept in the result
|
||||
BOPCol_ListOfShape *pLSpKept = NULL;
|
||||
BOPCol_ListIteratorOfListOfShape aIt(*pLSp);
|
||||
for (; aIt.More(); aIt.Next())
|
||||
{
|
||||
TopoDS_Shape aSp = aIt.Value();
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BOPAlgo_CellsBuilder::Generated(const TopoDS_Shape& theS)
|
||||
{
|
||||
myHistShapes.Clear();
|
||||
if (theS.IsNull()) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = theS.ShapeType();
|
||||
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE || aType==TopAbs_VERTEX)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasGenerated = myMapGenerated.IsBound(theS);
|
||||
if (bHasGenerated) {
|
||||
const TopoDS_Shape& aSG = myMapGenerated.Find(theS);
|
||||
if (myMapShape.Contains(aSG)) {
|
||||
myHistShapes.Append(aSG);
|
||||
}
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage = myImages.IsBound(theS);
|
||||
if (!bHasImage) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
BOPCol_MapOfShape aMFence;
|
||||
const BOPCol_ListOfShape& aLSp = myImages.Find(theS);
|
||||
BOPCol_ListIteratorOfListOfShape aIt(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape aSp = aIt.Value();
|
||||
const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ?
|
||||
myShapesSD.Find(aSp) : aSp;
|
||||
//
|
||||
if (myMapGenerated.IsBound(aSpR)) {
|
||||
const TopoDS_Shape& aSG = myMapGenerated.Find(aSpR);
|
||||
if (myMapShape.Contains(aSG)) {
|
||||
if (aMFence.Add(aSG)) {
|
||||
myHistShapes.Append(aSG);
|
||||
// Check SD shapes
|
||||
const TopoDS_Shape* pSpSD = myShapesSD.Seek(aSp);
|
||||
if (pSpSD)
|
||||
aSp = *pSpSD;
|
||||
|
||||
// Check local modification of the shape (unification with other shapes)
|
||||
const TopoDS_Shape* pSU = myMapModified.Seek(aSp);
|
||||
if (pSU)
|
||||
aSp = *pSU;
|
||||
|
||||
// Check if the result shape contains the split
|
||||
if (myMapShape.Contains(aSp))
|
||||
{
|
||||
if (!pLSpKept)
|
||||
pLSpKept = &myImagesResult(myImagesResult.Add(aS, BOPCol_ListOfShape()));
|
||||
|
||||
// Link the shape to the split
|
||||
pLSpKept->Append(aSp);
|
||||
}
|
||||
}
|
||||
|
||||
if (pLSpKept)
|
||||
// Modified element is found
|
||||
myHasModified = Standard_True;
|
||||
else
|
||||
// Deleted element is found
|
||||
myHasDeleted = Standard_True;
|
||||
}
|
||||
|
||||
// Try to find generated shapes
|
||||
if (!myHasGenerated)
|
||||
{
|
||||
// Temporarily set the HasGenerated flag to look for the shapes generated from aS
|
||||
myHasGenerated = Standard_True;
|
||||
myHasGenerated = (Generated(aS).Extent() > 0);
|
||||
}
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -84,8 +84,6 @@
|
||||
//! VERTEX, EDGE, FACE. This information available through the methods
|
||||
//! IsDeleted() and Modified(). In DRAW Test Harness it is available through the same
|
||||
//! commands as for Boolean Operations (bmodified, bgenerated and bisdeleted).
|
||||
//! There could be Generated shapes only after removing of the internal boundaries
|
||||
//! between faces and edges, i.e. after using ShapeUpgrade_UnifySameDomain tool.
|
||||
//!
|
||||
//! Examples:
|
||||
//! 1. API
|
||||
@@ -213,15 +211,13 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
|
||||
//! Makes the Containers of proper type from the parts added to result.
|
||||
Standard_EXPORT void MakeContainers();
|
||||
|
||||
//! Returns the list of shapes generated from the shape theS.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the shape theS has been deleted.
|
||||
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Redefined method Prepare - no need to prepare history
|
||||
//! Prepare information for history support taking into account
|
||||
//! local modification map of unified elements.
|
||||
Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE;
|
||||
|
||||
//! Redefined method Prepare - no need to prepare history
|
||||
//! information on the default result as it is empty compound.
|
||||
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
|
||||
|
||||
@@ -254,7 +250,7 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape myIndex;
|
||||
BOPCol_DataMapOfIntegerListOfShape myMaterials;
|
||||
BOPCol_DataMapOfShapeInteger myShapeMaterial;
|
||||
BOPCol_DataMapOfShapeShape myMapGenerated;
|
||||
BOPCol_DataMapOfShapeShape myMapModified;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -19,11 +19,12 @@
|
||||
|
||||
#include <BOPAlgo_CheckerSI.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
#include <BOPDS_IteratorSI.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_PassKey.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_PIteratorSI.hxx>
|
||||
#include <BOPDS_VectorOfInterfEF.hxx>
|
||||
#include <BOPDS_VectorOfInterfFF.hxx>
|
||||
@@ -34,9 +35,83 @@
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_FaceFace.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_FaceSelfIntersect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_FaceSelfIntersect :
|
||||
public IntTools_FaceFace,
|
||||
public BOPAlgo_Algo {
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_FaceSelfIntersect() :
|
||||
IntTools_FaceFace(),
|
||||
BOPAlgo_Algo(),
|
||||
myIF(-1), myTolF(1.e-7) {
|
||||
}
|
||||
//
|
||||
virtual ~BOPAlgo_FaceSelfIntersect() {
|
||||
}
|
||||
//
|
||||
void SetIndex(const Standard_Integer nF) {
|
||||
myIF = nF;
|
||||
}
|
||||
//
|
||||
Standard_Integer IndexOfFace() const {
|
||||
return myIF;
|
||||
}
|
||||
//
|
||||
void SetFace(const TopoDS_Face& aF) {
|
||||
myF = aF;
|
||||
}
|
||||
//
|
||||
const TopoDS_Face& Face()const {
|
||||
return myF;
|
||||
}
|
||||
//
|
||||
void SetTolF(const Standard_Real aTolF) {
|
||||
myTolF = aTolF;
|
||||
}
|
||||
//
|
||||
Standard_Real TolF() const{
|
||||
return myTolF;
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_FaceFace::Perform(myF, myF);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIF;
|
||||
Standard_Real myTolF;
|
||||
TopoDS_Face myF;
|
||||
};
|
||||
//end of definition of class BOPAlgo_FaceSelfIntersect
|
||||
|
||||
//=======================================================================
|
||||
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_FaceSelfIntersect,
|
||||
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_FaceSelfIntersectFunctor,
|
||||
BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectCnt;
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -104,49 +179,38 @@ void BOPAlgo_CheckerSI::Init()
|
||||
void BOPAlgo_CheckerSI::Perform()
|
||||
{
|
||||
try {
|
||||
Standard_Integer iErr;
|
||||
//
|
||||
OCC_CATCH_SIGNALS
|
||||
//
|
||||
myErrorStatus=0;
|
||||
if (myArguments.Extent()!=1) {
|
||||
myErrorStatus=10;
|
||||
myErrorStatus = 0;
|
||||
if (myArguments.Extent() != 1) {
|
||||
myErrorStatus = 10;
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (myNonDestructive) {
|
||||
PrepareCopy();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Perform intersection of sub shapes
|
||||
BOPAlgo_PaveFiller::Perform();
|
||||
iErr=myErrorStatus;
|
||||
//
|
||||
CheckFaceSelfIntersection();
|
||||
|
||||
// Perform intersection with solids
|
||||
if (!myErrorStatus)
|
||||
PerformVZ();
|
||||
//
|
||||
if (!myErrorStatus)
|
||||
PerformEZ();
|
||||
//
|
||||
if (!myErrorStatus)
|
||||
PerformFZ();
|
||||
//
|
||||
if (!myErrorStatus)
|
||||
PerformZZ();
|
||||
//
|
||||
// Treat the intersection results
|
||||
PostTreat();
|
||||
if (myErrorStatus) {
|
||||
iErr=myErrorStatus;
|
||||
}
|
||||
//
|
||||
if (myNonDestructive) {
|
||||
PostTreatCopy();
|
||||
if (myErrorStatus) {
|
||||
iErr=myErrorStatus;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (iErr) {
|
||||
myErrorStatus=iErr;
|
||||
}
|
||||
}
|
||||
//
|
||||
catch (Standard_Failure) {
|
||||
if (myNonDestructive) {
|
||||
PostTreatCopy();
|
||||
}
|
||||
//
|
||||
myErrorStatus=11;
|
||||
myErrorStatus = 11;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -156,14 +220,13 @@ void BOPAlgo_CheckerSI::Perform()
|
||||
void BOPAlgo_CheckerSI::PostTreat()
|
||||
{
|
||||
Standard_Integer i, aNb, n1, n2;
|
||||
BOPDS_PassKey aPK;
|
||||
BOPDS_Pair aPK;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
BOPDS_MapOfPassKey& aMPK=
|
||||
*((BOPDS_MapOfPassKey*)&myDS->Interferences());
|
||||
aMPK.Clear();
|
||||
//
|
||||
BOPDS_MapOfPair& aMPK=
|
||||
*((BOPDS_MapOfPair*)&myDS->Interferences());
|
||||
|
||||
// 0
|
||||
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
|
||||
aNb=aVVs.Extent();
|
||||
@@ -173,7 +236,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -186,7 +249,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -199,7 +262,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -212,7 +275,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -228,7 +291,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -250,23 +313,27 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
iFound=0;
|
||||
if (bTangentFaces) {
|
||||
const TopoDS_Face& aF1=*((TopoDS_Face*)&myDS->Shape(n1));
|
||||
const TopoDS_Face& aF2=*((TopoDS_Face*)&myDS->Shape(n2));
|
||||
bFlag=BOPTools_AlgoTools::AreFacesSameDomain
|
||||
(aF1, aF2, myContext, myFuzzyValue);
|
||||
if (bFlag) {
|
||||
++iFound;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (j=0; j!=aNbC; ++j) {
|
||||
const BOPDS_Curve& aNC=aVC(j);
|
||||
const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
|
||||
if (aLPBC.Extent()) {
|
||||
iFound = (n1 == n2) ? 1 : 0;
|
||||
//case of self-intersection inside one face
|
||||
if (!iFound)
|
||||
{
|
||||
if (bTangentFaces) {
|
||||
const TopoDS_Face& aF1=*((TopoDS_Face*)&myDS->Shape(n1));
|
||||
const TopoDS_Face& aF2=*((TopoDS_Face*)&myDS->Shape(n2));
|
||||
bFlag=BOPTools_AlgoTools::AreFacesSameDomain
|
||||
(aF1, aF2, myContext, myFuzzyValue);
|
||||
if (bFlag) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (j=0; j!=aNbC; ++j) {
|
||||
const BOPDS_Curve& aNC=aVC(j);
|
||||
const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
|
||||
if (aLPBC.Extent()) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,7 +342,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -290,7 +357,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -301,7 +368,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
//
|
||||
const BOPDS_InterfEZ& aEZ=aEZs(i);
|
||||
aEZ.Indices(n1, n2);
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -312,7 +379,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
//
|
||||
const BOPDS_InterfFZ& aFZ=aFZs(i);
|
||||
aFZ.Indices(n1, n2);
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
//
|
||||
@@ -323,76 +390,91 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
//
|
||||
const BOPDS_InterfZZ& aZZ=aZZs(i);
|
||||
aZZ.Indices(n1, n2);
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PrepareCopy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PrepareCopy()
|
||||
{
|
||||
Standard_Boolean bIsDone;
|
||||
BRepBuilderAPI_Copy aCopier;
|
||||
BOPCol_MapOfShape aMSA;
|
||||
BOPCol_MapIteratorOfMapOfShape aItMS;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myNewOldMap.Clear();
|
||||
//
|
||||
const TopoDS_Shape& aSA=myArguments.First();
|
||||
//
|
||||
BOPTools::MapShapes(aSA, aMSA);
|
||||
//
|
||||
aCopier.Perform(aSA, Standard_False);
|
||||
bIsDone=aCopier.IsDone();
|
||||
if (!bIsDone) {
|
||||
myErrorStatus=12;
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSC=aCopier.Shape();
|
||||
//
|
||||
aItMS.Initialize(aMSA);
|
||||
for(; aItMS.More(); aItMS.Next()) {
|
||||
const TopoDS_Shape& aSAx=aItMS.Value();
|
||||
const TopoDS_Shape& aSCx=aCopier.Modified(aSAx).First();
|
||||
myNewOldMap.Bind(aSCx, aSAx);
|
||||
}
|
||||
//
|
||||
myArguments.Clear();
|
||||
myArguments.Append(aSC);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PostTreatCopy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PostTreatCopy()
|
||||
{
|
||||
Standard_Integer i, aNb;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
aNb=myDS->NbSourceShapes();
|
||||
for (i=0; i!=aNb; ++i) {
|
||||
BOPDS_ShapeInfo& aSI=myDS->ChangeShapeInfo(i);
|
||||
const TopoDS_Shape& aSCi=aSI.Shape();
|
||||
if (!myNewOldMap.IsBound(aSCi)) {
|
||||
myErrorStatus=13;
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSAi=myNewOldMap.Find(aSCi);
|
||||
aSI.SetShape(aSAi);
|
||||
}
|
||||
}
|
||||
//
|
||||
// myErrorStatus:
|
||||
//
|
||||
// 10 - The number of the arguments is not 1
|
||||
// 11 - Exception is caught
|
||||
// 12 - BRepBuilderAPI_Copy is not done
|
||||
// 13 - myNewOldMap doe not contain DS shape
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckFaceSelfIntersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
|
||||
{
|
||||
if (myLevelOfCheck < 5)
|
||||
return;
|
||||
|
||||
BOPDS_Pair aPK;
|
||||
|
||||
BOPDS_MapOfPair& aMPK=
|
||||
*((BOPDS_MapOfPair*)&myDS->Interferences());
|
||||
aMPK.Clear();
|
||||
|
||||
BOPAlgo_VectorOfFaceSelfIntersect aVFace;
|
||||
|
||||
Standard_Integer aNbS=myDS->NbSourceShapes();
|
||||
|
||||
//
|
||||
for (Standard_Integer i = 0; i < aNbS; i++)
|
||||
{
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (aSI.ShapeType() != TopAbs_FACE)
|
||||
continue;
|
||||
//
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aSI.Shape()));
|
||||
BRepAdaptor_Surface BAsurf(aF, Standard_False);
|
||||
GeomAbs_SurfaceType aSurfType = BAsurf.GetType();
|
||||
if (aSurfType == GeomAbs_Plane ||
|
||||
aSurfType == GeomAbs_Cylinder ||
|
||||
aSurfType == GeomAbs_Cone ||
|
||||
aSurfType == GeomAbs_Sphere)
|
||||
continue;
|
||||
|
||||
if (aSurfType == GeomAbs_Torus)
|
||||
{
|
||||
gp_Torus aTorus = BAsurf.Torus();
|
||||
Standard_Real aMajorRadius = aTorus.MajorRadius();
|
||||
Standard_Real aMinorRadius = aTorus.MinorRadius();
|
||||
if (aMajorRadius > aMinorRadius + Precision::Confusion())
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Real aTolF = BRep_Tool::Tolerance(aF);
|
||||
|
||||
BOPAlgo_FaceSelfIntersect& aFaceSelfIntersect = aVFace.Append1();
|
||||
//
|
||||
aFaceSelfIntersect.SetIndex(i);
|
||||
aFaceSelfIntersect.SetFace(aF);
|
||||
aFaceSelfIntersect.SetTolF(aTolF);
|
||||
//
|
||||
aFaceSelfIntersect.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
|
||||
Standard_Integer aNbFace = aVFace.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_FaceSelfIntersectCnt::Perform(myRunParallel, aVFace);
|
||||
//======================================================
|
||||
//
|
||||
for (Standard_Integer k = 0; k < aNbFace; k++)
|
||||
{
|
||||
BOPAlgo_FaceSelfIntersect& aFaceSelfIntersect = aVFace(k);
|
||||
//
|
||||
Standard_Integer nF = aFaceSelfIntersect.IndexOfFace();
|
||||
|
||||
Standard_Boolean bIsDone = aFaceSelfIntersect.IsDone();
|
||||
if (bIsDone)
|
||||
{
|
||||
const IntTools_SequenceOfCurves& aCvsX = aFaceSelfIntersect.Lines();
|
||||
const IntTools_SequenceOfPntOn2Faces& aPntsX = aFaceSelfIntersect.Points();
|
||||
//
|
||||
Standard_Integer aNbCurves = aCvsX.Length();
|
||||
Standard_Integer aNbPoints = aPntsX.Length();
|
||||
//
|
||||
if (aNbCurves || aNbPoints)
|
||||
{
|
||||
aPK.SetIndices(nF, nF);
|
||||
aMPK.Add(aPK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,63 +24,73 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BOPCol_DataMapOfShapeShape.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
|
||||
|
||||
//! Checks shape on self-interference.
|
||||
//! Checks the shape on self-interference.<br>
|
||||
//! In case of error the algorithm may return the following ErrorStatus:<br>
|
||||
//! 10 - The number of the input arguments is not one;<br>
|
||||
//! 11 - The check has been aborted during intersection of sub-shapes.<br>
|
||||
//! In case the error has occurred during intersection of sub-shapes, i.e.
|
||||
//! in BOPAlgo_PaveFiller::PerformInternal() method, the ErrorStatus from this method
|
||||
//! directly will be returned.
|
||||
|
||||
class BOPAlgo_CheckerSI : public BOPAlgo_PaveFiller
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT BOPAlgo_CheckerSI();
|
||||
Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
|
||||
Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
|
||||
|
||||
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
|
||||
|
||||
//! Sets the level of checking shape on self-interference.
|
||||
//! It defines which interferferences will be checked:
|
||||
//! 0 - only V/V;
|
||||
//! 1 - V/V and V/E;
|
||||
//! 2 - V/V, V/E and E/E;
|
||||
//! 3 - V/V, V/E, E/E and V/F;
|
||||
//! 4 - V/V, V/E, E/E, V/F and E/F;
|
||||
//! 5 - all interferences, default value.
|
||||
//! Sets the level of checking shape on self-interference.<br>
|
||||
//! It defines which interferences will be checked:<br>
|
||||
//! 0 - only V/V;<br>
|
||||
//! 1 - V/V and V/E;<br>
|
||||
//! 2 - V/V, V/E and E/E;<br>
|
||||
//! 3 - V/V, V/E, E/E and V/F;<br>
|
||||
//! 4 - V/V, V/E, E/E, V/F and E/F;<br>
|
||||
//! 5 - V/V, V/E, E/E, V/F, E/F and F/F;<br>
|
||||
//! 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;<br>
|
||||
//! 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;<br>
|
||||
//! 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;<br>
|
||||
//! 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
|
||||
Standard_EXPORT void SetLevelOfCheck (const Standard_Integer theLevel);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Provides post-treatment actions
|
||||
Standard_EXPORT void PostTreat();
|
||||
|
||||
Standard_EXPORT virtual void PrepareCopy();
|
||||
|
||||
//! Provides post-treatment actions for the copy
|
||||
Standard_EXPORT void PostTreatCopy();
|
||||
|
||||
//! Treats the intersection results
|
||||
Standard_EXPORT void PostTreat();
|
||||
|
||||
Standard_EXPORT void CheckFaceSelfIntersection();
|
||||
|
||||
//! Methods for intersection with solids
|
||||
|
||||
//! Vertex/Solid intersection
|
||||
Standard_EXPORT virtual void PerformVZ();
|
||||
|
||||
//! Edge/Solid intersection
|
||||
Standard_EXPORT virtual void PerformEZ();
|
||||
|
||||
//! Face/Solid intersection
|
||||
Standard_EXPORT virtual void PerformFZ();
|
||||
|
||||
//! Solid/Solid intersection
|
||||
Standard_EXPORT virtual void PerformZZ();
|
||||
|
||||
//! Used for intersection of edges and faces with solids
|
||||
Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
|
||||
|
||||
Standard_Integer myLevelOfCheck;
|
||||
BOPCol_DataMapOfShapeShape myNewOldMap;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_CheckerSI_HeaderFile
|
||||
|
430
src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx
Normal file
430
src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx
Normal file
@@ -0,0 +1,430 @@
|
||||
// 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 License 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_CheckerSI.hxx>
|
||||
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
#include <BOPDS_IteratorSI.hxx>
|
||||
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
|
||||
#include <IntTools_Context.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_VertexSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_VertexSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_VertexSolid()
|
||||
: myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_VertexSolid(){
|
||||
};
|
||||
//
|
||||
void SetIndices(const Standard_Integer nV,
|
||||
const Standard_Integer nZ){
|
||||
myIV=nV;
|
||||
myIZ=nZ;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nV,
|
||||
Standard_Integer& nZ) const {
|
||||
nV=myIV;
|
||||
nZ=myIZ;
|
||||
}
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
myV=aV;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& Vertex()const {
|
||||
return myV;
|
||||
}
|
||||
//
|
||||
void SetSolid(const TopoDS_Solid& aZ) {
|
||||
myZ=aZ;
|
||||
}
|
||||
//
|
||||
const TopoDS_Solid& Solid()const {
|
||||
return myZ;
|
||||
}
|
||||
//
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
//
|
||||
const Handle(IntTools_Context)& Context()const {
|
||||
return myContext;
|
||||
}
|
||||
//
|
||||
TopAbs_State State() const{
|
||||
return myState;
|
||||
};
|
||||
//
|
||||
void Perform() {
|
||||
Standard_Real aTol;
|
||||
gp_Pnt aPV;
|
||||
//
|
||||
BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
|
||||
//
|
||||
aPV=BRep_Tool::Pnt(myV);
|
||||
aTol=BRep_Tool::Tolerance(myV);
|
||||
//
|
||||
aSC.Perform(aPV, aTol);
|
||||
//
|
||||
myState=aSC.State();
|
||||
};
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIV;
|
||||
Standard_Integer myIZ;
|
||||
TopAbs_State myState;
|
||||
TopoDS_Vertex myV;
|
||||
TopoDS_Solid myZ;
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
|
||||
//
|
||||
typedef BOPCol_ContextFunctor
|
||||
<BOPAlgo_VertexSolid,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VertexSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_ContextCnt
|
||||
<BOPAlgo_VertexSolidFunctor,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_ShapeSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_ShapeSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_ShapeSolid() :
|
||||
myIE(-1),
|
||||
myIZ(-1),
|
||||
myHasInterf(Standard_False),
|
||||
myDS(NULL) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_ShapeSolid(){
|
||||
};
|
||||
//
|
||||
void SetIndices(const Standard_Integer nE,
|
||||
const Standard_Integer nZ){
|
||||
myIE=nE;
|
||||
myIZ=nZ;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nE,
|
||||
Standard_Integer& nZ) const {
|
||||
nE=myIE;
|
||||
nZ=myIZ;
|
||||
}
|
||||
//
|
||||
void SetDS(BOPDS_DS* pDS) {
|
||||
myDS=pDS;
|
||||
}
|
||||
//
|
||||
Standard_Boolean HasInterf() const{
|
||||
return myHasInterf;
|
||||
};
|
||||
//
|
||||
virtual void Perform() {
|
||||
Standard_Boolean bHasInterf;
|
||||
//
|
||||
myHasInterf=Standard_False;
|
||||
//
|
||||
bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
|
||||
if (!bHasInterf) {
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
|
||||
}
|
||||
};
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIE;
|
||||
Standard_Integer myIZ;
|
||||
Standard_Boolean myHasInterf;
|
||||
BOPDS_DS* myDS;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_ShapeSolid,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_ShapeSolidFunctor,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_SolidSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_SolidSolid() :
|
||||
BOPAlgo_ShapeSolid() {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_SolidSolid(){
|
||||
};
|
||||
//
|
||||
virtual void Perform() {
|
||||
Standard_Boolean bFlag;
|
||||
//
|
||||
bFlag=Standard_False;
|
||||
myHasInterf=Standard_False;
|
||||
//
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
|
||||
if (!myHasInterf) {
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
|
||||
}
|
||||
};
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_SolidSolid,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_SolidSolidFunctor,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformVZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PerformVZ()
|
||||
{
|
||||
Standard_Integer iSize, nV, nZ, k, aNbVVS;
|
||||
TopAbs_State aState;
|
||||
BOPDS_MapOfPair aMPK;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
|
||||
aVZs.SetIncrement(iSize);
|
||||
//
|
||||
BOPAlgo_VectorOfVertexSolid aVVS;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nV, nZ);
|
||||
//
|
||||
if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Integer nVSD = nV;
|
||||
myDS->HasShapeSD(nV, nVSD);
|
||||
//
|
||||
BOPDS_Pair aPK;
|
||||
aPK.SetIndices(nVSD, nZ);
|
||||
if (!aMPK.Add(aPK)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
|
||||
const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
|
||||
//
|
||||
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
|
||||
aVertexSolid.SetIndices(nV, nZ);
|
||||
aVertexSolid.SetVertex(aV);
|
||||
aVertexSolid.SetSolid(aZ);
|
||||
}
|
||||
//
|
||||
aNbVVS=aVVS.Extent();
|
||||
//=============================================================
|
||||
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
|
||||
//=============================================================
|
||||
for (k=0; k < aNbVVS; ++k) {
|
||||
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
|
||||
aState=aVertexSolid.State();
|
||||
if (aState==TopAbs_IN) {
|
||||
aVertexSolid.Indices(nV, nZ);
|
||||
//
|
||||
BOPDS_InterfVZ& aVZ=aVZs.Append1();
|
||||
aVZ.SetIndices(nV, nZ);
|
||||
//
|
||||
myDS->AddInterf(nV, nZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformEZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PerformEZ()
|
||||
{
|
||||
PerformSZ(TopAbs_EDGE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformFZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PerformFZ()
|
||||
{
|
||||
PerformSZ(TopAbs_FACE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformZZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PerformZZ()
|
||||
{
|
||||
Standard_Boolean bHasInterf;
|
||||
Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_VectorOfSolidSolid aVSolidSolid;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nZ1, nZ);
|
||||
//
|
||||
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
|
||||
aSolidSolid.SetIndices(nZ1, nZ);
|
||||
aSolidSolid.SetDS(myDS);
|
||||
}
|
||||
//
|
||||
aNbSolidSolid=aVSolidSolid.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
|
||||
//
|
||||
aZZs.SetIncrement(iSize);
|
||||
//
|
||||
for (k=0; k < aNbSolidSolid; ++k) {
|
||||
const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
|
||||
bHasInterf=aSolidSolid.HasInterf();
|
||||
if (bHasInterf) {
|
||||
aSolidSolid.Indices(nZ1, nZ);
|
||||
//
|
||||
BOPDS_InterfZZ& aZZ=aZZs.Append1();
|
||||
aZZ.SetIndices(nZ1, nZ);
|
||||
//
|
||||
myDS->AddInterf(nZ1, nZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformSZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
|
||||
{
|
||||
Standard_Boolean bHasInterf;
|
||||
Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(aTS, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_VectorOfShapeSolid aVShapeSolid;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nS, nZ);
|
||||
//
|
||||
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
|
||||
aShapeSolid.SetIndices(nS, nZ);
|
||||
aShapeSolid.SetDS(myDS);
|
||||
}
|
||||
//
|
||||
aNbShapeSolid=aVShapeSolid.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
|
||||
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
|
||||
//
|
||||
if (aTS==TopAbs_EDGE) {
|
||||
aEZs.SetIncrement(iSize);
|
||||
}
|
||||
else {//if (aTS==TopAbs_FACE)
|
||||
aFZs.SetIncrement(iSize);
|
||||
}
|
||||
//
|
||||
for (k=0; k < aNbShapeSolid; ++k) {
|
||||
const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
|
||||
bHasInterf=aShapeSolid.HasInterf();
|
||||
if (bHasInterf) {
|
||||
aShapeSolid.Indices(nS, nZ);
|
||||
//
|
||||
if (aTS==TopAbs_EDGE) {
|
||||
BOPDS_InterfEZ& aEZ=aEZs.Append1();
|
||||
aEZ.SetIndices(nS, nZ);
|
||||
}
|
||||
else {//if (aTS==TopAbs_FACE)
|
||||
BOPDS_InterfFZ& aFZ=aFZs.Append1();
|
||||
aFZ.SetIndices(nS, nZ);
|
||||
}
|
||||
//
|
||||
myDS->AddInterf(nS, nZ);
|
||||
}
|
||||
}
|
||||
}
|
64
src/BOPAlgo/BOPAlgo_GlueEnum.hxx
Normal file
64
src/BOPAlgo/BOPAlgo_GlueEnum.hxx
Normal file
@@ -0,0 +1,64 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef _BOPAlgo_GlueEnum_HeaderFile
|
||||
#define _BOPAlgo_GlueEnum_HeaderFile
|
||||
|
||||
//! The Enumeration describes an additional option for the algorithms
|
||||
//! in the Boolean Component such as General Fuse, Boolean operations,
|
||||
//! Section operation, Maker Volume and Cells Builder algorithms.
|
||||
//!
|
||||
//! The Gluing options have been designed to speed up the computation
|
||||
//! of the interference among arguments of the operations on special cases,
|
||||
//! in which the arguments may be overlapping but do not have real intersections
|
||||
//! between their sub-shapes.
|
||||
//!
|
||||
//! This option cannot be used on the shapes having real intersections,
|
||||
//! like intersection vertex between edges, or intersection vertex between
|
||||
//! edge and a face or intersection line between faces.
|
||||
//!
|
||||
//! There are two possibilities of overlapping shapes:
|
||||
//! 1. The shapes can be partially coinciding - the faces do not have
|
||||
//! intersection curves, but overlapping. The faces of such arguments will
|
||||
//! be split during the operation;
|
||||
//! 2. The shapes can be fully coinciding - there should be no partial
|
||||
//! overlapping of the faces, thus no intersection of type EDGE/FACE at all.
|
||||
//! In such cases the faces will not be split during the operation.
|
||||
//!
|
||||
//! Even though there are no real intersections on such cases without Gluing options the algorithm
|
||||
//! will still intersect the sub-shapes of the arguments with interfering bounding boxes.
|
||||
//!
|
||||
//! The performance improvement in gluing mode is achieved by excluding
|
||||
//! the most time consuming computations according to the given Gluing parameter:
|
||||
//! 1. Computation of FACE/FACE intersections for partial coincidence;
|
||||
//! 2. And computation of VERTEX/FACE, EDGE/FACE and FACE/FACE intersections for full coincidence.
|
||||
//!
|
||||
//! By setting the Gluing option for the operation user should guarantee
|
||||
//! that the arguments are really coinciding. The algorithms do not check this itself.
|
||||
//! Setting inappropriate option for the operation is likely to lead to incorrect result.
|
||||
//!
|
||||
//! There are following items in the enumeration:
|
||||
//! BOPAlgo_GlueOff - default value for the algorithms, Gluing is switched off;
|
||||
//! BOPAlgo_GlueShift - Glue option for shapes with partial coincidence;
|
||||
//! BOPAlgo_GlueFull - Glue option for shapes with full coincidence.
|
||||
//!
|
||||
|
||||
enum BOPAlgo_GlueEnum
|
||||
{
|
||||
BOPAlgo_GlueOff,
|
||||
BOPAlgo_GlueShift,
|
||||
BOPAlgo_GlueFull
|
||||
};
|
||||
|
||||
#endif // _BOPAlgo_GlueEnum_HeaderFile
|
@@ -101,6 +101,7 @@ void BOPAlgo_MakerVolume::Perform()
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
pPF->SetGlue(myGlue);
|
||||
pPF->Perform();
|
||||
//
|
||||
myEntryPoint = 1;
|
||||
|
@@ -43,6 +43,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
myIterator=NULL;
|
||||
myNonDestructive=Standard_False;
|
||||
myIsPrimary=Standard_True;
|
||||
myGlue=BOPAlgo_GlueOff;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -57,6 +58,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
myIterator=NULL;
|
||||
myNonDestructive=Standard_False;
|
||||
myIsPrimary=Standard_True;
|
||||
myGlue=BOPAlgo_GlueOff;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
@@ -83,6 +85,22 @@ Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
|
||||
return myNonDestructive;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetGlue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::SetGlue(const BOPAlgo_GlueEnum theGlue)
|
||||
{
|
||||
myGlue=theGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Glue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPAlgo_GlueEnum BOPAlgo_PaveFiller::Glue() const
|
||||
{
|
||||
return myGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetIsPrimary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@@ -133,7 +151,7 @@ BOPDS_PDS BOPAlgo_PaveFiller::PDS()
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(IntTools_Context) BOPAlgo_PaveFiller::Context()
|
||||
const Handle(IntTools_Context)& BOPAlgo_PaveFiller::Context()
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
@@ -283,6 +301,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
return;
|
||||
}
|
||||
//
|
||||
UpdateInterfsWithSDVertices();
|
||||
RefineFaceInfoOn();
|
||||
//
|
||||
MakePCurves();
|
||||
@@ -294,24 +313,4 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 03
|
||||
PerformVZ();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 13
|
||||
PerformEZ();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 23
|
||||
PerformFZ();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// 33
|
||||
PerformZZ();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <BOPDS_VectorOfCurve.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPAlgo_GlueEnum.hxx>
|
||||
class IntTools_Context;
|
||||
class BOPDS_DS;
|
||||
class BOPAlgo_SectionAttribute;
|
||||
@@ -83,7 +84,7 @@ public:
|
||||
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
|
||||
|
||||
Standard_EXPORT Handle(IntTools_Context) Context();
|
||||
Standard_EXPORT const Handle(IntTools_Context)& Context();
|
||||
|
||||
Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr);
|
||||
|
||||
@@ -101,6 +102,14 @@ public:
|
||||
|
||||
|
||||
|
||||
//! Sets the glue option for the algorithm
|
||||
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
|
||||
|
||||
//! Returns the glue option of the algorithm
|
||||
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
typedef NCollection_DataMap
|
||||
@@ -137,16 +146,6 @@ protected:
|
||||
|
||||
Standard_EXPORT virtual void PerformFF();
|
||||
|
||||
Standard_EXPORT virtual void PerformVZ();
|
||||
|
||||
Standard_EXPORT virtual void PerformEZ();
|
||||
|
||||
Standard_EXPORT virtual void PerformFZ();
|
||||
|
||||
Standard_EXPORT virtual void PerformZZ();
|
||||
|
||||
Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
|
||||
|
||||
Standard_EXPORT void TreatVerticesEE();
|
||||
|
||||
Standard_EXPORT void MakeSDVerticesFF(const BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
|
||||
@@ -215,7 +214,6 @@ protected:
|
||||
|
||||
//! Treatment of section edges.
|
||||
Standard_EXPORT Standard_Integer PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
BOPCol_DataMapOfShapeInteger& theMVI,
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
@@ -348,7 +346,9 @@ protected:
|
||||
Standard_EXPORT void UpdateCommonBlocksWithSDVertices();
|
||||
|
||||
Standard_EXPORT void UpdateBlocksWithSharedVertices();
|
||||
|
||||
|
||||
Standard_EXPORT void UpdateInterfsWithSDVertices();
|
||||
|
||||
Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV,
|
||||
const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D);
|
||||
@@ -395,6 +395,7 @@ protected:
|
||||
BOPAlgo_SectionAttribute mySectionAttribute;
|
||||
Standard_Boolean myNonDestructive;
|
||||
Standard_Boolean myIsPrimary;
|
||||
BOPAlgo_GlueEnum myGlue;
|
||||
|
||||
|
||||
private:
|
||||
|
@@ -48,7 +48,6 @@
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformVV()
|
||||
{
|
||||
Standard_Boolean bWithSubShape;
|
||||
Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
//
|
||||
@@ -71,7 +70,7 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
//
|
||||
// 1. Map V/LV
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(n1, n2, bWithSubShape);
|
||||
myIterator->Value(n1, n2);
|
||||
//
|
||||
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1)));
|
||||
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2)));
|
||||
|
@@ -16,411 +16,255 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPDS_Curve.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
#include <BOPDS_IteratorSI.hxx>
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Solid.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>
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_VertexSolid
|
||||
//function : SetNonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_VertexSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
void BOPAlgo_PaveFiller::SetNonDestructive()
|
||||
{
|
||||
if (!myIsPrimary || myNonDestructive) {
|
||||
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);
|
||||
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
|
||||
//
|
||||
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);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//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;
|
||||
|
||||
BOPAlgo_VertexSolid()
|
||||
: myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_VertexSolid(){
|
||||
};
|
||||
//
|
||||
void SetIndices(const Standard_Integer nV,
|
||||
const Standard_Integer nZ){
|
||||
myIV=nV;
|
||||
myIZ=nZ;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nV,
|
||||
Standard_Integer& nZ) const {
|
||||
nV=myIV;
|
||||
nZ=myIZ;
|
||||
}
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
myV=aV;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& Vertex()const {
|
||||
return myV;
|
||||
}
|
||||
//
|
||||
void SetSolid(const TopoDS_Solid& aZ) {
|
||||
myZ=aZ;
|
||||
}
|
||||
//
|
||||
const TopoDS_Solid& Solid()const {
|
||||
return myZ;
|
||||
}
|
||||
//
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
//
|
||||
const Handle(IntTools_Context)& Context()const {
|
||||
return myContext;
|
||||
}
|
||||
//
|
||||
TopAbs_State State() const{
|
||||
return myState;
|
||||
};
|
||||
//
|
||||
void Perform() {
|
||||
Standard_Real aTol;
|
||||
gp_Pnt aPV;
|
||||
//
|
||||
BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
|
||||
//
|
||||
aPV=BRep_Tool::Pnt(myV);
|
||||
aTol=BRep_Tool::Tolerance(myV);
|
||||
//
|
||||
aSC.Perform(aPV, aTol);
|
||||
//
|
||||
myState=aSC.State();
|
||||
};
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIV;
|
||||
Standard_Integer myIZ;
|
||||
TopAbs_State myState;
|
||||
TopoDS_Vertex myV;
|
||||
TopoDS_Solid myZ;
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
|
||||
//
|
||||
typedef BOPCol_ContextFunctor
|
||||
<BOPAlgo_VertexSolid,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_VertexSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_ContextCnt
|
||||
<BOPAlgo_VertexSolidFunctor,
|
||||
BOPAlgo_VectorOfVertexSolid,
|
||||
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_ShapeSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_ShapeSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_ShapeSolid() :
|
||||
myIE(-1),
|
||||
myIZ(-1),
|
||||
myHasInterf(Standard_False),
|
||||
myDS(NULL) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_ShapeSolid(){
|
||||
};
|
||||
//
|
||||
void SetIndices(const Standard_Integer nE,
|
||||
const Standard_Integer nZ){
|
||||
myIE=nE;
|
||||
myIZ=nZ;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nE,
|
||||
Standard_Integer& nZ) const {
|
||||
nE=myIE;
|
||||
nZ=myIZ;
|
||||
}
|
||||
//
|
||||
void SetDS(BOPDS_DS* pDS) {
|
||||
myDS=pDS;
|
||||
}
|
||||
//
|
||||
Standard_Boolean HasInterf() const{
|
||||
return myHasInterf;
|
||||
};
|
||||
//
|
||||
virtual void Perform() {
|
||||
Standard_Boolean bHasInterf;
|
||||
//
|
||||
myHasInterf=Standard_False;
|
||||
//
|
||||
bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
|
||||
if (!bHasInterf) {
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
|
||||
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);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
};
|
||||
return nVNew;
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIE;
|
||||
Standard_Integer myIZ;
|
||||
Standard_Boolean myHasInterf;
|
||||
BOPDS_DS* myDS;
|
||||
};
|
||||
// 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);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
// add vertex to SD map
|
||||
myDS->AddShapeSD(nV, nVNew);
|
||||
//
|
||||
myDS->InitPaveBlocksForVertex(nV);
|
||||
//
|
||||
return nVNew;
|
||||
}
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_ShapeSolid,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_ShapeSolidFunctor,
|
||||
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_SolidSolid
|
||||
//function : UpdatePaveBlocksWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPAlgo_SolidSolid() :
|
||||
BOPAlgo_ShapeSolid() {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_SolidSolid(){
|
||||
};
|
||||
//
|
||||
virtual void Perform() {
|
||||
Standard_Boolean bFlag;
|
||||
//
|
||||
bFlag=Standard_False;
|
||||
myHasInterf=Standard_False;
|
||||
//
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
|
||||
if (!myHasInterf) {
|
||||
myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
|
||||
}
|
||||
};
|
||||
};
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_SolidSolid,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_SolidSolidFunctor,
|
||||
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformVZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformVZ()
|
||||
void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
|
||||
{
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer iSize, nV, nZ, k, aNbVVS;
|
||||
TopAbs_State aState;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
|
||||
aVZs.SetIncrement(iSize);
|
||||
//
|
||||
BOPAlgo_VectorOfVertexSolid aVVS;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nV, nZ, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
|
||||
const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ);
|
||||
//
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape());
|
||||
const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape());
|
||||
//
|
||||
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
|
||||
aVertexSolid.SetIndices(nV, nZ);
|
||||
aVertexSolid.SetVertex(aV);
|
||||
aVertexSolid.SetSolid(aZ);
|
||||
}
|
||||
//
|
||||
aNbVVS=aVVS.Extent();
|
||||
//=============================================================
|
||||
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
|
||||
//=============================================================
|
||||
for (k=0; k < aNbVVS; ++k) {
|
||||
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
|
||||
aState=aVertexSolid.State();
|
||||
if (aState==TopAbs_IN) {
|
||||
aVertexSolid.Indices(nV, nZ);
|
||||
//
|
||||
BOPDS_InterfVZ& aVZ=aVZs.Append1();
|
||||
aVZ.SetIndices(nV, nZ);
|
||||
//
|
||||
myDS->AddInterf(nV, nZ);
|
||||
}
|
||||
}
|
||||
myDS->UpdatePaveBlocksWithSDVertices();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformEZ
|
||||
//function : UpdateCommonBlocksWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformEZ()
|
||||
{
|
||||
PerformSZ(TopAbs_EDGE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformFZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformFZ()
|
||||
{
|
||||
PerformSZ(TopAbs_FACE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformZZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformZZ()
|
||||
void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
|
||||
{
|
||||
Standard_Boolean bJustAdd, bHasInterf;
|
||||
Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
|
||||
if (!myNonDestructive) {
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
return;
|
||||
}
|
||||
Standard_Integer aNbPBP;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
|
||||
aNbPBP=aPBP.Extent();
|
||||
if(!aNbPBP) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_VectorOfSolidSolid aVSolidSolid;
|
||||
Standard_Integer i, nV1, nV2;
|
||||
Standard_Real aTolV;
|
||||
BOPDS_MapOfCommonBlock aMCB;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
|
||||
Handle(BOPDS_PaveBlock) aPB;
|
||||
//
|
||||
aTolV = Precision::Confusion();
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nZ1, nZ, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
|
||||
aSolidSolid.SetIndices(nZ1, nZ);
|
||||
aSolidSolid.SetDS(myDS);
|
||||
}
|
||||
//
|
||||
aNbSolidSolid=aVSolidSolid.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
|
||||
//
|
||||
aZZs.SetIncrement(iSize);
|
||||
//
|
||||
for (k=0; k < aNbSolidSolid; ++k) {
|
||||
const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
|
||||
bHasInterf=aSolidSolid.HasInterf();
|
||||
if (bHasInterf) {
|
||||
aSolidSolid.Indices(nZ1, nZ);
|
||||
//
|
||||
BOPDS_InterfZZ& aZZ=aZZs.Append1();
|
||||
aZZ.SetIndices(nZ1, nZ);
|
||||
//
|
||||
myDS->AddInterf(nZ1, nZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformSZ
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformSZ(const TopAbs_ShapeEnum aTS)
|
||||
{
|
||||
Standard_Boolean bJustAdd, bHasInterf;
|
||||
Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(aTS, TopAbs_SOLID);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_VectorOfShapeSolid aVShapeSolid;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nS, nZ, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
|
||||
aShapeSolid.SetIndices(nS, nZ);
|
||||
aShapeSolid.SetDS(myDS);
|
||||
}
|
||||
//
|
||||
aNbShapeSolid=aVShapeSolid.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
|
||||
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
|
||||
//
|
||||
if (aTS==TopAbs_EDGE) {
|
||||
aEZs.SetIncrement(iSize);
|
||||
}
|
||||
else {//if (aTS==TopAbs_FACE)
|
||||
aFZs.SetIncrement(iSize);
|
||||
}
|
||||
//
|
||||
for (k=0; k < aNbShapeSolid; ++k) {
|
||||
const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
|
||||
bHasInterf=aShapeSolid.HasInterf();
|
||||
if (bHasInterf) {
|
||||
aShapeSolid.Indices(nS, nZ);
|
||||
//
|
||||
if (aTS==TopAbs_EDGE) {
|
||||
BOPDS_InterfEZ& aEZ=aEZs.Append1();
|
||||
aEZ.SetIndices(nS, nZ);
|
||||
}
|
||||
else {//if (aTS==TopAbs_FACE)
|
||||
BOPDS_InterfFZ& aFZ=aFZs.Append1();
|
||||
aFZ.SetIndices(nS, nZ);
|
||||
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;
|
||||
}
|
||||
//
|
||||
myDS->AddInterf(nS, nZ);
|
||||
if (aMCB.Add(aCB)) {
|
||||
myDS->SortPaveBlocks(aCB);
|
||||
aPB->Indices(nV1, nV2);
|
||||
UpdateVertex(nV1, aTolV);
|
||||
UpdateVertex(nV2, aTolV);
|
||||
myDS->UpdateCommonBlockWithSDVertices(aCB);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
//function : UpdateInterfsWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template <class InterfType>
|
||||
void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
|
||||
{
|
||||
for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
|
||||
{
|
||||
InterfType& anIntf = theInterfs(i);
|
||||
Standard_Integer anInd;
|
||||
if (anIntf.HasIndexNew(anInd))
|
||||
{
|
||||
Standard_Integer anIndSD;
|
||||
if (theDS->HasShapeSD(anInd, anIndSD))
|
||||
{
|
||||
anIntf.SetIndexNew(anIndSD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateInterfsWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdateInterfsWithSDVertices()
|
||||
{
|
||||
UpdateIntfsWithSDVertices(myDS, myDS->InterfVV());
|
||||
UpdateIntfsWithSDVertices(myDS, myDS->InterfVE());
|
||||
UpdateIntfsWithSDVertices(myDS, myDS->InterfVF());
|
||||
UpdateIntfsWithSDVertices(myDS, myDS->InterfEE());
|
||||
UpdateIntfsWithSDVertices(myDS, myDS->InterfEF());
|
||||
}
|
||||
|
@@ -1,232 +0,0 @@
|
||||
// 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 License 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.hxx>
|
||||
|
||||
#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 || myNonDestructive) {
|
||||
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);
|
||||
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
|
||||
//
|
||||
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);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//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);
|
||||
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
|
||||
}
|
||||
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);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
// add vertex to SD map
|
||||
myDS->AddShapeSD(nV, nVNew);
|
||||
//
|
||||
myDS->InitPaveBlocksForVertex(nV);
|
||||
//
|
||||
return nVNew;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdatePaveBlocksWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
|
||||
{
|
||||
myDS->UpdatePaveBlocksWithSDVertices();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdateCommonBlocksWithSDVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
|
||||
{
|
||||
if (!myNonDestructive) {
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
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();
|
||||
}
|
@@ -24,8 +24,8 @@
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Interf.hxx>
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_PassKey.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPDS_VectorOfInterfVE.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
@@ -141,12 +141,11 @@ typedef BOPCol_ContextCnt
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformVE()
|
||||
{
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
|
||||
Standard_Real aT, aT1, aT2, aTS1, aTS2;
|
||||
BOPDS_Pave aPave;
|
||||
BOPDS_PassKey aPK;
|
||||
BOPDS_MapOfPassKey aMPK;
|
||||
BOPDS_Pair aPK;
|
||||
BOPDS_MapOfPair aMPK;
|
||||
BOPAlgo_VectorOfVertexEdge aVVE;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@@ -163,10 +162,7 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
aVEs.SetIncrement(iSize);
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nV, nE, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
myIterator->Value(nV, nE);
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
|
||||
if (aSIE.HasSubShape(nV)) {
|
||||
@@ -187,7 +183,7 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
nVx=nVSD;
|
||||
}
|
||||
//
|
||||
aPK.SetIds(nVx, nE);
|
||||
aPK.SetIndices(nVx, nE);
|
||||
if (!aMPK.Add(aPK)) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -327,7 +327,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bJustAdd, bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
|
||||
Standard_Boolean bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
|
||||
Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbEdgeEdge;
|
||||
Standard_Integer nV11, nV12, nV21, nV22;
|
||||
Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
|
||||
@@ -348,10 +348,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
aEEs.SetIncrement(iSize);
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nE1, nE2, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
myIterator->Value(nE1, nE2);
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1);
|
||||
if (aSIE1.HasFlag()){
|
||||
@@ -427,6 +424,11 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
if (!aNbCPrts) {
|
||||
continue;
|
||||
}
|
||||
//--------------------------------------------
|
||||
Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
|
||||
nE1=aPB1->OriginalEdge();
|
||||
@@ -456,11 +458,8 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
|
||||
aR21(aT21, aTS21), aR22(aTS22, aT22);
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
//
|
||||
Standard_Boolean bAnalytical = Standard_False;
|
||||
if (aNbCPrts) {
|
||||
{
|
||||
const TopoDS_Edge& aOE1 = *(TopoDS_Edge*)&myDS->Shape(nE1);
|
||||
const TopoDS_Edge& aOE2 = *(TopoDS_Edge*)&myDS->Shape(nE2);
|
||||
//
|
||||
@@ -532,6 +531,9 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
}
|
||||
}
|
||||
if (bFlag) {
|
||||
BOPDS_InterfEE& aEE = aEEs.Append1();
|
||||
aEE.SetIndices(nE1, nE2);
|
||||
aEE.SetCommonPart(aCPart);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
@@ -142,96 +142,105 @@ typedef BOPCol_ContextCnt
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformVF()
|
||||
{
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
|
||||
Standard_Real aT1, aT2;
|
||||
BOPAlgo_VectorOfVertexFace aVVF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (iSize) {
|
||||
//
|
||||
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
|
||||
aVFs.SetIncrement(iSize);
|
||||
//
|
||||
Standard_Integer iSize = myIterator->ExpectedLength();
|
||||
//
|
||||
Standard_Integer nV, nF;
|
||||
//
|
||||
if (myGlue == BOPAlgo_GlueFull) {
|
||||
// there is no need to intersect vertices with faces in this mode
|
||||
// just initialize FaceInfo for all faces
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nV, nF, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (myDS->IsSubShape(nV, nF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
|
||||
myIterator->Value(nV, nF);
|
||||
if (!myDS->IsSubShape(nV, nF)) {
|
||||
myDS->ChangeFaceInfo(nF);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
nVx=nV;
|
||||
if (myDS->HasShapeSD(nV, nVSD)) {
|
||||
nVx=nVSD;
|
||||
}
|
||||
//
|
||||
myDS->ChangeFaceInfo(nF);// !
|
||||
//
|
||||
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
|
||||
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
|
||||
//
|
||||
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
|
||||
//
|
||||
aVertexFace.SetIndices(nV, nF);
|
||||
aVertexFace.SetVertex(aV);
|
||||
aVertexFace.SetFace(aF);
|
||||
aVertexFace.SetFuzzyValue(myFuzzyValue);
|
||||
aVertexFace.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
aNbVF=aVVF.Extent();
|
||||
//================================================================
|
||||
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
|
||||
//================================================================
|
||||
//
|
||||
for (k=0; k < aNbVF; ++k) {
|
||||
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
|
||||
//
|
||||
iFlag=aVertexFace.Flag();
|
||||
if (iFlag) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aVertexFace.Indices(nV, nF);
|
||||
aVertexFace.Parameters(aT1, aT2);
|
||||
// 1
|
||||
BOPDS_InterfVF& aVF=aVFs.Append1();
|
||||
aVF.SetIndices(nV, nF);
|
||||
aVF.SetUV(aT1, aT2);
|
||||
// 2
|
||||
myDS->AddInterf(nV, nF);
|
||||
//
|
||||
// 3 update vertex V/F if necessary
|
||||
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
|
||||
nVx=UpdateVertex(nV, 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);
|
||||
}//for (k=0; k < aNbVF; ++k) {
|
||||
}// if (iSize) {
|
||||
else {
|
||||
iSize=10;
|
||||
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
|
||||
aVFs.SetIncrement(iSize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPDS_VectorOfInterfVF& aVFs = myDS->InterfVF();
|
||||
if (!iSize) {
|
||||
iSize = 10;
|
||||
aVFs.SetIncrement(iSize);
|
||||
//
|
||||
TreatVerticesEE();
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Integer nVSD, iFlag, nVx, aNbVF, k;
|
||||
Standard_Real aT1, aT2;
|
||||
BOPAlgo_VectorOfVertexFace aVVF;
|
||||
//
|
||||
aVFs.SetIncrement(iSize);
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nV, nF);
|
||||
//
|
||||
if (myDS->IsSubShape(nV, nF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
myDS->ChangeFaceInfo(nF);
|
||||
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
nVx=nV;
|
||||
if (myDS->HasShapeSD(nV, nVSD)) {
|
||||
nVx=nVSD;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
|
||||
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
|
||||
//
|
||||
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
|
||||
//
|
||||
aVertexFace.SetIndices(nV, nF);
|
||||
aVertexFace.SetVertex(aV);
|
||||
aVertexFace.SetFace(aF);
|
||||
aVertexFace.SetFuzzyValue(myFuzzyValue);
|
||||
aVertexFace.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
aNbVF=aVVF.Extent();
|
||||
//================================================================
|
||||
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
|
||||
//================================================================
|
||||
//
|
||||
for (k=0; k < aNbVF; ++k) {
|
||||
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
|
||||
//
|
||||
iFlag=aVertexFace.Flag();
|
||||
if (iFlag) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aVertexFace.Indices(nV, nF);
|
||||
aVertexFace.Parameters(aT1, aT2);
|
||||
// 1
|
||||
BOPDS_InterfVF& aVF=aVFs.Append1();
|
||||
aVF.SetIndices(nV, nF);
|
||||
aVF.SetUV(aT1, aT2);
|
||||
// 2
|
||||
myDS->AddInterf(nV, nF);
|
||||
//
|
||||
// 3 update vertex V/F if necessary
|
||||
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
|
||||
nVx=UpdateVertex(nV, 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);
|
||||
}//for (k=0; k < aNbVF; ++k) {
|
||||
//
|
||||
TreatVerticesEE();
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -139,22 +139,34 @@ typedef BOPCol_ContextCnt
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformEF()
|
||||
{
|
||||
Standard_Integer iSize;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
FillShrunkData(TopAbs_EDGE, TopAbs_FACE);
|
||||
//
|
||||
myIterator->Initialize(TopAbs_EDGE, TopAbs_FACE);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
Standard_Integer iSize = myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bJustAdd, bV[2], bIsPBSplittable;
|
||||
Standard_Integer nE, nF;
|
||||
//
|
||||
if (myGlue == BOPAlgo_GlueFull) {
|
||||
// there is no need to intersect edges with faces in this mode
|
||||
// just initialize FaceInfo for faces
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nE, nF);
|
||||
if (!myDS->ShapeInfo(nE).HasFlag()) {
|
||||
myDS->ChangeFaceInfo(nF);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bV[2], bIsPBSplittable;
|
||||
Standard_Boolean bV1, bV2, bExpressCompute;
|
||||
Standard_Integer nV1, nV2;
|
||||
Standard_Integer nE, nF, aDiscretize, i, aNbCPrts, iX, nV[2];
|
||||
Standard_Integer aDiscretize, i, aNbCPrts, iX, nV[2];
|
||||
Standard_Integer aNbEdgeFace, k;
|
||||
Standard_Real aTolE, aTolF, aTS1, aTS2, aT1, aT2, aDeflection;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
@@ -177,10 +189,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
aEFs.SetIncrement(iSize);
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nE, nF, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
myIterator->Value(nE, nF);
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
|
||||
if (aSIE.HasFlag()){//degenerated
|
||||
@@ -260,7 +269,13 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
if (!aEdgeFace.IsDone()) {
|
||||
continue;
|
||||
}
|
||||
//~~~
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
if (!aNbCPrts) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aEdgeFace.Indices(nE, nF);
|
||||
//
|
||||
const TopoDS_Edge& aE=aEdgeFace.Edge();
|
||||
@@ -277,29 +292,27 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
anewSR.Range(aTS1, aTS2);
|
||||
//
|
||||
// extend vertices ranges using Edge/Edge intersections
|
||||
// between the edge aE and the edges of the face aF.
|
||||
// thereby the edge's intersection range is reduced
|
||||
ReduceIntersectionRange(nV[0], nV[1], nE, nF, aTS1, aTS2);
|
||||
if (aCPrts(1).Type() == TopAbs_VERTEX) {
|
||||
// for the intersection type VERTEX
|
||||
// extend vertices ranges using Edge/Edge intersections
|
||||
// between the edge aE and the edges of the face aF.
|
||||
// thereby the edge's intersection range is reduced
|
||||
ReduceIntersectionRange(nV[0], nV[1], nE, nF, aTS1, aTS2);
|
||||
}
|
||||
//
|
||||
IntTools_Range aR1(aT1, aTS1), aR2(aTS2, aT2);
|
||||
//
|
||||
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
|
||||
const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
|
||||
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
|
||||
//~~~
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
//
|
||||
Standard_Boolean bLinePlane = Standard_False;
|
||||
if (aNbCPrts) {
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
BRepAdaptor_Surface aBAS(aF, Standard_False);
|
||||
//
|
||||
bLinePlane = (aBAC.GetType() == GeomAbs_Line &&
|
||||
aBAS.GetType() == GeomAbs_Plane);
|
||||
myContext->SurfaceAdaptor(aF).GetType() == GeomAbs_Plane);
|
||||
}
|
||||
|
||||
//
|
||||
for (i=1; i<=aNbCPrts; ++i) {
|
||||
const IntTools_CommonPrt& aCPart=aCPrts(i);
|
||||
aType=aCPart.Type();
|
||||
@@ -753,6 +766,10 @@ void BOPAlgo_PaveFiller::ReduceIntersectionRange(const Standard_Integer theV1,
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (!myDS->HasInterfShapeSubShapes(theE, theF)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
|
||||
Standard_Integer aNbEEs = aEEs.Extent();
|
||||
if (!aNbEEs) {
|
||||
|
@@ -184,12 +184,11 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
|
||||
Standard_Boolean bApp, bCompC2D1, bCompC2D2, bIsDone;
|
||||
Standard_Boolean bToSplit, bTangentFaces;
|
||||
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
|
||||
Standard_Integer aNbFaceFace, k;
|
||||
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF, aTolReal;
|
||||
BRepAdaptor_Surface aBAS1, aBAS2;
|
||||
BOPCol_MapOfInteger aMI;
|
||||
BOPAlgo_VectorOfFaceFace aVFaceFace;
|
||||
//
|
||||
@@ -203,10 +202,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
bToSplit = Standard_False;
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nF1, nF2, bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
myIterator->Value(nF1, nF2);
|
||||
//
|
||||
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
|
||||
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
|
||||
@@ -220,8 +216,8 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
myDS->UpdateFaceInfoIn(nF2);
|
||||
}
|
||||
//
|
||||
aBAS1.Initialize(aF1, Standard_False);
|
||||
aBAS2.Initialize(aF2, Standard_False);
|
||||
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(aF1);
|
||||
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(aF2);
|
||||
if (aBAS1.GetType() == GeomAbs_Plane &&
|
||||
aBAS2.GetType() == GeomAbs_Plane) {
|
||||
Standard_Boolean bToIntersect;
|
||||
@@ -235,24 +231,36 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
}
|
||||
}
|
||||
//
|
||||
ToleranceFF(aBAS1, aBAS2, aTolFF);
|
||||
ToleranceFF(aBAS1, aBAS2, aTolFF);
|
||||
//
|
||||
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
|
||||
//
|
||||
aFaceFace.SetIndices(nF1, nF2);
|
||||
aFaceFace.SetFaces(aF1, aF2);
|
||||
aFaceFace.SetTolFF(aTolFF);
|
||||
//
|
||||
IntSurf_ListOfPntOn2S aListOfPnts;
|
||||
GetEFPnts(nF1, nF2, aListOfPnts);
|
||||
aNbLP = aListOfPnts.Extent();
|
||||
if (aNbLP) {
|
||||
aFaceFace.SetList(aListOfPnts);
|
||||
if (myGlue == BOPAlgo_GlueOff) {
|
||||
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
|
||||
//
|
||||
aFaceFace.SetIndices(nF1, nF2);
|
||||
aFaceFace.SetFaces(aF1, aF2);
|
||||
aFaceFace.SetTolFF(aTolFF);
|
||||
//
|
||||
IntSurf_ListOfPntOn2S aListOfPnts;
|
||||
GetEFPnts(nF1, nF2, aListOfPnts);
|
||||
aNbLP = aListOfPnts.Extent();
|
||||
if (aNbLP) {
|
||||
aFaceFace.SetList(aListOfPnts);
|
||||
}
|
||||
//
|
||||
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
|
||||
aFaceFace.SetFuzzyValue(myFuzzyValue);
|
||||
aFaceFace.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
else {
|
||||
// for the Glue mode just add all interferences of that type
|
||||
BOPDS_InterfFF& aFF = aFFs.Append1();
|
||||
aFF.SetIndices(nF1, nF2);
|
||||
aFF.SetTolR3D(Precision::Confusion());
|
||||
aFF.SetTolR2D(Precision::PConfusion());
|
||||
aFF.SetTolReal(Precision::Confusion());
|
||||
aFF.SetTangentFaces(Standard_False);
|
||||
aFF.Init(0, 0);
|
||||
}
|
||||
//
|
||||
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
|
||||
aFaceFace.SetFuzzyValue(myFuzzyValue);
|
||||
aFaceFace.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
aNbFaceFace=aVFaceFace.Extent();
|
||||
@@ -359,6 +367,10 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
{
|
||||
if (myGlue != BOPAlgo_GlueOff) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbFF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@@ -597,7 +609,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
// Make p-curves
|
||||
BOPTools_AlgoTools::MakePCurve(aES, aF1, aF2, aIC,
|
||||
mySectionAttribute.PCurveOnS1(),
|
||||
mySectionAttribute.PCurveOnS2());
|
||||
mySectionAttribute.PCurveOnS2(),
|
||||
myContext);
|
||||
//
|
||||
// Append the Pave Block to the Curve j
|
||||
aLPBC.Append(aPB);
|
||||
@@ -646,7 +659,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
// post treatment
|
||||
MakeSDVerticesFF(aDMVLV, aDMNewSD);
|
||||
myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
|
||||
myErrorStatus=PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
@@ -697,7 +710,6 @@ void BOPAlgo_PaveFiller::MakeSDVerticesFF
|
||||
//=======================================================================
|
||||
Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
BOPCol_DataMapOfShapeInteger& aMVI,
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
@@ -768,9 +780,25 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
}
|
||||
//
|
||||
// 1 prepare arguments
|
||||
BOPCol_MapOfShape anAddedSD;
|
||||
for (k=1; k<=aNbS; ++k) {
|
||||
const TopoDS_Shape& aS=theMSCPB.FindKey(k);
|
||||
aLS.Append(aS);
|
||||
// add vertices-candidates for SD from the map aDMNewSD,
|
||||
// so that they took part in fuse operation.
|
||||
TopoDS_Iterator itV(aS);
|
||||
for (; itV.More(); itV.Next())
|
||||
{
|
||||
const TopoDS_Shape& aVer = itV.Value();
|
||||
Standard_Integer iVer = myDS->Index(aVer);
|
||||
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
|
||||
if (pSD)
|
||||
{
|
||||
const TopoDS_Shape& aVSD = myDS->Shape(*pSD);
|
||||
if (anAddedSD.Add(aVSD))
|
||||
aLS.Append(aVSD);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// The section edges considered as a micro should be
|
||||
@@ -833,32 +861,28 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
aV=aSx;
|
||||
}
|
||||
// index of new vertex in theDS -> iV
|
||||
if (!aMVI.IsBound(aV)) {
|
||||
iV = myDS->Index(aV);
|
||||
if (iV < 0) {
|
||||
aSI.SetShapeType(aType);
|
||||
aSI.SetShape(aV);
|
||||
iV=myDS->Append(aSI);
|
||||
//
|
||||
aMVI.Bind(aV, iV);
|
||||
}
|
||||
else {
|
||||
iV=aMVI.Find(aV);
|
||||
}
|
||||
//
|
||||
if (!bIntersectionPoint) {
|
||||
// save SD connection
|
||||
nSx = aMVI.Find(aSx);
|
||||
nSx = myDS->Index(aSx);
|
||||
aDMNewSD.Bind(nSx, iV);
|
||||
myDS->AddShapeSD(nSx, iV);
|
||||
}
|
||||
else {
|
||||
// update FF interference
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
|
||||
iX=aCPB.IndexInterf();
|
||||
iP=aCPB.Index();
|
||||
BOPDS_InterfFF& aFF=aFFs(iX);
|
||||
BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
|
||||
BOPDS_Point& aNP=aVNP(iP);
|
||||
aNP.SetIndex(iV);
|
||||
// update FF interference
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
|
||||
iX=aCPB.IndexInterf();
|
||||
iP=aCPB.Index();
|
||||
BOPDS_InterfFF& aFF=aFFs(iX);
|
||||
BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
|
||||
BOPDS_Point& aNP=aVNP(iP);
|
||||
aNP.SetIndex(iV);
|
||||
}
|
||||
}//if (aType==TopAbs_VERTEX) {
|
||||
//
|
||||
@@ -928,14 +952,11 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
if (!aNbLPBx) {
|
||||
aE=aSx;
|
||||
//
|
||||
if (!aMVI.IsBound(aE)) {
|
||||
iE = myDS->Index(aE);
|
||||
if (iE < 0) {
|
||||
aSI.SetShapeType(aType);
|
||||
aSI.SetShape(aE);
|
||||
iE=myDS->Append(aSI);
|
||||
aMVI.Bind(aE, iE);
|
||||
}
|
||||
else {
|
||||
iE=aMVI.Find(aE);
|
||||
}
|
||||
// append new PaveBlock to aLPBC
|
||||
aPB1->SetEdge(iE);
|
||||
@@ -949,21 +970,17 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
const Handle(BOPDS_PaveBlock) aPBRx=aPDS->RealPaveBlock(aPBx);
|
||||
//
|
||||
// update vertices of paves
|
||||
aPave[0]=aPBx->Pave1();
|
||||
aPave[1]=aPBx->Pave2();
|
||||
aPave[0] = aPBx->Pave1();
|
||||
aPave[1] = aPBx->Pave2();
|
||||
for (j=0; j<2; ++j) {
|
||||
nV = aPave[j].Index();
|
||||
aV = aPDS->Shape(nV);
|
||||
//
|
||||
if (!aMVI.IsBound(aV)) {
|
||||
// index of new vertex in theDS -> iV
|
||||
// index of new vertex in myDS -> iV
|
||||
iV = myDS->Index(aV);
|
||||
if (iV < 0) {
|
||||
aSI.SetShapeType(TopAbs_VERTEX);
|
||||
aSI.SetShape(aV);
|
||||
iV = myDS->Append(aSI);
|
||||
aMVI.Bind(aV, iV);
|
||||
}
|
||||
else {
|
||||
iV = aMVI.Find(aV);
|
||||
}
|
||||
const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
|
||||
if (aP1.Parameter() == aPave[j].Parameter() &&
|
||||
@@ -977,29 +994,31 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
//
|
||||
// add edge
|
||||
aE=aPDS->Shape(aPBRx->Edge());
|
||||
iE = myDS->Index(aE);
|
||||
//
|
||||
if (!aMVI.IsBound(aE)) {
|
||||
if (iE < 0) {
|
||||
aSI.SetShapeType(aType);
|
||||
aSI.SetShape(aE);
|
||||
iE=myDS->Append(aSI);
|
||||
aMVI.Bind(aE, iE);
|
||||
// update real edge tolerance according to distances in common block if any
|
||||
if (aPDS->IsCommonBlock(aPBx)) {
|
||||
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBx);
|
||||
if (aPDS->IsCommonBlock(aPBRx)) {
|
||||
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx);
|
||||
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
|
||||
if (aFF.TolReal() < aTol) {
|
||||
aFF.SetTolReal(aTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
iE=aMVI.Find(aE);
|
||||
}
|
||||
// append new PaveBlock to aLPBC
|
||||
Handle(BOPDS_PaveBlock) aPBC=new BOPDS_PaveBlock();
|
||||
BOPDS_Pave aPaveR1, aPaveR2;
|
||||
aPaveR1 = aPBRx->Pave1();
|
||||
aPaveR2 = aPBRx->Pave2();
|
||||
aPaveR1.SetIndex(myDS->Index(aPDS->Shape(aPaveR1.Index())));
|
||||
aPaveR2.SetIndex(myDS->Index(aPDS->Shape(aPaveR2.Index())));
|
||||
//
|
||||
aPBC->SetPave1(aPave[0]);
|
||||
aPBC->SetPave2(aPave[1]);
|
||||
aPBC->SetPave1(aPaveR1);
|
||||
aPBC->SetPave2(aPaveR2);
|
||||
aPBC->SetEdge(iE);
|
||||
if (bOld) {
|
||||
aPBC->SetOriginalEdge(aPB1->OriginalEdge());
|
||||
@@ -1013,6 +1032,18 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
}
|
||||
}//else if (aType==TopAbs_EDGE)
|
||||
}//for (; aItLS.More(); aItLS.Next()) {
|
||||
|
||||
// Update SD for vertices that did not participate in operation
|
||||
BOPCol_DataMapOfIntegerInteger::Iterator itDM(aDMNewSD);
|
||||
for (; itDM.More(); itDM.Next())
|
||||
{
|
||||
const Standard_Integer* pSD = aDMNewSD.Seek(itDM.Value());
|
||||
if (pSD)
|
||||
{
|
||||
itDM.ChangeValue() = *pSD;
|
||||
myDS->AddShapeSD(itDM.Key(), *pSD);
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -2020,7 +2051,7 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
|
||||
aDTol = 1.e-12;
|
||||
//
|
||||
GeomAdaptor_Curve aGAC(aIC.Curve());
|
||||
aPTol = aGAC.Resolution(aTolR3D);
|
||||
aPTol = aGAC.Resolution(Max(aTolR3D, aTolV));
|
||||
//
|
||||
bExist = aPB->ContainsParameter(aT, aPTol, nVUsed);
|
||||
if (bExist) {
|
||||
@@ -2435,71 +2466,95 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
BOPDS_MapOfPaveBlock aMPB;
|
||||
BOPCol_MapOfInteger aMicroEdges;
|
||||
//
|
||||
BOPDS_ListOfPaveBlock anAllPBs;
|
||||
|
||||
// Get pave blocks of section edges
|
||||
BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
|
||||
Standard_Integer aNbFF = aFFs.Extent();
|
||||
for (i = 0; i < aNbFF; ++i)
|
||||
{
|
||||
const BOPDS_InterfFF& aFF = aFFs(i);
|
||||
const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
|
||||
Standard_Integer aNbC = aVNC.Extent();
|
||||
for (j = 0; j < aNbC; ++j)
|
||||
{
|
||||
const BOPDS_Curve& aNC = aVNC(j);
|
||||
const BOPDS_ListOfPaveBlock& aLPBC = aNC.PaveBlocks();
|
||||
aItPB.Initialize(aLPBC);
|
||||
for (; aItPB.More(); aItPB.Next())
|
||||
anAllPBs.Append(aItPB.Value());
|
||||
}
|
||||
}
|
||||
|
||||
// Get pave blocks from the pool
|
||||
BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
|
||||
aNbPBP = aPBP.Extent();
|
||||
for (i = 0; i < aNbPBP; ++i) {
|
||||
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
|
||||
//
|
||||
aItPB.Initialize(aLPB);
|
||||
for (; aItPB.More(); aItPB.Next()) {
|
||||
Handle(BOPDS_PaveBlock) aPB = aItPB.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
|
||||
bCB = !aCB.IsNull();
|
||||
if (bCB) {
|
||||
aPB = aCB->PaveBlock1();
|
||||
}
|
||||
for (; aItPB.More(); aItPB.Next())
|
||||
anAllPBs.Append(aItPB.Value());
|
||||
}
|
||||
|
||||
// Process all pave blocks
|
||||
aItPB.Initialize(anAllPBs);
|
||||
for (; aItPB.More(); aItPB.Next())
|
||||
{
|
||||
Handle(BOPDS_PaveBlock) aPB = aItPB.Value();
|
||||
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
|
||||
bCB = !aCB.IsNull();
|
||||
if (bCB) {
|
||||
aPB = aCB->PaveBlock1();
|
||||
}
|
||||
//
|
||||
if (aMPB.Add(aPB)) {
|
||||
bRebuild = Standard_False;
|
||||
aPB->Indices(nV[0], nV[1]);
|
||||
aPB->Range(aT[0], aT[1]);
|
||||
// remember the fact if the edge had different vertices before substitution
|
||||
Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
|
||||
//
|
||||
if (aMPB.Add(aPB)) {
|
||||
bRebuild = Standard_False;
|
||||
aPB->Indices(nV[0], nV[1]);
|
||||
aPB->Range(aT[0], aT[1]);
|
||||
// remember the fact if the edge had different vertices before substitution
|
||||
Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
|
||||
//
|
||||
for (j = 0; j < 2; ++j) {
|
||||
if (aDMNewSD.IsBound(nV[j])) {
|
||||
BOPDS_Pave aPave;
|
||||
//
|
||||
nV[j] = aDMNewSD.Find(nV[j]);
|
||||
aPave.SetIndex(nV[j]);
|
||||
aPave.SetParameter(aT[j]);
|
||||
//
|
||||
bRebuild = Standard_True;
|
||||
if (!j) {
|
||||
aPB->SetPave1(aPave);
|
||||
}
|
||||
else {
|
||||
aPB->SetPave2(aPave);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (bRebuild) {
|
||||
Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag();
|
||||
if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
|
||||
// now edge has the same vertex on both ends;
|
||||
// check if it is not a regular closed curve.
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge()));
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0]));
|
||||
Standard_Real aLength = IntTools::Length(aE);
|
||||
Standard_Real aTolV = BRep_Tool::Tolerance(aV);
|
||||
if (aLength <= aTolV * 2.) {
|
||||
// micro edge, so mark it for removal
|
||||
aMicroEdges.Add(aPB->Edge());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nSp = SplitEdge(aPB->OriginalEdge(), nV[0], aT[0], nV[1], aT[1]);
|
||||
if (bCB) {
|
||||
aCB->SetEdge(nSp);
|
||||
for (j = 0; j < 2; ++j) {
|
||||
if (aDMNewSD.IsBound(nV[j])) {
|
||||
BOPDS_Pave aPave;
|
||||
//
|
||||
nV[j] = aDMNewSD.Find(nV[j]);
|
||||
aPave.SetIndex(nV[j]);
|
||||
aPave.SetParameter(aT[j]);
|
||||
//
|
||||
bRebuild = Standard_True;
|
||||
if (!j) {
|
||||
aPB->SetPave1(aPave);
|
||||
}
|
||||
else {
|
||||
aPB->SetEdge(nSp);
|
||||
aPB->SetPave2(aPave);
|
||||
}
|
||||
}// if (bRebuild) {
|
||||
}// if (aMPB.Add(aPB)) {
|
||||
}// for (; aItPB.More(); aItPB.Next()) {
|
||||
}// for (i=0; i<aNbPBP; ++i) {
|
||||
}
|
||||
}
|
||||
//
|
||||
if (bRebuild) {
|
||||
Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag();
|
||||
if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
|
||||
// now edge has the same vertex on both ends;
|
||||
// check if it is not a regular closed curve.
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge()));
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0]));
|
||||
Standard_Real aLength = IntTools::Length(aE);
|
||||
Standard_Real aTolV = BRep_Tool::Tolerance(aV);
|
||||
if (aLength <= aTolV * 2.) {
|
||||
// micro edge, so mark it for removal
|
||||
aMicroEdges.Add(aPB->Edge());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nSp = SplitEdge(aPB->Edge(), nV[0], aT[0], nV[1], aT[1]);
|
||||
if (bCB)
|
||||
aCB->SetEdge(nSp);
|
||||
else
|
||||
aPB->SetEdge(nSp);
|
||||
}// if (bRebuild) {
|
||||
}// if (aMPB.Add(aPB)) {
|
||||
}// for (; aItPB.More(); aItPB.Next()) {
|
||||
aMPB.Clear();
|
||||
|
||||
if (aMicroEdges.Extent())
|
||||
@@ -2749,20 +2804,20 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
|
||||
Standard_Real aTolR3D = aFF.TolR3D();
|
||||
Standard_Real aTolReal = aFF.TolReal();
|
||||
Standard_Boolean bToReduce = aTolReal < aTolR3D;
|
||||
// tolerance of intersection has been increased, so process this intersection
|
||||
// tolerance of intersection has been increased, so process this intersection
|
||||
BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves();
|
||||
Standard_Integer aNbC = aVNC.Extent(), k;
|
||||
for (k = 0; k < aNbC; ++k) {
|
||||
Standard_Integer aNbC = aVNC.Extent(), k;
|
||||
for (k = 0; k < aNbC; ++k) {
|
||||
BOPDS_Curve& aNC = aVNC(k);
|
||||
BOPDS_ListOfPaveBlock& aLPB = aNC.ChangePaveBlocks();
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
for (; aItLPB.More(); ) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
Standard_Integer nE;
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
Standard_Integer nE;
|
||||
if (!aPB->HasEdge(nE)) {
|
||||
aLPB.Remove(aItLPB);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsReduced = Standard_False;
|
||||
if (bToReduce && (aPB->OriginalEdge() < 0)) {
|
||||
@@ -2775,13 +2830,13 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
|
||||
}
|
||||
}
|
||||
//
|
||||
// fill in the map vertex index - pave blocks
|
||||
for (Standard_Integer j=0; j < 2; j++) {
|
||||
// fill in the map vertex index - pave blocks
|
||||
for (Standard_Integer j=0; j < 2; j++) {
|
||||
Standard_Integer nV = (j == 0 ? aPB->Pave1().Index() : aPB->Pave2().Index());
|
||||
BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
|
||||
if (!pPBList) {
|
||||
pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
|
||||
}
|
||||
BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
|
||||
if (!pPBList) {
|
||||
pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
|
||||
}
|
||||
pPBList->Append(aPB);
|
||||
if (bIsReduced) {
|
||||
aMVIToReduce.Add(nV);
|
||||
|
@@ -258,7 +258,7 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
|
||||
}
|
||||
//
|
||||
if (iErr) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
|
||||
}
|
||||
//
|
||||
if (myFlag) {
|
||||
@@ -777,7 +777,7 @@ void BOPAlgo_PaveFiller::Prepare()
|
||||
TopAbs_EDGE,
|
||||
TopAbs_FACE
|
||||
};
|
||||
Standard_Boolean bJustAdd, bIsBasedOnPlane;
|
||||
Standard_Boolean bIsBasedOnPlane;
|
||||
Standard_Integer i, aNb, n1, nF, aNbF;
|
||||
TopExp_Explorer aExp;
|
||||
BOPCol_IndexedMapOfShape aMF;
|
||||
@@ -788,7 +788,7 @@ void BOPAlgo_PaveFiller::Prepare()
|
||||
for(i=0; i<aNb; ++i) {
|
||||
myIterator->Initialize(aType[i], aType[2]);
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(n1, nF, bJustAdd);
|
||||
myIterator->Value(n1, nF);
|
||||
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
|
||||
//
|
||||
bIsBasedOnPlane=IsBasedOnPlane(aF);
|
||||
|
@@ -95,7 +95,6 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
|
||||
Standard_Real aT1, aT2, aTS1, aTS2;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
@@ -104,10 +103,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
|
||||
//
|
||||
for (; myIterator->More(); myIterator->Next()) {
|
||||
myIterator->Value(nS[0], nS[1], bJustAdd);
|
||||
if(bJustAdd) {
|
||||
continue;
|
||||
}
|
||||
myIterator->Value(nS[0], nS[1]);
|
||||
//
|
||||
for (i=0; i < 2; ++i) {
|
||||
nE=nS[i];
|
||||
|
@@ -13,7 +13,6 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BOPAlgo_BuilderSolid.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Section.hxx>
|
||||
#include <BOPCol_DataMapOfShapeShape.hxx>
|
||||
@@ -31,7 +30,6 @@
|
||||
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
@@ -41,8 +39,6 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@@ -372,45 +368,3 @@ void BOPAlgo_Section::BuildSection()
|
||||
//
|
||||
myShape=aRC;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BOPAlgo_Section::Generated
|
||||
(const TopoDS_Shape& theS)
|
||||
{
|
||||
myHistShapes.Clear();
|
||||
if (theS.IsNull()) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
TopAbs_ShapeEnum aType = theS.ShapeType();
|
||||
if (aType != TopAbs_FACE) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
Standard_Integer nS = myDS->Index(theS);
|
||||
if (nS < 0) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
if (!myDS->HasFaceInfo(nS)) {
|
||||
return myHistShapes;
|
||||
}
|
||||
//
|
||||
//collect section edges of the face theS
|
||||
Standard_Integer i, aNb, nSp;
|
||||
//
|
||||
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
|
||||
aNb = aMPBSc.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
|
||||
nSp = aPB->Edge();
|
||||
const TopoDS_Shape& aSp = myDS->Shape(nSp);
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
//
|
||||
return myHistShapes;
|
||||
}
|
||||
|
||||
|
@@ -43,46 +43,24 @@ public:
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT BOPAlgo_Section();
|
||||
Standard_EXPORT virtual ~BOPAlgo_Section();
|
||||
|
||||
//! Empty constructor
|
||||
//!
|
||||
//! protected methods
|
||||
Standard_EXPORT virtual ~BOPAlgo_Section();
|
||||
|
||||
//! Constructor with allocator
|
||||
Standard_EXPORT BOPAlgo_Section(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT virtual void BuildSection();
|
||||
|
||||
//! Returns the list of shapes generated from the
|
||||
//! shape theS.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Checks the data before performing the operation
|
||||
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
|
||||
|
||||
//! Performs calculations using prepared Filler
|
||||
//! object <thePF>
|
||||
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Combine the result of section operation
|
||||
Standard_EXPORT virtual void BuildSection();
|
||||
|
||||
//! Performs calculations using prepared Filler object <thePF>
|
||||
Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_Section_HeaderFile
|
||||
|
@@ -79,6 +79,22 @@ BOPAlgo_WireEdgeSet& BOPAlgo_WireSplitter::WES()
|
||||
return *myWES;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_WireSplitter::SetContext(const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
myContext = theContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(IntTools_Context)& BOPAlgo_WireSplitter::Context()
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: CheckData
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
@@ -103,6 +119,11 @@ void BOPAlgo_WireSplitter::Perform()
|
||||
return;
|
||||
}
|
||||
//
|
||||
// create a context
|
||||
if (myContext.IsNull()) {
|
||||
myContext = new IntTools_Context;
|
||||
}
|
||||
//
|
||||
MakeConnexityBlocks();
|
||||
MakeWires();
|
||||
}
|
||||
@@ -251,56 +272,59 @@ void BOPAlgo_WireSplitter::MakeConnexityBlocks()
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
class BOPAlgo_WS_ConnexityBlock {
|
||||
public:
|
||||
BOPAlgo_WS_ConnexityBlock() {};
|
||||
~BOPAlgo_WS_ConnexityBlock() {};
|
||||
|
||||
typedef BOPCol_NCVector<BOPTools_ConnexityBlock> \
|
||||
BOPTools_VectorOfConnexityBlock;
|
||||
void SetFace(const TopoDS_Face& theF) {
|
||||
myFace = theF;
|
||||
}
|
||||
|
||||
const TopoDS_Face& Face() const {
|
||||
return myFace;
|
||||
}
|
||||
|
||||
void SetConnexityBlock(const BOPTools_ConnexityBlock& theCB) {
|
||||
myCB = theCB;
|
||||
}
|
||||
|
||||
const BOPTools_ConnexityBlock& ConnexityBlock() const {
|
||||
return myCB;
|
||||
}
|
||||
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext = aContext;
|
||||
}
|
||||
//
|
||||
const Handle(IntTools_Context)& Context()const {
|
||||
return myContext;
|
||||
}
|
||||
|
||||
void Perform() {
|
||||
BOPAlgo_WireSplitter::SplitBlock(myFace, myCB, myContext);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : WireSplitterFunctor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_WireSplitterFunctor
|
||||
{
|
||||
protected:
|
||||
TopoDS_Face myFace;
|
||||
BOPTools_VectorOfConnexityBlock* myPVCB;
|
||||
BOPTools_ConnexityBlock myCB;
|
||||
Handle(IntTools_Context) myContext;
|
||||
};
|
||||
|
||||
typedef BOPCol_NCVector<BOPAlgo_WS_ConnexityBlock> \
|
||||
BOPAlgo_VectorOfConnexityBlock;
|
||||
//
|
||||
typedef BOPCol_ContextFunctor
|
||||
<BOPAlgo_WS_ConnexityBlock,
|
||||
BOPAlgo_VectorOfConnexityBlock,
|
||||
Handle(IntTools_Context),
|
||||
IntTools_Context> BOPAlgo_SplitBlockFunctor;
|
||||
//
|
||||
typedef BOPCol_ContextCnt
|
||||
<BOPAlgo_SplitBlockFunctor,
|
||||
BOPAlgo_VectorOfConnexityBlock,
|
||||
Handle(IntTools_Context)> BOPAlgo_SplitBlockCnt;
|
||||
|
||||
public:
|
||||
//
|
||||
BOPAlgo_WireSplitterFunctor(const TopoDS_Face& aF,
|
||||
BOPTools_VectorOfConnexityBlock& aVCB)
|
||||
: myFace(aF), myPVCB(&aVCB)
|
||||
{
|
||||
}
|
||||
//
|
||||
void operator()( const Standard_Integer& theIndex ) const
|
||||
{
|
||||
BOPTools_VectorOfConnexityBlock& aVCB = *myPVCB;
|
||||
BOPTools_ConnexityBlock& aCB = aVCB(theIndex);
|
||||
BOPAlgo_WireSplitter::SplitBlock(myFace, aCB);
|
||||
}
|
||||
};
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_WireSplitterCnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_WireSplitterCnt
|
||||
{
|
||||
public:
|
||||
//-------------------------------
|
||||
// Perform
|
||||
Standard_EXPORT
|
||||
static void Perform(const Standard_Boolean bRunParallel,
|
||||
const TopoDS_Face& aF,
|
||||
BOPTools_VectorOfConnexityBlock& aVCB)
|
||||
{
|
||||
//
|
||||
BOPAlgo_WireSplitterFunctor aWSF(aF, aVCB);
|
||||
Standard_Integer aNbVCB = aVCB.Extent();
|
||||
//
|
||||
OSD_Parallel::For(0, aNbVCB, aWSF, !bRunParallel);
|
||||
}
|
||||
};
|
||||
//=======================================================================
|
||||
//function : MakeWires
|
||||
//purpose :
|
||||
@@ -312,7 +336,9 @@ void BOPAlgo_WireSplitter::MakeWires()
|
||||
TopoDS_Wire aW;
|
||||
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPTools_VectorOfConnexityBlock aVCB;
|
||||
BOPAlgo_VectorOfConnexityBlock aVCB;
|
||||
//
|
||||
const TopoDS_Face& aF=myWES->Face();
|
||||
//
|
||||
aItCB.Initialize(myLCB);
|
||||
for (; aItCB.More(); aItCB.Next()) {
|
||||
@@ -324,18 +350,18 @@ void BOPAlgo_WireSplitter::MakeWires()
|
||||
myWES->AddShape(aW);
|
||||
}
|
||||
else {
|
||||
aVCB.Append(aCB);
|
||||
BOPAlgo_WS_ConnexityBlock& aWSCB = aVCB.Append1();
|
||||
aWSCB.SetFace(aF);
|
||||
aWSCB.SetConnexityBlock(aCB);
|
||||
}
|
||||
}
|
||||
//
|
||||
//===================================================
|
||||
BOPAlgo_SplitBlockCnt::Perform(myRunParallel, aVCB, myContext);
|
||||
//===================================================
|
||||
aNbVCB=aVCB.Extent();
|
||||
const TopoDS_Face& aF=myWES->Face();
|
||||
//===================================================
|
||||
BOPAlgo_WireSplitterCnt::Perform(myRunParallel, aF, aVCB);
|
||||
//===================================================
|
||||
for (k=0; k<aNbVCB; ++k) {
|
||||
const BOPTools_ConnexityBlock& aCB=aVCB(k);
|
||||
const BOPCol_ListOfShape& aLW=aCB.Loops();
|
||||
const BOPAlgo_WS_ConnexityBlock& aCB=aVCB(k);
|
||||
const BOPCol_ListOfShape& aLW=aCB.ConnexityBlock().Loops();
|
||||
aIt.Initialize(aLW);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aWx=aIt.Value();
|
||||
|
@@ -25,12 +25,12 @@
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPTools_ConnexityBlock.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
class BOPAlgo_WireEdgeSet;
|
||||
class TopoDS_Wire;
|
||||
class TopoDS_Face;
|
||||
|
||||
|
||||
|
||||
class BOPAlgo_WireSplitter : public BOPAlgo_Algo
|
||||
{
|
||||
public:
|
||||
@@ -39,50 +39,44 @@ public:
|
||||
|
||||
|
||||
Standard_EXPORT BOPAlgo_WireSplitter();
|
||||
Standard_EXPORT virtual ~BOPAlgo_WireSplitter();
|
||||
Standard_EXPORT virtual ~BOPAlgo_WireSplitter();
|
||||
|
||||
Standard_EXPORT BOPAlgo_WireSplitter(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT void SetWES (const BOPAlgo_WireEdgeSet& theWES);
|
||||
|
||||
Standard_EXPORT BOPAlgo_WireEdgeSet& WES();
|
||||
|
||||
|
||||
//! Sets the context for the algorithm
|
||||
Standard_EXPORT void SetContext(const Handle(IntTools_Context)& theContext);
|
||||
|
||||
//! Returns the context
|
||||
Standard_EXPORT const Handle(IntTools_Context)& Context();
|
||||
|
||||
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
|
||||
|
||||
static void MakeWire (BOPCol_ListOfShape& theLE, TopoDS_Wire& theW);
|
||||
static void MakeWire(BOPCol_ListOfShape& theLE, TopoDS_Wire& theW);
|
||||
|
||||
Standard_EXPORT static void SplitBlock (const TopoDS_Face& theF, BOPTools_ConnexityBlock& theCB);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void SplitBlock (const TopoDS_Face& theF,
|
||||
BOPTools_ConnexityBlock& theCB,
|
||||
const Handle(IntTools_Context)& theContext);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void MakeConnexityBlocks();
|
||||
|
||||
Standard_EXPORT void MakeWires();
|
||||
|
||||
|
||||
BOPAlgo_PWireEdgeSet myWES;
|
||||
BOPTools_ListOfConnexityBlock myLCB;
|
||||
|
||||
Handle(IntTools_Context) myContext;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <BOPAlgo_WireSplitter.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_WireSplitter_HeaderFile
|
||||
|
@@ -62,7 +62,8 @@ static
|
||||
const TopoDS_Edge& anEdge,
|
||||
const TopoDS_Face& myFace,
|
||||
const GeomAdaptor_Surface& aGAS,
|
||||
const Standard_Boolean aFlag);
|
||||
const Standard_Boolean aFlag,
|
||||
const Handle(IntTools_Context)& theContext);
|
||||
|
||||
static
|
||||
void GetNextVertex(const TopoDS_Vertex& aV,
|
||||
@@ -121,14 +122,16 @@ static
|
||||
static
|
||||
void RefineAngles(const TopoDS_Face& myFace,
|
||||
const BOPCol_ListOfShape&,
|
||||
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo&);
|
||||
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo&,
|
||||
const Handle(IntTools_Context)&);
|
||||
|
||||
|
||||
static
|
||||
void RefineAngles(const TopoDS_Vertex& ,
|
||||
const TopoDS_Face& ,
|
||||
const BOPCol_MapOfShape& ,
|
||||
BOPAlgo_ListOfEdgeInfo& );
|
||||
BOPAlgo_ListOfEdgeInfo&,
|
||||
const Handle(IntTools_Context)&);
|
||||
|
||||
static
|
||||
Standard_Boolean RefineAngle2D(const TopoDS_Vertex& ,
|
||||
@@ -136,14 +139,17 @@ static
|
||||
const TopoDS_Face& ,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
Standard_Real& );
|
||||
const Standard_Real,
|
||||
Standard_Real& ,
|
||||
const Handle(IntTools_Context)& );
|
||||
|
||||
//=======================================================================
|
||||
//function : SplitBlock
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
BOPTools_ConnexityBlock& aCB)
|
||||
BOPTools_ConnexityBlock& aCB,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bNothingToDo, bIsClosed, bIsIN;
|
||||
Standard_Integer aIx, aNb, i, aCntIn, aCntOut;
|
||||
@@ -287,7 +293,7 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
}
|
||||
//
|
||||
// 3. Angles in mySmartMap
|
||||
BRepAdaptor_Surface aBAS(myFace);
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(myFace);
|
||||
const GeomAdaptor_Surface& aGAS=aBAS.Surface();
|
||||
//
|
||||
for (i=1; i<=aNb; i++) {
|
||||
@@ -302,15 +308,15 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
bIsIN = aEI.IsIn();
|
||||
aOr = bIsIN ? TopAbs_REVERSED : TopAbs_FORWARD;
|
||||
aVV.Orientation(aOr);
|
||||
aAngle = Angle2D(aVV, aE, myFace, aGAS, bIsIN);
|
||||
aAngle = Angle2D(aVV, aE, myFace, aGAS, bIsIN, theContext);
|
||||
aEI.SetAngle(aAngle);
|
||||
}
|
||||
}// for (i=1; i<=aNb; i++) {
|
||||
//
|
||||
//Theme: The treatment p-curves convergent in node.
|
||||
//The refining the angles of p-curves taking into account
|
||||
//bounging curves if exist.
|
||||
RefineAngles(myFace, myEdges, mySmartMap);
|
||||
//bounding curves if exist.
|
||||
RefineAngles(myFace, myEdges, mySmartMap, theContext);
|
||||
//
|
||||
// 4. Do
|
||||
//
|
||||
@@ -404,13 +410,11 @@ void Path (const GeomAdaptor_Surface& aGAS,
|
||||
aTol2D2 = aTol2D * aTol2D;
|
||||
//
|
||||
bIsClosed = aVertMap.Find(aVb);
|
||||
//
|
||||
aNb=aLS.Length();
|
||||
if (aNb>0) {
|
||||
//
|
||||
{
|
||||
BOPCol_ListOfShape aBuf;
|
||||
//
|
||||
for (i=aNb; i>0; --i) {
|
||||
aNb = aLS.Length();
|
||||
for (i = aNb; i>0; --i) {
|
||||
const TopoDS_Shape& aVPrev=aVertVa(i);
|
||||
const gp_Pnt2d& aPaPrev=aCoordVa(i);
|
||||
const TopoDS_Shape& aEPrev=aLS(i);
|
||||
@@ -490,6 +494,7 @@ void Path (const GeomAdaptor_Surface& aGAS,
|
||||
anAngleIn = AngleIn(aEOuta, aLEInfo);
|
||||
aMinAngle = 100.;
|
||||
anIsFound = Standard_False;
|
||||
Standard_Integer iCnt = NbWaysOut(aLEInfo);
|
||||
Standard_Integer aCurIndexE = 0;
|
||||
anIt.Initialize(aLEInfo);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
@@ -503,8 +508,6 @@ void Path (const GeomAdaptor_Surface& aGAS,
|
||||
//
|
||||
// Is there one way to go out of the vertex
|
||||
// we have to use it only.
|
||||
Standard_Integer iCnt;
|
||||
iCnt=NbWaysOut (aLEInfo);
|
||||
//
|
||||
if (!iCnt) {
|
||||
// no way to go . (Error)
|
||||
@@ -712,7 +715,8 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
const TopoDS_Edge& anEdge,
|
||||
const TopoDS_Face& myFace,
|
||||
const GeomAdaptor_Surface& aGAS,
|
||||
const Standard_Boolean bIsIN)
|
||||
const Standard_Boolean bIsIN,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle, aTX;
|
||||
gp_Pnt2d aPV, aPV1;
|
||||
@@ -725,7 +729,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools2D::CurveOnSurface (anEdge, myFace, aC2D,
|
||||
aFirst, aLast, aToler);
|
||||
aFirst, aLast, aToler, theContext);
|
||||
Standard_Real tol2d =2.*Tolerance2D(aV, aGAS);
|
||||
//
|
||||
GeomAbs_CurveType aType;
|
||||
@@ -849,7 +853,8 @@ Standard_Real VTolerance2D (const TopoDS_Vertex& aV,
|
||||
//=======================================================================
|
||||
void RefineAngles(const TopoDS_Face& myFace,
|
||||
const BOPCol_ListOfShape& myEdges,
|
||||
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap)
|
||||
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Integer aNb, i;
|
||||
BOPCol_IndexedDataMapOfShapeInteger aMSI;
|
||||
@@ -886,7 +891,7 @@ void RefineAngles(const TopoDS_Face& myFace,
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&mySmartMap.FindKey(i));
|
||||
BOPAlgo_ListOfEdgeInfo& aLEI=mySmartMap(i);
|
||||
//
|
||||
RefineAngles(aV, myFace, aMBE, aLEI);
|
||||
RefineAngles(aV, myFace, aMBE, aLEI, theContext);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -903,7 +908,8 @@ typedef BOPCol_DataMapOfShapeReal::Iterator \
|
||||
void RefineAngles(const TopoDS_Vertex& aV,
|
||||
const TopoDS_Face& myFace,
|
||||
const BOPCol_MapOfShape& aMBE,
|
||||
BOPAlgo_ListOfEdgeInfo& aLEI)
|
||||
BOPAlgo_ListOfEdgeInfo& aLEI,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bIsIn, bIsBoundary, bRefined;
|
||||
Standard_Integer iCntBnd, iCntInt;
|
||||
@@ -911,8 +917,8 @@ void RefineAngles(const TopoDS_Vertex& aV,
|
||||
BOPCol_DataMapOfShapeReal aDMSR;
|
||||
BOPAlgo_ListIteratorOfListOfEdgeInfo aItLEI;
|
||||
//
|
||||
aA1=0.;
|
||||
aA2=0.;
|
||||
aA1=0.; // angle of outgoing edge
|
||||
aA2=0.; // angle of incoming edge
|
||||
iCntBnd=0;
|
||||
iCntInt=0;
|
||||
aItLEI.Initialize(aLEI);
|
||||
@@ -928,7 +934,7 @@ void RefineAngles(const TopoDS_Vertex& aV,
|
||||
aA1=aA;
|
||||
}
|
||||
else {
|
||||
aA2=aA+M_PI;
|
||||
aA2=aA;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -940,6 +946,7 @@ void RefineAngles(const TopoDS_Vertex& aV,
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Real aDelta = ClockWiseAngle(aA2, aA1);
|
||||
aItLEI.Initialize(aLEI);
|
||||
for (; aItLEI.More(); aItLEI.Next()) {
|
||||
BOPAlgo_EdgeInfo& aEI=aItLEI.ChangeValue();
|
||||
@@ -952,11 +959,12 @@ void RefineAngles(const TopoDS_Vertex& aV,
|
||||
}
|
||||
//
|
||||
aA=aEI.Angle();
|
||||
if (aA>aA1 && aA<aA2) {
|
||||
continue;
|
||||
Standard_Real aDA = ClockWiseAngle(aA2, aA);
|
||||
if (aDA < aDelta) {
|
||||
continue; // already inside
|
||||
}
|
||||
//
|
||||
bRefined=RefineAngle2D(aV, aE, myFace, aA1, aA2, aA);
|
||||
bRefined=RefineAngle2D(aV, aE, myFace, aA1, aA2, aDelta, aA, theContext);
|
||||
if (bRefined) {
|
||||
aDMSR.Bind(aE, aA);
|
||||
}
|
||||
@@ -999,7 +1007,9 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
const TopoDS_Face& myFace,
|
||||
const Standard_Real aA1,
|
||||
const Standard_Real aA2,
|
||||
Standard_Real& aA)
|
||||
const Standard_Real aDelta,
|
||||
Standard_Real& aA,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, j, aNbP;
|
||||
@@ -1016,7 +1026,7 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
aCf=0.01;
|
||||
aTolInt=1.e-10;
|
||||
//
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aT1, aT2, aTol);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aT1, aT2, aTol, theContext);
|
||||
aGAC1.Load(aC2D, aT1, aT2);
|
||||
//
|
||||
aTV=BRep_Tool::Parameter (aV, aE, myFace);
|
||||
@@ -1024,12 +1034,13 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
//
|
||||
aTOp = (fabs(aTV-aT1) < fabs(aTV-aT2)) ? aT2 : aT1;
|
||||
//
|
||||
const Standard_Real MaxDT = 0.3 * (aT2 - aT1);
|
||||
aGAC1.D0(aT1, aP1);
|
||||
aGAC1.D0(aT2, aP2);
|
||||
aDomain1.SetValues(aP1, aT1, aTolInt, aP2, aT2, aTolInt);
|
||||
//
|
||||
for (i=0; i<2; ++i) {
|
||||
aAi=(!i) ? aA1 : aA2;
|
||||
aAi=(!i) ? aA1 : (aA2 + M_PI);
|
||||
aXi=cos(aAi);
|
||||
aYi=sin(aAi);
|
||||
gp_Dir2d aDiri(aXi, aYi);
|
||||
@@ -1042,39 +1053,38 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aNbP=aGInter.NbPoints();
|
||||
if (aNbP<2) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aT1max=aTV;
|
||||
aT2max=-1.;
|
||||
for (j=1; j<=aNbP; ++j) {
|
||||
const IntRes2d_IntersectionPoint& aIPj=aGInter.Point(j);
|
||||
aT1j=aIPj.ParamOnFirst();
|
||||
aT2j=aIPj.ParamOnSecond();
|
||||
aNbP = aGInter.NbPoints();
|
||||
aT1max = aTV;
|
||||
aT2max = -1.;
|
||||
for (j = 1; j <= aNbP; ++j) {
|
||||
const IntRes2d_IntersectionPoint& aIPj = aGInter.Point(j);
|
||||
aT1j = aIPj.ParamOnFirst();
|
||||
aT2j = aIPj.ParamOnSecond();
|
||||
//
|
||||
if (aT2j > aT2max) {
|
||||
aT2max=aT2j;
|
||||
aT1max=aT1j;
|
||||
if (aT2j > aT2max && Abs(aT1j - aTV) < MaxDT) {
|
||||
aT2max = aT2j;
|
||||
aT1max = aT1j;
|
||||
}
|
||||
}
|
||||
//
|
||||
dT = aTOp - aT1max;
|
||||
if (Abs(dT) < aTolInt) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aT=aT1max + aCf*dT;
|
||||
aGAC1.D0(aT, aP);
|
||||
gp_Vec2d aV2D(aPV, aP);
|
||||
gp_Dir2d aDir2D(aV2D);
|
||||
//
|
||||
aAngle=Angle(aDir2D);
|
||||
if (aAngle>aA1 && aAngle<aA2) {
|
||||
aA=aAngle;
|
||||
return bRet;
|
||||
if (aT2max > 0) {
|
||||
dT = aTOp - aT1max;
|
||||
if (Abs(dT) < aTolInt) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aT = aT1max + aCf*dT;
|
||||
aGAC1.D0(aT, aP);
|
||||
gp_Vec2d aV2D(aPV, aP);
|
||||
gp_Dir2d aDir2D(aV2D);
|
||||
//
|
||||
aAngle = Angle(aDir2D);
|
||||
Standard_Real aDA = ClockWiseAngle(aA2, aAngle);
|
||||
if (aDA < aDelta) {
|
||||
aA = aAngle;
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
}// for (i=0; i<2; ++i) {
|
||||
return !bRet;
|
||||
}
|
||||
}
|
@@ -21,6 +21,7 @@ BOPAlgo_BuilderSolid.cxx
|
||||
BOPAlgo_BuilderSolid.hxx
|
||||
BOPAlgo_CheckerSI.cxx
|
||||
BOPAlgo_CheckerSI.hxx
|
||||
BOPAlgo_CheckerSI_1.cxx
|
||||
BOPAlgo_CheckResult.cxx
|
||||
BOPAlgo_CheckResult.hxx
|
||||
BOPAlgo_CheckStatus.hxx
|
||||
@@ -42,7 +43,6 @@ BOPAlgo_PaveFiller_7.cxx
|
||||
BOPAlgo_PaveFiller_8.cxx
|
||||
BOPAlgo_PaveFiller_9.cxx
|
||||
BOPAlgo_PaveFiller_10.cxx
|
||||
BOPAlgo_PaveFiller_11.cxx
|
||||
BOPAlgo_PBOP.hxx
|
||||
BOPAlgo_PBuilder.hxx
|
||||
BOPAlgo_PPaveFiller.hxx
|
||||
@@ -65,3 +65,4 @@ BOPAlgo_WireSplitter.lxx
|
||||
BOPAlgo_WireSplitter_1.cxx
|
||||
BOPAlgo_CellsBuilder.cxx
|
||||
BOPAlgo_CellsBuilder.hxx
|
||||
BOPAlgo_GlueEnum.hxx
|
@@ -19,13 +19,12 @@
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
#include <BOPDS_CommonBlock.hxx>
|
||||
#include <BOPDS_DataMapOfPassKeyListOfPaveBlock.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_FaceInfo.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_MapOfPave.hxx>
|
||||
#include <BOPDS_MapOfPaveBlock.hxx>
|
||||
#include <BOPDS_PassKey.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_PaveBlock.hxx>
|
||||
#include <BOPDS_ShapeInfo.hxx>
|
||||
#include <BOPDS_VectorOfPave.hxx>
|
||||
@@ -256,6 +255,7 @@ Standard_Integer BOPDS_DS::Append(const BOPDS_ShapeInfo& theSI)
|
||||
//
|
||||
myLines.Append1()=theSI;
|
||||
iX=myLines.Extent()-1;
|
||||
myMapShapeIndex.Bind(theSI.Shape(), iX);
|
||||
//
|
||||
return iX;
|
||||
}
|
||||
@@ -269,6 +269,7 @@ Standard_Integer BOPDS_DS::Append(const TopoDS_Shape& theS)
|
||||
//
|
||||
myLines.Append1().SetShape(theS);
|
||||
iX=myLines.Extent()-1;
|
||||
myMapShapeIndex.Bind(theS, iX);
|
||||
return iX;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -358,20 +359,18 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
|
||||
aAllocator=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
BOPCol_DataMapOfShapeInteger& aMSI=myMapShapeIndex;
|
||||
//
|
||||
i1=0;
|
||||
i2=0;
|
||||
aIt.Initialize(myArguments);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
if (aMSI.IsBound(aS)) {
|
||||
if (myMapShapeIndex.IsBound(aS)) {
|
||||
continue;
|
||||
}
|
||||
aI=Append(aS);
|
||||
aMSI.Bind(aS, aI);
|
||||
//
|
||||
InitShape(aI, aS, aAllocator, aMSI);
|
||||
InitShape(aI, aS);
|
||||
//
|
||||
i2=NbShapes()-1;
|
||||
aR.SetIndices(i1, i2);
|
||||
@@ -658,9 +657,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
|
||||
//=======================================================================
|
||||
void BOPDS_DS::InitShape
|
||||
(const Standard_Integer aI,
|
||||
const TopoDS_Shape& aS,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
BOPCol_DataMapOfShapeInteger& aMSI)
|
||||
const TopoDS_Shape& aS)
|
||||
{
|
||||
Standard_Integer aIx;
|
||||
TopoDS_Iterator aIt;
|
||||
@@ -670,7 +667,7 @@ void BOPDS_DS::InitShape
|
||||
aSI.SetShapeType(aS.ShapeType());
|
||||
BOPCol_ListOfInteger& aLI=aSI.ChangeSubShapes();
|
||||
//
|
||||
BOPCol_MapOfInteger aM(100, theAllocator);
|
||||
BOPCol_MapOfInteger aM;
|
||||
//
|
||||
aIt1.Initialize(aLI);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
@@ -680,15 +677,10 @@ void BOPDS_DS::InitShape
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
if (aMSI.IsBound(aSx)) {
|
||||
aIx=aMSI.Find(aSx);
|
||||
}
|
||||
else {
|
||||
aIx=Append(aSx);
|
||||
aMSI.Bind(aSx, aIx);
|
||||
}
|
||||
const Standard_Integer* pIx = myMapShapeIndex.Seek(aSx);
|
||||
aIx = (pIx ? *pIx : Append(aSx));
|
||||
//
|
||||
InitShape(aIx, aSx, theAllocator, aMSI);
|
||||
InitShape(aIx, aSx);
|
||||
//
|
||||
if (aM.Add(aIx)) {
|
||||
aLI.Append(aIx);
|
||||
@@ -704,14 +696,14 @@ Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI) const
|
||||
{
|
||||
Standard_Integer n1, n2;
|
||||
Standard_Boolean bRet;
|
||||
BOPDS_MapIteratorMapOfPassKey aIt;
|
||||
BOPDS_MapIteratorOfMapOfPair aIt;
|
||||
//
|
||||
bRet = Standard_False;
|
||||
//
|
||||
aIt.Initialize(myInterfTB);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const BOPDS_PassKey& aPK = aIt.Value();
|
||||
aPK.Ids(n1, n2);
|
||||
const BOPDS_Pair& aPK = aIt.Value();
|
||||
aPK.Indices(n1, n2);
|
||||
if (n1 == theI || n2 == theI) {
|
||||
bRet = Standard_True;
|
||||
break;
|
||||
@@ -1012,12 +1004,12 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
|
||||
{
|
||||
Standard_Integer nE, iRef, n1, n2;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB, aItPBN;
|
||||
BOPDS_DataMapIteratorOfDataMapOfPassKeyListOfPaveBlock aItMPKLPB;
|
||||
BOPDS_ListOfPaveBlock aLPBN;
|
||||
BOPDS_DataMapOfPassKeyListOfPaveBlock aMPKLPB;
|
||||
NCollection_DataMap<BOPDS_Pair, BOPDS_ListOfPaveBlock, BOPDS_PairMapHasher> aMPKLPB;
|
||||
NCollection_DataMap<BOPDS_Pair, BOPDS_ListOfPaveBlock, BOPDS_PairMapHasher>::Iterator aItMPKLPB;
|
||||
Handle(BOPDS_PaveBlock) aPB;
|
||||
Handle(BOPDS_CommonBlock) aCBx;
|
||||
BOPDS_PassKey aPK;
|
||||
BOPDS_Pair aPK;
|
||||
//
|
||||
const BOPDS_ListOfPaveBlock& aLPBCB=theCB->PaveBlocks();
|
||||
if (!aLPBCB.First()->IsToUpdate()){
|
||||
@@ -1050,7 +1042,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
|
||||
aLPB.Append(aPBN);
|
||||
//
|
||||
aPBN->Indices(n1, n2);
|
||||
aPK.SetIds(n1, n2);
|
||||
aPK.SetIndices(n1, n2);
|
||||
if (aMPKLPB.IsBound(aPK)) {
|
||||
BOPDS_ListOfPaveBlock& aLPBx=aMPKLPB.ChangeFind(aPK);
|
||||
aLPBx.Append(aPBN);
|
||||
@@ -1061,7 +1053,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
|
||||
aMPKLPB.Bind(aPK, aLPBx);
|
||||
}
|
||||
}
|
||||
aLPB.Remove(aItPB);
|
||||
aLPB.Remove(aItPB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <BOPDS_VectorOfFaceInfo.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_VectorOfInterfVV.hxx>
|
||||
#include <BOPDS_VectorOfInterfVE.hxx>
|
||||
#include <BOPDS_VectorOfInterfVF.hxx>
|
||||
@@ -431,7 +431,7 @@ Standard_EXPORT virtual ~BOPDS_DS();
|
||||
//! Returns the table of interferences
|
||||
//!
|
||||
//! debug
|
||||
const BOPDS_MapOfPassKey& Interferences() const;
|
||||
const BOPDS_MapOfPair& Interferences() const;
|
||||
|
||||
Standard_EXPORT void Dump() const;
|
||||
|
||||
@@ -472,7 +472,7 @@ protected:
|
||||
//! Initializes the state of face with index theIndex
|
||||
Standard_EXPORT void InitFaceInfo (const Standard_Integer theIndex);
|
||||
|
||||
Standard_EXPORT void InitShape (const Standard_Integer theIndex, const TopoDS_Shape& theS, const BOPCol_BaseAllocator& theAllocator, BOPCol_DataMapOfShapeInteger& theMSI);
|
||||
Standard_EXPORT void InitShape (const Standard_Integer theIndex, const TopoDS_Shape& theS);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCoincidence (const Handle(BOPDS_PaveBlock)& thePB1,
|
||||
const Handle(BOPDS_PaveBlock)& thePB2,
|
||||
@@ -495,7 +495,7 @@ protected:
|
||||
BOPDS_VectorOfFaceInfo myFaceInfoPool;
|
||||
BOPCol_DataMapOfIntegerInteger myShapesSD;
|
||||
BOPCol_DataMapOfIntegerListOfInteger myMapVE;
|
||||
BOPDS_MapOfPassKey myInterfTB;
|
||||
BOPDS_MapOfPair myInterfTB;
|
||||
BOPDS_VectorOfInterfVV myInterfVV;
|
||||
BOPDS_VectorOfInterfVE myInterfVE;
|
||||
BOPDS_VectorOfInterfVF myInterfVF;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BOPDS_PassKey.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
//=======================================================================
|
||||
//function : InterfVV
|
||||
//purpose :
|
||||
@@ -107,9 +107,7 @@ inline Standard_Integer BOPDS_DS::NbInterfTypes()
|
||||
inline void BOPDS_DS::AddInterf(const Standard_Integer theI1,
|
||||
const Standard_Integer theI2)
|
||||
{
|
||||
BOPDS_PassKey aPK;
|
||||
//
|
||||
aPK.SetIds(theI1, theI2);
|
||||
BOPDS_Pair aPK(theI1, theI2);
|
||||
myInterfTB.Add(aPK);
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -120,16 +118,14 @@ inline Standard_Boolean BOPDS_DS::HasInterf
|
||||
(const Standard_Integer theI1,
|
||||
const Standard_Integer theI2)const
|
||||
{
|
||||
BOPDS_PassKey aPK;
|
||||
//
|
||||
aPK.SetIds(theI1, theI2);
|
||||
BOPDS_Pair aPK(theI1, theI2);
|
||||
return myInterfTB.Contains(aPK);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Interferences
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const
|
||||
inline const BOPDS_MapOfPair& BOPDS_DS::Interferences()const
|
||||
{
|
||||
return myInterfTB;
|
||||
}
|
||||
|
@@ -23,17 +23,13 @@
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
#include <BOPDS_MapOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPDS_TreeSelector
|
||||
@@ -195,8 +191,11 @@ void BOPDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
|
||||
myLength=0;
|
||||
iX=BOPDS_Tools::TypeToInteger(aType1, aType2);
|
||||
if (iX>=0) {
|
||||
myIterator.Initialize(myLists(iX));
|
||||
myLength=myLists(iX).Extent();
|
||||
// sort interfering pairs for constant order of intersection
|
||||
std::stable_sort(myLists(iX).begin(), myLists(iX).end());
|
||||
// initialize iterator to access the pairs
|
||||
myIterator.Init(myLists(iX));
|
||||
myLength = myLists(iX).Extent();
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -219,15 +218,13 @@ void BOPDS_Iterator::Next()
|
||||
// function: Value
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_Iterator::Value
|
||||
(Standard_Integer& theI1,
|
||||
Standard_Integer& theI2,
|
||||
Standard_Boolean& theWithSubShape) const
|
||||
void BOPDS_Iterator::Value(Standard_Integer& theI1,
|
||||
Standard_Integer& theI2) const
|
||||
{
|
||||
Standard_Integer iT1, iT2, n1, n2;
|
||||
//
|
||||
const BOPDS_PassKeyBoolean& aPKB=myIterator.Value();
|
||||
aPKB.Ids(n1, n2);
|
||||
const BOPDS_Pair& aPair = myIterator.Value();
|
||||
aPair.Indices(n1, n2);
|
||||
//
|
||||
iT1=(Standard_Integer)(myDS->ShapeInfo(n1).ShapeType());
|
||||
iT2=(Standard_Integer)(myDS->ShapeInfo(n2).ShapeType());
|
||||
@@ -238,8 +235,6 @@ void BOPDS_Iterator::Value
|
||||
theI1=n2;
|
||||
theI2=n1;
|
||||
}
|
||||
//
|
||||
theWithSubShape=aPKB.Flag();
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Prepare
|
||||
@@ -267,33 +262,24 @@ void BOPDS_Iterator::Prepare()
|
||||
//=======================================================================
|
||||
void BOPDS_Iterator::Intersect()
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer aNb, i, aNbR, iTi, iTj;
|
||||
Standard_Integer i1, i2, aNbSD, iX, j, iR;
|
||||
Standard_Integer i, j, iX, i1, i2, iR, aNb, aNbR;
|
||||
Standard_Integer iTi, iTj;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
|
||||
BOPDS_PassKeyBoolean aPKXB;
|
||||
//
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
aNb=myDS->NbSourceShapes();
|
||||
BOPDS_VectorOfTSR aVTSR(aNb, aAllocator);
|
||||
aNb = myDS->NbSourceShapes();
|
||||
BOPDS_VectorOfTSR aVTSR(aNb);
|
||||
//
|
||||
for (i=0; i<aNb; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
bFlag=aSI.IsInterfering();
|
||||
Standard_Boolean bHasBrep = aSI.IsInterfering() && !(aSI.ShapeType() == TopAbs_SOLID);
|
||||
//
|
||||
BOPDS_TSR& aTSR=aVTSR.Append1();
|
||||
//
|
||||
aTSR.SetHasBRep(bFlag);
|
||||
if (!bFlag) {
|
||||
aTSR.SetHasBRep(bHasBrep);
|
||||
if (!bHasBrep) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -310,68 +296,57 @@ void BOPDS_Iterator::Intersect()
|
||||
BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
|
||||
//===========================================
|
||||
//
|
||||
aNbR=myDS->NbRanges()-1;
|
||||
for (iR=0; iR<aNbR; ++iR) {
|
||||
const BOPDS_IndexRange& aR=myDS->Range(iR);
|
||||
i1=aR.First();
|
||||
i2=aR.Last();
|
||||
for (i=i1; i<=i2; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
//
|
||||
aNbR = myDS->NbRanges() - 1;
|
||||
for (iR = 0; iR < aNbR; ++iR) {
|
||||
const BOPDS_IndexRange& aR = myDS->Range(iR);
|
||||
i1 = aR.First();
|
||||
i2 = aR.Last();
|
||||
for (i = i1; i <= i2; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
//
|
||||
if (!aSI.IsInterfering()){
|
||||
if (!aSI.IsInterfering() || (aSI.ShapeType() == TopAbs_SOLID)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aTi=aSI.ShapeType();
|
||||
const Bnd_Box& aBoxi=aSI.Box();
|
||||
//
|
||||
BOPDS_TSR& aTSRi=aVTSR(i);
|
||||
const BOPCol_ListOfInteger& aLI=aTSRi.Indices();
|
||||
aNbSD=aLI.Extent();
|
||||
if (!aNbSD){
|
||||
BOPDS_TSR& aTSRi = aVTSR(i);
|
||||
const BOPCol_ListOfInteger& aLI = aTSRi.Indices();
|
||||
Standard_Integer aNbSD = aLI.Extent();
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aIt.Initialize(aLI);
|
||||
aTi = aSI.ShapeType();
|
||||
iTi = BOPDS_Tools::TypeToInteger(aTi);
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfInteger aIt(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
j=aIt.Value(); // DS index
|
||||
if (j>=i1 && j<=i2) {
|
||||
j = aIt.Value(); // DS index
|
||||
if (j >= i1 && j <= i2) {
|
||||
continue;// same range
|
||||
}
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSIj=myDS->ShapeInfo(j);
|
||||
aTj=aSIj.ShapeType();
|
||||
iTi=BOPDS_Tools::TypeToInteger(aTi);
|
||||
iTj=BOPDS_Tools::TypeToInteger(aTj);
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
aTj = aSJ.ShapeType();
|
||||
iTj = BOPDS_Tools::TypeToInteger(aTj);
|
||||
//
|
||||
bFlag=Standard_False;
|
||||
if (iTi<iTj) {
|
||||
bFlag=aSI.HasSubShape(j);
|
||||
}
|
||||
else if (iTj<iTi) {
|
||||
bFlag=aSIj.HasSubShape(i);
|
||||
}
|
||||
if (bFlag) {
|
||||
continue;
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if (((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
bFlag=Standard_False;// Bounding boxes are intersected
|
||||
const Bnd_Box& aBoxj=aSIj.Box();
|
||||
if (aBoxi.IsOut(aBoxj)) {
|
||||
bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
|
||||
}
|
||||
//
|
||||
iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
aPKXB.SetFlag(bFlag);
|
||||
myLists(iX).Append(aPKXB);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
BOPDS_Pair aPair(i, j);
|
||||
if (aMPFence.Add(aPair)) {
|
||||
iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
myLists(iX).Append(aPair);
|
||||
}// if (aMPFence.Add(aPair)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=i1; i<=i2; ++i) {
|
||||
}//for (iR=1; iR<aNbR; ++iR) {
|
||||
//
|
||||
aMPKXB.Clear();
|
||||
aMPFence.Clear();
|
||||
aVTSR.Clear();
|
||||
//-----------------------------------------------------scope_1 t
|
||||
}
|
||||
|
@@ -25,8 +25,8 @@
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <BOPDS_PDS.hxx>
|
||||
#include <BOPDS_VectorOfListOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_VectorOfPair.hxx>
|
||||
#include <BOPDS_VectorOfVectorOfPair.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
class BOPDS_DS;
|
||||
@@ -45,100 +45,71 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Empty contructor
|
||||
Standard_EXPORT BOPDS_Iterator();
|
||||
Standard_EXPORT virtual ~BOPDS_Iterator();
|
||||
|
||||
Standard_EXPORT virtual ~BOPDS_Iterator();
|
||||
|
||||
//! Contructor
|
||||
//! theAllocator - the allocator to manage the memory
|
||||
Standard_EXPORT BOPDS_Iterator(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
|
||||
//! Modifier
|
||||
//! Sets the data structure <pDS> to process
|
||||
Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
|
||||
|
||||
|
||||
//! Selector
|
||||
//! Returns the data structure
|
||||
Standard_EXPORT const BOPDS_DS& DS() const;
|
||||
|
||||
|
||||
//! Initializes the iterator
|
||||
//! theType1 - the first type of shape
|
||||
//! theType2 - the second type of shape
|
||||
Standard_EXPORT void Initialize (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
|
||||
|
||||
|
||||
//! Returns true if still there are pairs
|
||||
//! of intersected shapes
|
||||
Standard_EXPORT Standard_Boolean More() const;
|
||||
|
||||
|
||||
//! Moves iterations ahead
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
|
||||
//! Returns indices (DS) of intersected shapes
|
||||
//! theIndex1 - the index of the first shape
|
||||
//! theIndex2 - the index of the second shape
|
||||
//! theWithSubShape - flag. True if the sub-shapes of
|
||||
//! shapes are intersected
|
||||
Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2, Standard_Boolean& theWithSubShape) const;
|
||||
|
||||
Standard_EXPORT void Value (Standard_Integer& theIndex1,
|
||||
Standard_Integer& theIndex2) const;
|
||||
|
||||
//! Perform the intersection algorithm and prepare
|
||||
//! the results to be used
|
||||
Standard_EXPORT virtual void Prepare();
|
||||
|
||||
|
||||
//! Returns the number of intersections founded
|
||||
Standard_EXPORT Standard_Integer ExpectedLength() const;
|
||||
|
||||
|
||||
//! Returns the block length
|
||||
Standard_EXPORT Standard_Integer BlockLength() const;
|
||||
|
||||
|
||||
//! Set the flag of parallel processing
|
||||
//! if <theFlag> is true the parallel processing is switched on
|
||||
//! if <theFlag> is false the parallel processing is switched off
|
||||
Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag);
|
||||
|
||||
|
||||
//! Returns the flag of parallel processing
|
||||
Standard_EXPORT Standard_Boolean RunParallel() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Intersect();
|
||||
|
||||
|
||||
BOPCol_BaseAllocator myAllocator;
|
||||
Standard_Integer myLength;
|
||||
BOPDS_PDS myDS;
|
||||
BOPDS_VectorOfListOfPassKeyBoolean myLists;
|
||||
BOPDS_ListIteratorOfListOfPassKeyBoolean myIterator;
|
||||
BOPDS_VectorOfVectorOfPair myLists;
|
||||
BOPDS_VectorOfPair::Iterator myIterator;
|
||||
Standard_Boolean myRunParallel;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPDS_Iterator_HeaderFile
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_IteratorSI.hxx>
|
||||
#include <BOPDS_MapOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_ShapeInfo.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -80,124 +80,69 @@ void BOPDS_IteratorSI::UpdateByLevelOfCheck(const Standard_Integer theLevel)
|
||||
//=======================================================================
|
||||
void BOPDS_IteratorSI::Intersect()
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer aNbS, i, aNbB;
|
||||
Standard_Integer aNbSD, iX, j, iDS, jB;
|
||||
Standard_Integer i, j, iX, aNbS;
|
||||
Standard_Integer iTi, iTj;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPA(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
|
||||
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
|
||||
BOPDS_PassKeyBoolean aPKXB;
|
||||
//
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
// myPairsAvoid, aMSI, aMSB
|
||||
aNbS=myDS->NbSourceShapes();
|
||||
aNbS = myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
//
|
||||
if (!aSI.IsInterfering()) {
|
||||
if (!aSI.IsInterfering()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSi=aSI.Shape();
|
||||
aTi=aSI.ShapeType();
|
||||
if (aTi!=TopAbs_VERTEX) {
|
||||
const BOPCol_ListOfInteger& aLA=aSI.SubShapes();
|
||||
aIt.Initialize(aLA);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
iX=aIt.Value();
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, iX);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
}
|
||||
//
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, i);
|
||||
aMPA.Add(aPKXB);
|
||||
//
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
//
|
||||
aMSI.Bind(aSi, i);
|
||||
aMSB.Add(aSi, aBoxEx);
|
||||
} // for (i=0; i<aNbS; ++i) {
|
||||
//
|
||||
// aMII
|
||||
aNbB=aMSB.Extent();
|
||||
for (i=1; i<=aNbB; ++i) {
|
||||
const TopoDS_Shape& aS=aMSB.FindKey(i);
|
||||
const Bnd_Box& aBoxEx=aMSB(i);
|
||||
//
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
//
|
||||
iDS=aMSI.Find(aS);
|
||||
aMII.Bind(i, iDS);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
aTi=aSI.ShapeType();
|
||||
BOPDS_MapOfPair aMPFence;
|
||||
//
|
||||
for (i = 0; i < aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
if (!aSI.IsInterfering()){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSi=myDS->Shape(i);
|
||||
aTi=aSi.ShapeType();
|
||||
const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxEx);
|
||||
//
|
||||
aNbSD=aBBTree.Select(aSelector);
|
||||
if (!aNbSD){
|
||||
Standard_Integer aNbSD = aBBTree.Select(aSelector);
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
|
||||
aTi = aSI.ShapeType();
|
||||
iTi = BOPDS_Tools::TypeToInteger(aTi);
|
||||
//
|
||||
aIt.Initialize(aLI);
|
||||
const BOPCol_ListOfInteger& aLI = aSelector.Indices();
|
||||
BOPCol_ListIteratorOfListOfInteger aIt(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
jB=aIt.Value(); // box index in MII
|
||||
j=aMII.Find(jB); // DS index
|
||||
j = aIt.Value();
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
aTj = aSJ.ShapeType();
|
||||
iTj = BOPDS_Tools::TypeToInteger(aTj);
|
||||
//
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPA.Contains(aPKXB)) {
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
bFlag=Standard_False;// Bounding boxes are intersected
|
||||
const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
|
||||
const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
|
||||
if (aBoxi.IsOut(aBoxj)) {
|
||||
bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
|
||||
}
|
||||
aTj=myDS->ShapeInfo(j).ShapeType();//
|
||||
iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
aPKXB.SetFlag(bFlag);
|
||||
myLists(iX).Append(aPKXB);
|
||||
BOPDS_Pair aPair(i, j);
|
||||
if (aMPFence.Add(aPair)) {
|
||||
iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
myLists(iX).Append(aPair);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=1; i<=aNbS; ++i) {
|
||||
//
|
||||
aMSI.Clear();
|
||||
aMII.Clear();
|
||||
aMPA.Clear();
|
||||
aMPKXB.Clear();
|
||||
aMSB.Clear();
|
||||
//
|
||||
//-----------------------------------------------------scope_1 t
|
||||
aMPFence.Clear();
|
||||
}
|
||||
|
25
src/BOPDS/BOPDS_MapOfPair.hxx
Normal file
25
src/BOPDS/BOPDS_MapOfPair.hxx
Normal file
@@ -0,0 +1,25 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef BOPDS_MapOfPair_HeaderFile
|
||||
#define BOPDS_MapOfPair_HeaderFile
|
||||
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <BOPDS_PairMapHasher.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
|
||||
typedef NCollection_Map<BOPDS_Pair, BOPDS_PairMapHasher> BOPDS_MapOfPair;
|
||||
typedef BOPDS_MapOfPair::Iterator BOPDS_MapIteratorOfMapOfPair;
|
||||
|
||||
#endif
|
77
src/BOPDS/BOPDS_Pair.hxx
Normal file
77
src/BOPDS/BOPDS_Pair.hxx
Normal file
@@ -0,0 +1,77 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef _BOPDS_Pair_HeaderFile
|
||||
#define _BOPDS_Pair_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
//! The class is to provide the pair of indices of interfering shapes.
|
||||
|
||||
class BOPDS_Pair {
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
BOPDS_Pair() : myIndex1(-1), myIndex2(-1) {}
|
||||
//
|
||||
BOPDS_Pair(const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2) : myIndex1(theIndex1), myIndex2(theIndex2) {}
|
||||
|
||||
~BOPDS_Pair(){}
|
||||
//
|
||||
//! Sets the indices
|
||||
void SetIndices(const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2)
|
||||
{
|
||||
myIndex1 = theIndex1;
|
||||
myIndex2 = theIndex2;
|
||||
}
|
||||
//
|
||||
//! Gets the indices
|
||||
void Indices(Standard_Integer& theIndex1,
|
||||
Standard_Integer& theIndex2) const
|
||||
{
|
||||
theIndex1 = myIndex1;
|
||||
theIndex2 = myIndex2;
|
||||
}
|
||||
//
|
||||
//! Operator less
|
||||
Standard_Boolean operator < (const BOPDS_Pair& theOther) const
|
||||
{
|
||||
return ((myIndex1 != theOther.myIndex1) ?
|
||||
(myIndex1 < theOther.myIndex1) : (myIndex2 < theOther.myIndex2));
|
||||
}
|
||||
//
|
||||
//! Returns true if the Pair is equal to <the theOther>
|
||||
Standard_Boolean IsEqual (const BOPDS_Pair& theOther) const
|
||||
{
|
||||
return (myIndex1 == theOther.myIndex1 && myIndex2 == theOther.myIndex2) ||
|
||||
(myIndex1 == theOther.myIndex2 && myIndex2 == theOther.myIndex1);
|
||||
}
|
||||
//
|
||||
//! Returns hash code
|
||||
Standard_Integer HashCode (const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myIndex1 + myIndex2, theUpper);
|
||||
}
|
||||
|
||||
protected:
|
||||
Standard_Integer myIndex1;
|
||||
Standard_Integer myIndex2;
|
||||
};
|
||||
|
||||
#endif // _BOPDS_Pair
|
52
src/BOPDS/BOPDS_PairMapHasher.hxx
Normal file
52
src/BOPDS/BOPDS_PairMapHasher.hxx
Normal file
@@ -0,0 +1,52 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef _BOPDS_PairMapHasher_HeaderFile
|
||||
#define _BOPDS_PairMapHasher_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
|
||||
class BOPDS_Pair;
|
||||
|
||||
class BOPDS_PairMapHasher
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
static Standard_Integer HashCode(const BOPDS_Pair& thePair,
|
||||
const Standard_Integer Upper)
|
||||
{
|
||||
return thePair.HashCode(Upper);
|
||||
}
|
||||
|
||||
static Standard_Boolean IsEqual(const BOPDS_Pair& thePair1,
|
||||
const BOPDS_Pair& thePair2)
|
||||
{
|
||||
return thePair1.IsEqual(thePair2);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // _BOPDS_PairMapHasher_HeaderFile
|
@@ -13,49 +13,43 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPCol_MapOfInteger.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_MapOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
#include <BOPDS_SubIterator.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//function : BOPDS_SubIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPDS_SubIterator::BOPDS_SubIterator()
|
||||
:
|
||||
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myList(myAllocator)
|
||||
myList(1, myAllocator)
|
||||
{
|
||||
myDS=NULL;
|
||||
myDS=NULL;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
//function : BOPDS_SubIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPDS_SubIterator::BOPDS_SubIterator(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
myAllocator(theAllocator),
|
||||
myList(myAllocator)
|
||||
myList(1, myAllocator)
|
||||
{
|
||||
myDS=NULL;
|
||||
myDS=NULL;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
@@ -65,76 +59,15 @@
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: SetDS
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::SetDS(const BOPDS_PDS& aDS)
|
||||
{
|
||||
myDS=aDS;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: DS
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
const BOPDS_DS& BOPDS_SubIterator::DS()const
|
||||
{
|
||||
return *myDS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetSubSet1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::SetSubSet1(const BOPCol_ListOfInteger& theLI)
|
||||
{
|
||||
mySubSet1=(BOPCol_PListOfInteger)&theLI;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SubSet1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPCol_ListOfInteger& BOPDS_SubIterator::SubSet1()const
|
||||
{
|
||||
return *mySubSet1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetSubSet2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::SetSubSet2(const BOPCol_ListOfInteger& theLI)
|
||||
{
|
||||
mySubSet2=(BOPCol_PListOfInteger)&theLI;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SubSet2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPCol_ListOfInteger& BOPDS_SubIterator::SubSet2()const
|
||||
{
|
||||
return *mySubSet2;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Initialize
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::Initialize()
|
||||
void BOPDS_SubIterator::Initialize()
|
||||
{
|
||||
myIterator.Initialize(myList);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: More
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPDS_SubIterator::More()const
|
||||
{
|
||||
return myIterator.More();
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Next
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::Next()
|
||||
{
|
||||
myIterator.Next();
|
||||
// sort interfering pairs for constant order of intersection
|
||||
std::stable_sort(myList.begin(), myList.end());
|
||||
// initialize iterator to access the pairs
|
||||
myIterator.Init(myList);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Value
|
||||
@@ -145,8 +78,8 @@
|
||||
{
|
||||
Standard_Integer iT1, iT2, n1, n2;
|
||||
//
|
||||
const BOPDS_PassKeyBoolean& aPKB=myIterator.Value();
|
||||
aPKB.Ids(n1, n2);
|
||||
const BOPDS_Pair& aPKB = myIterator.Value();
|
||||
aPKB.Indices(n1, n2);
|
||||
//
|
||||
iT1=(Standard_Integer)(myDS->ShapeInfo(n1).ShapeType());
|
||||
iT2=(Standard_Integer)(myDS->ShapeInfo(n2).ShapeType());
|
||||
@@ -169,9 +102,13 @@
|
||||
if (!myDS){
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (!mySubSet1->Extent() || !mySubSet2->Extent()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
myList.SetIncrement(2 * (mySubSet1->Extent() + mySubSet2->Extent()));
|
||||
//
|
||||
Intersect();
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -180,79 +117,58 @@
|
||||
//=======================================================================
|
||||
void BOPDS_SubIterator::Intersect()
|
||||
{
|
||||
Standard_Integer i, aNbB, aNbSD, j, iDS, jB;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt, aIt1, aIt2;
|
||||
BOPDS_PassKeyBoolean aPKXB;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
//
|
||||
BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
|
||||
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
|
||||
//
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
Standard_Integer i, j, iTi, iTj;
|
||||
BOPCol_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
aIt1.Initialize(*mySubSet1);
|
||||
for (; aIt1.More(); aIt1.Next()) {
|
||||
i=aIt1.Value();
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
const TopoDS_Shape& aS=aSI.Shape();
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
aMSI.Bind(aS, i);
|
||||
aMSB.Add(aS, aBoxEx);
|
||||
}
|
||||
//
|
||||
aNbB=aMSB.Extent();
|
||||
for (i=1; i<=aNbB; ++i) {
|
||||
const TopoDS_Shape& aS=aMSB.FindKey(i);
|
||||
const Bnd_Box& aBoxEx=aMSB(i);
|
||||
BOPCol_ListIteratorOfListOfInteger aIt(*mySubSet1);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
i = aIt.Value();
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
//
|
||||
iDS=aMSI.Find(aS);
|
||||
aMII.Bind(i, iDS);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
aIt2.Initialize(*mySubSet2);
|
||||
for (; aIt2.More(); aIt2.Next()) {
|
||||
i=aIt2.Value();
|
||||
BOPDS_MapOfPair aMPKFence;
|
||||
//
|
||||
aIt.Initialize(*mySubSet2);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
i = aIt.Value();
|
||||
//
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
|
||||
const Bnd_Box& aBoxEx = aSI.Box();
|
||||
//
|
||||
aSelector.Clear();
|
||||
BOPCol_BoxBndTreeSelector aSelector;
|
||||
aSelector.SetBox(aBoxEx);
|
||||
aNbSD=aBBTree.Select(aSelector);
|
||||
if (!aNbSD){
|
||||
Standard_Integer aNbSD = aBBTree.Select(aSelector);
|
||||
if (!aNbSD) {
|
||||
continue;
|
||||
}
|
||||
//const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
|
||||
aIt.Initialize(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
jB=aIt.Value(); // box index in MII
|
||||
j=aMII.Find(jB); // DS index
|
||||
iTi = BOPDS_Tools::TypeToInteger(aSI.ShapeType());
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI = aSelector.Indices();
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
j = aItLI.Value();
|
||||
//
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
myList.Append(aPKXB);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
|
||||
iTj = BOPDS_Tools::TypeToInteger(aSJ.ShapeType());
|
||||
//
|
||||
// avoid interfering of the same shapes and shape with its sub-shapes
|
||||
if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
|
||||
((iTi > iTj) && aSJ.HasSubShape(i))) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPDS_Pair aPair(j, i);
|
||||
if (aMPKFence.Add(aPair)) {
|
||||
myList.Append(aPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
aMSI.Clear();
|
||||
aMII.Clear();
|
||||
aMPKXB.Clear();
|
||||
aMSB.Clear();
|
||||
//
|
||||
//-----------------------------------------------------scope_1 t
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPDS_PDS.hxx>
|
||||
#include <BOPDS_ListOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
#include <BOPDS_VectorOfPair.hxx>
|
||||
#include <BOPCol_PListOfInteger.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
@@ -30,114 +30,106 @@
|
||||
class BOPDS_DS;
|
||||
|
||||
|
||||
//! The class BOPDS_SubIterator is used to compute intersections between
|
||||
//! bounding boxes of two sub-sets of BRep sub-shapes of arguments
|
||||
//! of an operation (see the class BOPDS_DS).
|
||||
//! The class provides interface to iterate the pairs of intersected sub-shapes.
|
||||
|
||||
//! The class BOPDS_SubIterator is
|
||||
//! 1.to compute intersections between two sub-sets of
|
||||
//! BRep sub-shapes
|
||||
//! of arguments of an operation (see the class BOPDS_DS)
|
||||
//! in terms of theirs bounding boxes
|
||||
//! 2.provides interface to iterare the pairs of
|
||||
//! intersected sub-shapes of given type
|
||||
class BOPDS_SubIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Empty contructor
|
||||
//! Empty constructor
|
||||
Standard_EXPORT BOPDS_SubIterator();
|
||||
Standard_EXPORT virtual ~BOPDS_SubIterator();
|
||||
|
||||
Standard_EXPORT virtual ~BOPDS_SubIterator();
|
||||
|
||||
//! Contructor
|
||||
//! Constructor
|
||||
//! theAllocator - the allocator to manage the memory
|
||||
Standard_EXPORT BOPDS_SubIterator(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
|
||||
//! Modifier
|
||||
//! Sets the data structure <pDS> to process
|
||||
Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
|
||||
|
||||
//! Sets the data structure <pDS> to process.
|
||||
//! It is used to access the shapes and their bounding boxes.
|
||||
void SetDS (const BOPDS_PDS& pDS)
|
||||
{
|
||||
myDS = pDS;
|
||||
}
|
||||
|
||||
//! Selector
|
||||
//! Returns the data structure
|
||||
Standard_EXPORT const BOPDS_DS& DS() const;
|
||||
|
||||
const BOPDS_DS& DS() const
|
||||
{
|
||||
return *myDS;
|
||||
}
|
||||
|
||||
//! Modifier
|
||||
//! Sets the first set of indices <theLI> to process
|
||||
Standard_EXPORT void SetSubSet1 (const BOPCol_ListOfInteger& theLI);
|
||||
|
||||
//! Sets the first set of indices <theLI> to process
|
||||
void SetSubSet1 (const BOPCol_ListOfInteger& theLI)
|
||||
{
|
||||
mySubSet1 = (BOPCol_PListOfInteger)&theLI;
|
||||
}
|
||||
|
||||
//! Selector
|
||||
//! Returns the first set of indices to process
|
||||
Standard_EXPORT const BOPCol_ListOfInteger& SubSet1() const;
|
||||
|
||||
const BOPCol_ListOfInteger& SubSet1() const
|
||||
{
|
||||
return *mySubSet1;
|
||||
}
|
||||
|
||||
//! Modifier
|
||||
//! Sets the second set of indices <theLI> to process
|
||||
Standard_EXPORT void SetSubSet2 (const BOPCol_ListOfInteger& theLI);
|
||||
|
||||
//! Sets the second set of indices <theLI> to process
|
||||
void SetSubSet2 (const BOPCol_ListOfInteger& theLI)
|
||||
{
|
||||
mySubSet2 = (BOPCol_PListOfInteger)&theLI;
|
||||
}
|
||||
|
||||
//! Selector
|
||||
//! Returns the second set of indices to process
|
||||
Standard_EXPORT const BOPCol_ListOfInteger& SubSet2() const;
|
||||
|
||||
const BOPCol_ListOfInteger& SubSet2() const
|
||||
{
|
||||
return *mySubSet2;
|
||||
}
|
||||
|
||||
//! Initializes the iterator
|
||||
//! Initializes the iterator
|
||||
Standard_EXPORT void Initialize();
|
||||
|
||||
|
||||
//! Returns true if still there are pairs
|
||||
//! of intersected shapes
|
||||
Standard_EXPORT Standard_Boolean More() const;
|
||||
|
||||
//! Returns true if there are more pairs of intersected shapes
|
||||
Standard_Boolean More() const
|
||||
{
|
||||
return myIterator.More();
|
||||
}
|
||||
|
||||
//! Moves iterations ahead
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
void Next()
|
||||
{
|
||||
myIterator.Next();
|
||||
}
|
||||
|
||||
//! Returns indices (DS) of intersected shapes
|
||||
//! theIndex1 - the index of the first shape
|
||||
//! theIndex2 - the index of the second shape
|
||||
Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2) const;
|
||||
|
||||
|
||||
//! Perform the intersection algorithm and prepare
|
||||
//! the results to be used
|
||||
Standard_EXPORT virtual void Prepare();
|
||||
|
||||
|
||||
|
||||
//! Returns the number of interfering pairs
|
||||
Standard_Integer ExpectedLength() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Performs intersection of bounding boxes
|
||||
Standard_EXPORT virtual void Intersect();
|
||||
|
||||
|
||||
BOPCol_BaseAllocator myAllocator;
|
||||
BOPDS_PDS myDS;
|
||||
BOPDS_ListOfPassKeyBoolean myList;
|
||||
BOPDS_ListIteratorOfListOfPassKeyBoolean myIterator;
|
||||
BOPDS_VectorOfPair myList;
|
||||
BOPDS_VectorOfPair::Iterator myIterator;
|
||||
BOPCol_PListOfInteger mySubSet1;
|
||||
BOPCol_PListOfInteger mySubSet2;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPDS_SubIterator_HeaderFile
|
||||
|
23
src/BOPDS/BOPDS_VectorOfPair.hxx
Normal file
23
src/BOPDS/BOPDS_VectorOfPair.hxx
Normal file
@@ -0,0 +1,23 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef BOPDS_VectorOfPair_HeaderFile
|
||||
#define BOPDS_VectorOfPair_HeaderFile
|
||||
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPDS_Pair.hxx>
|
||||
|
||||
typedef BOPCol_NCVector<BOPDS_Pair> BOPDS_VectorOfPair;
|
||||
|
||||
#endif
|
23
src/BOPDS/BOPDS_VectorOfVectorOfPair.hxx
Normal file
23
src/BOPDS/BOPDS_VectorOfVectorOfPair.hxx
Normal file
@@ -0,0 +1,23 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License 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.
|
||||
|
||||
#ifndef BOPDS_VectorOfVectorOfPair_HeaderFile
|
||||
#define BOPDS_VectorOfVectorOfPair_HeaderFile
|
||||
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPDS_VectorOfPair.hxx>
|
||||
|
||||
typedef BOPCol_NCVector<BOPDS_VectorOfPair> BOPDS_VectorOfVectorOfPair;
|
||||
|
||||
#endif
|
@@ -79,3 +79,8 @@ BOPDS_VectorOfListOfPaveBlock.hxx
|
||||
BOPDS_VectorOfPave.hxx
|
||||
BOPDS_VectorOfPoint.hxx
|
||||
BOPDS_VectorOfShapeInfo.hxx
|
||||
BOPDS_Pair.hxx
|
||||
BOPDS_PairMapHasher.hxx
|
||||
BOPDS_MapOfPair.hxx
|
||||
BOPDS_VectorOfPair.hxx
|
||||
BOPDS_VectorOfVectorOfPair.hxx
|
||||
|
@@ -116,6 +116,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
if (aOp!=BOPAlgo_CUT21) {
|
||||
pBuilder->SetArguments(aLS);
|
||||
@@ -129,6 +130,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
pBuilder->SetRunParallel(bRunParallel);
|
||||
pBuilder->SetFuzzyValue(aFuzzyValue);
|
||||
pBuilder->SetNonDestructive(bNonDestructive);
|
||||
pBuilder->SetGlue(aGlue);
|
||||
//
|
||||
pBuilder->Build();
|
||||
iErr=pBuilder->ErrorStatus();
|
||||
@@ -176,11 +178,13 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
aBuilder.SetArguments(aLS);
|
||||
aBuilder.SetRunParallel(bRunParallel);
|
||||
aBuilder.SetFuzzyValue(aFuzzyValue);
|
||||
aBuilder.SetNonDestructive(bNonDestructive);
|
||||
aBuilder.SetGlue(aGlue);
|
||||
//
|
||||
aBuilder.Build();
|
||||
iErr=aBuilder.ErrorStatus();
|
||||
|
@@ -141,6 +141,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
@@ -157,6 +158,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
pPF->SetFuzzyValue(aTol);
|
||||
pPF->SetRunParallel(bRunParallel);
|
||||
pPF->SetNonDestructive(bNonDestructive);
|
||||
pPF->SetGlue(aGlue);
|
||||
//
|
||||
pPF->Perform();
|
||||
iErr=pPF->ErrorStatus();
|
||||
@@ -407,6 +409,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
for (i = 4; i < n; ++i) {
|
||||
if (!strcmp(a[i], "-n2d")) {
|
||||
@@ -433,6 +436,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
aSec.SetFuzzyValue(aTol);
|
||||
aSec.SetRunParallel(bRunParallel);
|
||||
aSec.SetNonDestructive(bNonDestructive);
|
||||
aSec.SetGlue(aGlue);
|
||||
//
|
||||
aSec.Build();
|
||||
iErr=aSec.ErrorStatus();
|
||||
@@ -484,6 +488,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
Handle(NCollection_BaseAllocator)aAL=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
@@ -495,6 +500,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetNonDestructive(bNonDestructive);
|
||||
aPF.SetGlue(aGlue);
|
||||
//
|
||||
aPF.Perform();
|
||||
iErr=aPF.ErrorStatus();
|
||||
@@ -739,6 +745,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
bToIntersect = Standard_True;
|
||||
bCompounds = Standard_False;
|
||||
@@ -789,6 +796,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
aMV.SetRunParallel(bRunParallel);
|
||||
aMV.SetFuzzyValue(aTol);
|
||||
aMV.SetNonDestructive(bNonDestructive);
|
||||
aMV.SetGlue(aGlue);
|
||||
//
|
||||
aMV.Perform();
|
||||
if (aMV.ErrorStatus()) {
|
||||
|
@@ -80,7 +80,6 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Integer iErr;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
@@ -103,8 +102,16 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
|
||||
aCBuilder.AddArgument(aS);
|
||||
}
|
||||
//
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
// set the options to the algorithm
|
||||
Standard_Boolean bRunParallel = BOPTest_Objects::RunParallel();
|
||||
Standard_Real aTol = BOPTest_Objects::FuzzyValue();
|
||||
Standard_Boolean bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
aCBuilder.SetRunParallel(bRunParallel);
|
||||
aCBuilder.SetFuzzyValue(aTol);
|
||||
aCBuilder.SetNonDestructive(bNonDestructive);
|
||||
aCBuilder.SetGlue(aGlue);
|
||||
//
|
||||
aCBuilder.PerformWithFiller(aPF);
|
||||
iErr = aCBuilder.ErrorStatus();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <BOPAlgo_CheckResult.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_MapOfPair.hxx>
|
||||
#include <BOPTest.hxx>
|
||||
#include <BOPTest_Objects.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
@@ -207,7 +207,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
TopAbs_ShapeEnum aType1, aType2;
|
||||
BOPAlgo_CheckerSI aChecker;
|
||||
BOPCol_ListOfShape aLS;
|
||||
BOPDS_MapIteratorMapOfPassKey aItMPK;
|
||||
BOPDS_MapIteratorOfMapOfPair aItMPK;
|
||||
//
|
||||
if (aLevel < (aNbInterfTypes-1)) {
|
||||
di << "Info:\nThe level of check is set to "
|
||||
@@ -239,7 +239,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
//
|
||||
const BOPDS_DS& aDS=*(aChecker.PDS());
|
||||
//
|
||||
const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
|
||||
const BOPDS_MapOfPair& aMPK=aDS.Interferences();
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
using namespace std;
|
||||
vector <BOPTest_Interf> aVec;
|
||||
@@ -248,8 +248,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
//
|
||||
aItMPK.Initialize(aMPK);
|
||||
for (; aItMPK.More(); aItMPK.Next()) {
|
||||
const BOPDS_PassKey& aPK=aItMPK.Value();
|
||||
aPK.Ids(n1, n2);
|
||||
const BOPDS_Pair& aPK=aItMPK.Value();
|
||||
aPK.Indices(n1, n2);
|
||||
if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -235,7 +235,6 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer n1, n2;
|
||||
char buf[64], aST1[10], aST2[10];
|
||||
BOPDS_Iterator aIt;
|
||||
@@ -252,12 +251,12 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
|
||||
for (i = 0; i < 4; ++i) {
|
||||
GetNameByType(aT[i], aST1);
|
||||
//
|
||||
for (j = 0; j < 4; ++j) {
|
||||
for (j = i; j < 4; ++j) {
|
||||
GetNameByType(aT[j], aST2);
|
||||
//
|
||||
aIt.Initialize(aT[i], aT[j]);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aIt.Value(n1, n2, bFlag);
|
||||
aIt.Value(n1, n2);
|
||||
//
|
||||
Sprintf(buf, "%s/%s: (z%d z%d)\n", aST1, aST2, n1, n2);
|
||||
di << buf;
|
||||
@@ -276,7 +275,7 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
|
||||
//
|
||||
aIt.Initialize(aT1, aT2);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aIt.Value(n1, n2, bFlag);
|
||||
aIt.Value(n1, n2);
|
||||
//
|
||||
Sprintf(buf, "%s/%s: (z%d z%d)\n", aST1, aST2, n1, n2);
|
||||
di << buf;
|
||||
@@ -576,21 +575,6 @@ Standard_Integer bopindex (Draw_Interpretor& di,
|
||||
di << " Index: " << ind << "\n";
|
||||
}
|
||||
else {
|
||||
Standard_Integer i1, i2;
|
||||
//
|
||||
i1 = pDS->NbSourceShapes();
|
||||
i2 = pDS->NbShapes();
|
||||
for (ind = i1; ind < i2; ++ind) {
|
||||
const TopoDS_Shape& aSx = pDS->Shape(ind);
|
||||
if (aSx.IsSame(aS)) {
|
||||
di << " Index: " << ind << "\n";
|
||||
bFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!bFound) {
|
||||
di << " DS does not contain the shape\n";
|
||||
}
|
||||
//
|
||||
|
@@ -52,6 +52,7 @@ class BOPTest_Session {
|
||||
myRunParallel=Standard_False;
|
||||
myNonDestructive = Standard_False;
|
||||
myFuzzyValue = 0.;
|
||||
myGlue = BOPAlgo_GlueOff;
|
||||
};
|
||||
//
|
||||
// Clear
|
||||
@@ -123,6 +124,14 @@ class BOPTest_Session {
|
||||
return myNonDestructive;
|
||||
};
|
||||
//
|
||||
void SetGlue(const BOPAlgo_GlueEnum theGlue) {
|
||||
myGlue = theGlue;
|
||||
};
|
||||
//
|
||||
BOPAlgo_GlueEnum Glue() const {
|
||||
return myGlue;
|
||||
};
|
||||
//
|
||||
protected:
|
||||
//
|
||||
BOPTest_Session(const BOPTest_Session&);
|
||||
@@ -139,6 +148,7 @@ protected:
|
||||
Standard_Boolean myRunParallel;
|
||||
Standard_Boolean myNonDestructive;
|
||||
Standard_Real myFuzzyValue;
|
||||
BOPAlgo_GlueEnum myGlue;
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
@@ -308,6 +318,22 @@ Standard_Boolean BOPTest_Objects::NonDestructive()
|
||||
return GetSession().NonDestructive();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetGlue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTest_Objects::SetGlue(const BOPAlgo_GlueEnum theGlue)
|
||||
{
|
||||
GetSession().SetGlue(theGlue);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Glue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPAlgo_GlueEnum BOPTest_Objects::Glue()
|
||||
{
|
||||
return GetSession().Glue();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Allocator1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BOPAlgo_CellsBuilder.hxx>
|
||||
#include <BOPAlgo_GlueEnum.hxx>
|
||||
//
|
||||
class BOPAlgo_PaveFiller;
|
||||
class BOPAlgo_Builder;
|
||||
class BOPAlgo_BOP;
|
||||
@@ -75,7 +77,9 @@ public:
|
||||
|
||||
Standard_EXPORT static Standard_Boolean NonDestructive();
|
||||
|
||||
Standard_EXPORT static void SetGlue(const BOPAlgo_GlueEnum aGlue);
|
||||
|
||||
Standard_EXPORT static BOPAlgo_GlueEnum Glue();
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <BOPTest_Objects.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <BOPAlgo_GlueEnum.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -24,6 +25,7 @@ static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const cha
|
||||
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bGlue(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
//=======================================================================
|
||||
//function : OptionCommands
|
||||
@@ -41,6 +43,7 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
|
||||
theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
|
||||
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
|
||||
theCommands.Add("bglue", "use bglue [0 (off) / 1 (shift) / 2 (full)]", __FILE__, bGlue, g);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : boptions
|
||||
@@ -58,16 +61,21 @@ Standard_Integer boptions(Draw_Interpretor& di,
|
||||
char buf[128];
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Real aFuzzyValue;
|
||||
BOPAlgo_GlueEnum aGlue;
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
aFuzzyValue = BOPTest_Objects::FuzzyValue();
|
||||
|
||||
aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
|
||||
di << buf;
|
||||
Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
|
||||
di << buf;
|
||||
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
|
||||
Sprintf(buf, " FuzzyValue: %lf\n", aFuzzyValue);
|
||||
di << buf;
|
||||
Sprintf(buf, " GlueOption: %s\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
|
||||
((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")));
|
||||
di << buf;
|
||||
//
|
||||
return 0;
|
||||
@@ -151,3 +159,28 @@ Standard_Integer bnondestructive(Draw_Interpretor& di,
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bglue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer bGlue(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n != 2) {
|
||||
di << " use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Integer iGlue = Draw::Atoi(a[1]);
|
||||
if (iGlue < 0 || iGlue > 2) {
|
||||
di << " Wrong value. Use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueEnum(iGlue);
|
||||
BOPTest_Objects::SetGlue(aGlue);
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
@@ -83,12 +83,13 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
|
||||
//
|
||||
for (i=1; i<n; ++i) {
|
||||
if (!strcmp(a[i], "-t")) {
|
||||
bShowTime=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
|
||||
//
|
||||
@@ -110,6 +111,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetNonDestructive(bNonDestructive);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
aPF.SetGlue(aGlue);
|
||||
//
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start();
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <BOPTest.hxx>
|
||||
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
@@ -23,8 +24,8 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
static Standard_Integer attachpcurve (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
static Standard_Integer attachpcurve (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer edgestowire (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -41,6 +42,7 @@ static Standard_Integer attachpcurve (Draw_Interpretor&, Standard_Integer, con
|
||||
// Commands
|
||||
|
||||
theCommands.Add("attachpcurve", "attachpcurve eold enew face", __FILE__, attachpcurve, group);
|
||||
theCommands.Add("edgestowire" , "edgestowire wire edges" , __FILE__, edgestowire , group);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -102,3 +104,27 @@ static Standard_Integer attachpcurve(Draw_Interpretor& theDI,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : edgestowire
|
||||
//purpose : Orients the edges to make wire
|
||||
//=======================================================================
|
||||
static Standard_Integer edgestowire(Draw_Interpretor& theDI,
|
||||
Standard_Integer theNArg,
|
||||
const char ** theArgVal)
|
||||
{
|
||||
if (theNArg != 3) {
|
||||
theDI << "Use: edgestowire wire edges\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
TopoDS_Shape anEdges = DBRep::Get(theArgVal[2]);
|
||||
if (anEdges.IsNull()) {
|
||||
theDI << "no edges\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools::OrientEdgesOnWire(anEdges);
|
||||
DBRep::Set(theArgVal[1], anEdges);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_MapOfShape.hxx>
|
||||
#include <BOPCol_MapOfOrientedShape.hxx>
|
||||
#include <BOPTools.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
@@ -54,6 +55,7 @@
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_CompSolid.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -82,16 +84,17 @@ static
|
||||
const TopoDS_Face& aF);
|
||||
|
||||
static
|
||||
void GetFaceDir(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real aT,
|
||||
const gp_Dir& aDTgt,
|
||||
gp_Dir& aDN,
|
||||
gp_Dir& aDB,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
GeomAPI_ProjectPointOnSurf& aProjPL,
|
||||
const Standard_Real aDt);
|
||||
Standard_Boolean GetFaceDir(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real aT,
|
||||
const gp_Dir& aDTgt,
|
||||
const Standard_Boolean theSmallFaces,
|
||||
gp_Dir& aDN,
|
||||
gp_Dir& aDB,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
GeomAPI_ProjectPointOnSurf& aProjPL,
|
||||
const Standard_Real aDt);
|
||||
static
|
||||
Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
@@ -105,7 +108,9 @@ static
|
||||
Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
const TopoDS_Face& theF1,
|
||||
const BOPTools_ListOfCoupleOfShape& theLCS,
|
||||
const gp_Pnt& aP);
|
||||
const gp_Pnt& aP,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
Standard_Boolean& theSmallFaces);
|
||||
|
||||
|
||||
|
||||
@@ -197,6 +202,94 @@ void BOPTools_AlgoTools::MakeConnexityBlocks
|
||||
}// for (; aIt.More(); aIt.Next())
|
||||
}
|
||||
//=======================================================================
|
||||
// function: OrientEdgesOnWire
|
||||
// purpose: Reorient edges on wire for correct ordering
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools::OrientEdgesOnWire(TopoDS_Shape& theWire)
|
||||
{
|
||||
// make vertex-edges connexity map
|
||||
BOPCol_IndexedDataMapOfShapeListOfShape aVEMap;
|
||||
BOPTools::MapShapesAndAncestors(theWire, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
|
||||
//
|
||||
if (aVEMap.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BRep_Builder aBB;
|
||||
// new wire
|
||||
TopoDS_Wire aWire;
|
||||
aBB.MakeWire(aWire);
|
||||
// fence map
|
||||
BOPCol_MapOfOrientedShape aMFence;
|
||||
//
|
||||
TopoDS_Iterator aIt(theWire);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Edge& aEC = TopoDS::Edge(aIt.Value());
|
||||
if (!aMFence.Add(aEC)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// add edge to a wire as it is
|
||||
aBB.Add(aWire, aEC);
|
||||
//
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices(aEC, aV1, aV2, Standard_True);
|
||||
//
|
||||
if (aV1.IsSame(aV2)) {
|
||||
// closed edge, go to the next edge
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// orient the adjacent edges
|
||||
for (Standard_Integer i = 0; i < 2; ++i) {
|
||||
TopoDS_Shape aVC = !i ? aV1 : aV2;
|
||||
//
|
||||
for (;;) {
|
||||
const BOPCol_ListOfShape& aLE = aVEMap.FindFromKey(aVC);
|
||||
if (aLE.Extent() != 2) {
|
||||
// free vertex or multi-connexity, go to the next edge
|
||||
break;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bStop = Standard_True;
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfShape aItLE(aLE);
|
||||
for (; aItLE.More(); aItLE.Next()) {
|
||||
const TopoDS_Edge& aEN = TopoDS::Edge(aItLE.Value());
|
||||
if (aMFence.Contains(aEN)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopoDS_Vertex aVN1, aVN2;
|
||||
TopExp::Vertices(aEN, aVN1, aVN2, Standard_True);
|
||||
if (aVN1.IsSame(aVN2)) {
|
||||
// closed edge, go to the next edge
|
||||
break;
|
||||
}
|
||||
//
|
||||
// change orientation if necessary and go to the next edges
|
||||
if ((!i && aVC.IsSame(aVN2)) || (i && aVC.IsSame(aVN1))) {
|
||||
aBB.Add(aWire, aEN);
|
||||
}
|
||||
else {
|
||||
aBB.Add(aWire, aEN.Reversed());
|
||||
}
|
||||
aMFence.Add(aEN);
|
||||
aVC = aVC.IsSame(aVN1) ? aVN2 : aVN1;
|
||||
bStop = Standard_False;
|
||||
break;
|
||||
}
|
||||
//
|
||||
if (bStop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
theWire = aWire;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: OrientFacesOnShell
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
@@ -809,7 +902,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
TopoDS_Face& theFOff,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Boolean bRet, bIsComputed;
|
||||
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
|
||||
Standard_Real aUmin, aUsup, aVmin, aVsup, aPA;
|
||||
gp_Pnt aPn1, aPn2, aPx;
|
||||
@@ -836,9 +929,15 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
aPL->Bounds(aUmin, aUsup, aVmin, aVsup);
|
||||
aProjPL.Init(aPL, aUmin, aUsup, aVmin, aVsup);
|
||||
//
|
||||
aDt3D = MinStep3D(theE1, theF1, theLCSOff, aPx);
|
||||
GetFaceDir(theE1, theF1, aPx, aT, aDTgt, aDN1, aDBF, theContext,
|
||||
aProjPL, aDt3D);
|
||||
Standard_Boolean bSmallFaces = Standard_False;
|
||||
aDt3D = MinStep3D(theE1, theF1, theLCSOff, aPx, theContext, bSmallFaces);
|
||||
bIsComputed = GetFaceDir(theE1, theF1, aPx, aT, aDTgt, bSmallFaces,
|
||||
aDN1, aDBF, theContext, aProjPL, aDt3D);
|
||||
if (!bIsComputed) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BOPTools_AlgoTools::GetFaceOff(): incorrect computation of bi-normal direction." << endl;
|
||||
#endif
|
||||
}
|
||||
//
|
||||
aDTF=aDN1^aDBF;
|
||||
//
|
||||
@@ -850,8 +949,13 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCS.Shape2()));
|
||||
//
|
||||
aDTgt2 = (aE2.Orientation()==aOr) ? aDTgt : aDTgt.Reversed();
|
||||
GetFaceDir(aE2, aF2, aPx, aT, aDTgt2, aDN2, aDBF2, theContext,
|
||||
aProjPL, aDt3D);
|
||||
bIsComputed = GetFaceDir(aE2, aF2, aPx, aT, aDTgt2, bSmallFaces, aDN2,
|
||||
aDBF2, theContext, aProjPL, aDt3D);
|
||||
if (!bIsComputed) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "BOPTools_AlgoTools::GetFaceOff(): incorrect computation of bi-normal direction." << endl;
|
||||
#endif
|
||||
}
|
||||
//Angle
|
||||
aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
|
||||
//
|
||||
@@ -1002,7 +1106,8 @@ Standard_Boolean BOPTools_AlgoTools::CheckSameGeom
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2)
|
||||
const TopoDS_Face& theF2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Integer iSense=0;
|
||||
gp_Dir aDNF1, aDNF2;
|
||||
@@ -1036,8 +1141,8 @@ Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
|
||||
return iSense;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1, theContext);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2, theContext);
|
||||
//
|
||||
iSense=BOPTools_AlgoTools3D::SenseFlag(aDNF1, aDNF2);
|
||||
//
|
||||
@@ -1357,7 +1462,8 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF2,
|
||||
const IntTools_Curve& aIC,
|
||||
const Standard_Boolean bPC1,
|
||||
const Standard_Boolean bPC2)
|
||||
const Standard_Boolean bPC2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
|
||||
{
|
||||
Standard_Integer i;
|
||||
@@ -1392,19 +1498,19 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
|
||||
//
|
||||
aC2D=aC2Dx1;
|
||||
if (aC2D.IsNull()) {
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D,
|
||||
aOutFirst, aOutLast,
|
||||
aOutTol);
|
||||
aOutTol, theContext);
|
||||
}
|
||||
//
|
||||
if (aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D,
|
||||
aC2DA);
|
||||
aC2DA, theContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D,
|
||||
aC2DA);
|
||||
aC2DA, theContext);
|
||||
}
|
||||
//
|
||||
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
|
||||
@@ -1795,40 +1901,51 @@ Standard_Boolean BOPTools_AlgoTools::IsMicroEdge
|
||||
//function : GetFaceDir
|
||||
//purpose : Get binormal direction for the face in the point aP
|
||||
//=======================================================================
|
||||
void GetFaceDir(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real aT,
|
||||
const gp_Dir& aDTgt,
|
||||
gp_Dir& aDN,
|
||||
gp_Dir& aDB,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
GeomAPI_ProjectPointOnSurf& aProjPL,
|
||||
const Standard_Real aDt)
|
||||
Standard_Boolean GetFaceDir(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real aT,
|
||||
const gp_Dir& aDTgt,
|
||||
const Standard_Boolean theSmallFaces,
|
||||
gp_Dir& aDN,
|
||||
gp_Dir& aDB,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
GeomAPI_ProjectPointOnSurf& aProjPL,
|
||||
const Standard_Real aDt)
|
||||
{
|
||||
Standard_Real aTolE;
|
||||
gp_Pnt aPx;
|
||||
//
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN, theContext);
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDN.Reverse();
|
||||
}
|
||||
//
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
aDB = aDN^aDTgt;
|
||||
//
|
||||
if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt, aTolE)) {
|
||||
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx,
|
||||
aDN, theContext);
|
||||
// do not try to look for the point in the small face by intersecting
|
||||
// it with the circle because, most likely, the intersection point will
|
||||
// be out of the face
|
||||
Standard_Boolean bFound = !theSmallFaces &&
|
||||
FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt, aTolE);
|
||||
if (!bFound) {
|
||||
// if the first method did not succeed, try to use hatcher to find the point
|
||||
bFound = BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
(aE, aF, aT, aDt, aPx, aDN, theContext);
|
||||
aProjPL.Perform(aPx);
|
||||
aPx = aProjPL.NearestPoint();
|
||||
gp_Vec aVec(aP, aPx);
|
||||
aDB.SetXYZ(aVec.XYZ());
|
||||
}
|
||||
//
|
||||
return bFound;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindPointInFace
|
||||
//purpose : Find a point in the face in direction of <aDB>
|
||||
//purpose : Find a point in the face in direction of <aDB>.
|
||||
// To get this point the method intersects the circle with radius
|
||||
// <aDt> built in point <aP> with normal perpendicular to <aDB>.
|
||||
//=======================================================================
|
||||
Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
@@ -1903,33 +2020,38 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
|
||||
Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
const TopoDS_Face& theF1,
|
||||
const BOPTools_ListOfCoupleOfShape& theLCS,
|
||||
const gp_Pnt& aP)
|
||||
const gp_Pnt& aP,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
Standard_Boolean& theSmallFaces)
|
||||
{
|
||||
Standard_Real aDt, aTolE, aTolF, aDtMax, aDtMin, aR;
|
||||
BOPTools_CoupleOfShape aCS1;
|
||||
BOPTools_ListOfCoupleOfShape aLCS;
|
||||
BOPTools_ListIteratorOfListOfCoupleOfShape aIt;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
Standard_Real aDt, aTolE, aTolF, aDtMax, aDtMin;
|
||||
//
|
||||
aLCS = theLCS;
|
||||
// add the current pair of edge/face for checking as well
|
||||
BOPTools_CoupleOfShape aCS1;
|
||||
aCS1.SetShape1(theE1);
|
||||
aCS1.SetShape2(theF1);
|
||||
//
|
||||
BOPTools_ListOfCoupleOfShape aLCS = theLCS;
|
||||
aLCS.Append(aCS1);
|
||||
//
|
||||
aTolE = BRep_Tool::Tolerance(theE1);
|
||||
aDtMax = -1.;
|
||||
aDtMin = 5.e-6;
|
||||
//
|
||||
aIt.Initialize(aLCS);
|
||||
BOPTools_ListIteratorOfListOfCoupleOfShape aIt(aLCS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const BOPTools_CoupleOfShape& aCS = aIt.Value();
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aCS.Shape2()));
|
||||
//
|
||||
aTolF = BRep_Tool::Tolerance(aF);
|
||||
aDt = 2*(aTolE + aTolF);
|
||||
if (aDt > aDtMax) {
|
||||
aDtMax = aDt;
|
||||
}
|
||||
//
|
||||
aR = 0.;
|
||||
aBAS.Initialize(aF, Standard_False);
|
||||
// try to compute the minimal 3D step
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
Standard_Real aR = 0.;
|
||||
GeomAbs_SurfaceType aSType = aBAS.GetType();
|
||||
switch (aSType) {
|
||||
case GeomAbs_Cylinder: {
|
||||
@@ -1959,16 +2081,42 @@ Standard_Real MinStep3D(const TopoDS_Edge& theE1,
|
||||
Standard_Real d = 10*Precision::PConfusion();
|
||||
aDtMin = Max(aDtMin, sqrt(d*d + 2*d*aR));
|
||||
}
|
||||
//
|
||||
if (aDt > aDtMax) {
|
||||
aDtMax = aDt;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aDtMax < aDtMin) {
|
||||
aDtMax = aDtMin;
|
||||
}
|
||||
//
|
||||
// check if the computed 3D step is too big for any of the faces in the list
|
||||
aIt.Initialize(aLCS);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const BOPTools_CoupleOfShape& aCS = aIt.Value();
|
||||
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aCS.Shape2()));
|
||||
//
|
||||
const BRepAdaptor_Surface& aBAS = theContext->SurfaceAdaptor(aF);
|
||||
//
|
||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
||||
theContext->UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
Standard_Real aDU = aUMax - aUMin;
|
||||
if (aDU > 0.) {
|
||||
Standard_Real aURes = aBAS.UResolution(aDtMax);
|
||||
if (2*aURes > aDU) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
Standard_Real aDV = aVMax - aVMin;
|
||||
if (aDV > 0.) {
|
||||
Standard_Real aVRes = aBAS.VResolution(aDtMax);
|
||||
if (2*aVRes > aDV) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
theSmallFaces = aIt.More();
|
||||
//
|
||||
return aDtMax;
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -62,7 +62,15 @@ public:
|
||||
|
||||
Standard_EXPORT static void MakeEdge (const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, const Standard_Real theT1, const TopoDS_Vertex& theV2, const Standard_Real theT2, const Standard_Real theTolR3D, TopoDS_Edge& theE);
|
||||
|
||||
Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE, const TopoDS_Face& theF1, const TopoDS_Face& theF2, const IntTools_Curve& theCurve, const Standard_Boolean thePC1, const Standard_Boolean thePC2);
|
||||
//! Makes 2d curve of the edge <theE> on the faces <theF1> and <theF2>.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE,
|
||||
const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2,
|
||||
const IntTools_Curve& theCurve,
|
||||
const Standard_Boolean thePC1,
|
||||
const Standard_Boolean thePC2,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
Standard_EXPORT static void MakeContainer (const TopAbs_ShapeEnum theType, TopoDS_Shape& theShape);
|
||||
|
||||
@@ -88,7 +96,12 @@ public:
|
||||
|
||||
Standard_EXPORT static Standard_Boolean CheckSameGeom (const TopoDS_Face& theF1, const TopoDS_Face& theF2, Handle(IntTools_Context)& theContext);
|
||||
|
||||
Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1, const TopoDS_Face& theF2);
|
||||
//! Basing on the normals directions of the faces the method
|
||||
//! Defines whether to reverse the second face or not.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Returns True if the face theFace contains
|
||||
//! the edge theEdge but with opposite orientation.
|
||||
@@ -180,8 +193,12 @@ public:
|
||||
//! theLCB (as list of compounds)
|
||||
//! in terms of connexity by the shapes of theType
|
||||
Standard_EXPORT static void MakeConnexityBlocks (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2, BOPCol_ListOfShape& theLCB);
|
||||
|
||||
Standard_EXPORT static void OrientFacesOnShell (TopoDS_Shape& theS);
|
||||
|
||||
//! Correctly orients edges on the wire
|
||||
Standard_EXPORT static void OrientEdgesOnWire (TopoDS_Shape& theWire);
|
||||
|
||||
//! Correctly orients faces on the shell
|
||||
Standard_EXPORT static void OrientFacesOnShell (TopoDS_Shape& theShell);
|
||||
|
||||
|
||||
//! Provides valid values of tolerances for the shape <theS>
|
||||
|
@@ -57,6 +57,7 @@
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <ProjLib.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <TopExp.hxx>
|
||||
@@ -89,7 +90,8 @@ static
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF)
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
@@ -104,7 +106,7 @@ void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
|
||||
}
|
||||
|
||||
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, theContext);
|
||||
|
||||
aTolEdge=BRep_Tool::Tolerance(aE);
|
||||
|
||||
@@ -159,14 +161,14 @@ void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aParameter,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
Standard_Real& V,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
gp_Pnt2d aP2D;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
Standard_Real aToler, aFirst, aLast;
|
||||
|
||||
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
|
||||
aFirst, aLast, aToler);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, theContext);
|
||||
aC2D->D0(aParameter, aP2D);
|
||||
U=aP2D.X();
|
||||
V=aP2D.Y();
|
||||
@@ -180,12 +182,12 @@ void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
|
||||
void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC2D,
|
||||
Standard_Real& aToler)
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
//
|
||||
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
|
||||
aFirst, aLast, aToler);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aFirst, aLast, aToler, theContext);
|
||||
//
|
||||
return;
|
||||
}
|
||||
@@ -198,7 +200,8 @@ void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
|
||||
Handle(Geom2d_Curve)& aC2D,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler)
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean aHasOld;
|
||||
Handle(Geom2d_Curve) C2D;
|
||||
@@ -211,7 +214,7 @@ void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
|
||||
return;
|
||||
}
|
||||
|
||||
BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
|
||||
BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, theContext);
|
||||
aC2D=C2D;
|
||||
return;
|
||||
}
|
||||
@@ -247,7 +250,6 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
|
||||
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF)
|
||||
|
||||
{
|
||||
Standard_Boolean bHasOld;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
@@ -268,45 +270,51 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
(const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& aC3D,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
Handle(Geom2d_Curve)& aC2DA)
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
(const TopoDS_Face& theF,
|
||||
const Handle(Geom_Curve)& theC3D,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aT1, aT2;
|
||||
Standard_Real aT1 = theC3D->FirstParameter();
|
||||
Standard_Real aT2 = theC3D->LastParameter();
|
||||
//
|
||||
aT1=aC3D->FirstParameter();
|
||||
aT2=aC3D->LastParameter();
|
||||
//
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aT1, aT2, aC2D, aC2DA);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
(const TopoDS_Face& aF,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
Handle(Geom2d_Curve)& aC2DA)
|
||||
(const TopoDS_Face& theF,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
BRepAdaptor_Surface aBAS(aF, Standard_True);
|
||||
BRepAdaptor_Surface aBASTmp;
|
||||
const BRepAdaptor_Surface* pBAS;
|
||||
if (!theContext.IsNull()) {
|
||||
pBAS = &theContext->SurfaceAdaptor(theF);
|
||||
}
|
||||
else {
|
||||
aBASTmp.Initialize(theF, Standard_True);
|
||||
pBAS = &aBASTmp;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aBAS, aT1, aT2,
|
||||
aC2D, aC2DA);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(*pBAS, theFirst, theLast, theC2D, theC2DA);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustPCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
|
||||
(const BRepAdaptor_Surface& aBAS,
|
||||
const Standard_Real aFirst,
|
||||
const Standard_Real aLast,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
const Handle(Geom2d_Curve)& aC2D,
|
||||
Handle(Geom2d_Curve)& aC2DA)
|
||||
{
|
||||
Standard_Boolean mincond, maxcond;
|
||||
@@ -319,9 +327,6 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnFace
|
||||
VMin=aBAS.FirstVParameter();
|
||||
VMax=aBAS.LastVParameter();
|
||||
//
|
||||
//BRepAdaptor_Surface aBAS(aF, Standard_False);
|
||||
//BRepTools::UVBounds(aF, UMin, UMax, VMin, VMax);
|
||||
//
|
||||
aDelta=Precision::PConfusion();
|
||||
|
||||
aT =.5*(aFirst+aLast);
|
||||
@@ -534,7 +539,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
|
||||
Handle(Geom2d_Curve)& aC2D,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler)
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean aLocIdentity;
|
||||
Standard_Real f3d, l3d;
|
||||
@@ -569,7 +575,7 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
|
||||
|
||||
//
|
||||
aToler = BRep_Tool::Tolerance(aE);
|
||||
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
|
||||
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler, theContext);
|
||||
//
|
||||
aFirst = f3d;
|
||||
aLast = l3d;
|
||||
@@ -582,7 +588,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
|
||||
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& aC3D,
|
||||
Handle(Geom2d_Curve)& aC2D, //->
|
||||
Standard_Real& TolReached2d)
|
||||
Standard_Real& TolReached2d,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
|
||||
@@ -591,43 +598,39 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
//
|
||||
TolReached2d=0.;
|
||||
//
|
||||
BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst,
|
||||
aLast, aC2D, TolReached2d);
|
||||
BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
(aF, aC3D, aFirst, aLast, aC2D, TolReached2d, theContext);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakePCurveOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
(const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& aC3D,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
Handle(Geom2d_Curve)& aC2D,
|
||||
Standard_Real& TolReached2d)
|
||||
Handle(Geom2d_Curve)& aC2D,
|
||||
Standard_Real& TolReached2d,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aTolR, aT;
|
||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
||||
Handle(Geom2d_Curve) aC2DA;
|
||||
Handle(GeomAdaptor_HSurface) aBAHS;
|
||||
Handle(GeomAdaptor_HCurve) aBAHC;
|
||||
Handle(Geom_Surface) aS;
|
||||
BRepAdaptor_Surface aBASTmp;
|
||||
const BRepAdaptor_Surface* pBAS;
|
||||
if (!theContext.IsNull()) {
|
||||
pBAS = &theContext->SurfaceAdaptor(aF);
|
||||
}
|
||||
else {
|
||||
aBASTmp.Initialize(aF, Standard_True);
|
||||
pBAS = &aBASTmp;
|
||||
}
|
||||
//
|
||||
BRepAdaptor_Surface aBAS(aF, Standard_True);
|
||||
aUMin=aBAS.FirstUParameter();
|
||||
aUMax=aBAS.LastUParameter();
|
||||
aVMin=aBAS.FirstVParameter();
|
||||
aVMax=aBAS.LastVParameter();
|
||||
aS=aBAS.Surface().Surface();
|
||||
aS=Handle(Geom_Surface)::DownCast(aS->Transformed(aBAS.Trsf()));
|
||||
GeomAdaptor_Surface aGAS(aS, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
aBAHS=new GeomAdaptor_HSurface(aGAS);
|
||||
aBAHC=new GeomAdaptor_HCurve(aC3D, aT1, aT2);
|
||||
Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(*pBAS);
|
||||
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aT1, aT2);
|
||||
//
|
||||
Standard_Real aTolR;
|
||||
//when the type of surface is GeomAbs_SurfaceOfRevolution
|
||||
if (aGAS.GetType() == GeomAbs_SurfaceOfRevolution) {
|
||||
if (pBAS->GetType() == GeomAbs_SurfaceOfRevolution) {
|
||||
Standard_Real aTR;
|
||||
//
|
||||
aTR=Precision::Confusion();//1.e-7;
|
||||
@@ -636,24 +639,24 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
}
|
||||
//
|
||||
ProjLib_ProjectedCurve aProj1(aBAHS, aBAHC, aTR);
|
||||
BOPTools_AlgoTools2D::MakePCurveOfType(aProj1, aC2D);
|
||||
ProjLib::MakePCurveOfType(aProj1, aC2D);
|
||||
aTolR = aProj1.GetTolerance();
|
||||
}
|
||||
else {
|
||||
ProjLib_ProjectedCurve aProjCurv(aBAHS, aBAHC);// 1
|
||||
BOPTools_AlgoTools2D::MakePCurveOfType(aProjCurv, aC2D);
|
||||
ProjLib::MakePCurveOfType(aProjCurv, aC2D);
|
||||
aTolR=aProjCurv.GetTolerance();
|
||||
}
|
||||
//
|
||||
if (aC2D.IsNull()) {
|
||||
ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, TolReached2d);// 2
|
||||
BOPTools_AlgoTools2D::MakePCurveOfType(aProjCurvAgain, aC2D);
|
||||
ProjLib::MakePCurveOfType(aProjCurvAgain, aC2D);
|
||||
aTolR = aProjCurvAgain.GetTolerance();
|
||||
//
|
||||
if (aC2D.IsNull()) {
|
||||
Standard_Real aTR=0.0001;
|
||||
ProjLib_ProjectedCurve aProj3(aBAHS, aBAHC, aTR);// 3
|
||||
BOPTools_AlgoTools2D::MakePCurveOfType(aProj3, aC2D);
|
||||
ProjLib::MakePCurveOfType(aProj3, aC2D);
|
||||
aTolR = aProj3.GetTolerance();
|
||||
}
|
||||
}
|
||||
@@ -664,12 +667,17 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
}
|
||||
//
|
||||
TolReached2d=aTolR;
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aBAS, aT1, aT2,
|
||||
aC2D, aC2DA);
|
||||
//
|
||||
Handle(Geom2d_Curve) aC2DA;
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
|
||||
//
|
||||
aC2D=aC2DA;
|
||||
//
|
||||
// compute the appropriate tolerance for the edge
|
||||
Handle(Geom_Surface) aS = pBAS->Surface().Surface();
|
||||
aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
|
||||
//
|
||||
Standard_Real aT;
|
||||
if (IntTools_Tools::ComputeTolerance
|
||||
(aC3D, aC2D, aS, aT1, aT2, aTolR, aT)) {
|
||||
if (aTolR > TolReached2d) {
|
||||
@@ -678,43 +686,6 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakePCurveOfType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools2D::MakePCurveOfType
|
||||
(const ProjLib_ProjectedCurve& PC,
|
||||
Handle(Geom2d_Curve)& C2D)
|
||||
{
|
||||
|
||||
switch (PC.GetType()) {
|
||||
|
||||
case GeomAbs_Line :
|
||||
C2D = new Geom2d_Line(PC.Line());
|
||||
break;
|
||||
case GeomAbs_Circle :
|
||||
C2D = new Geom2d_Circle(PC.Circle());
|
||||
break;
|
||||
case GeomAbs_Ellipse :
|
||||
C2D = new Geom2d_Ellipse(PC.Ellipse());
|
||||
break;
|
||||
case GeomAbs_Parabola :
|
||||
C2D = new Geom2d_Parabola(PC.Parabola());
|
||||
break;
|
||||
case GeomAbs_Hyperbola :
|
||||
C2D = new Geom2d_Hyperbola(PC.Hyperbola());
|
||||
break;
|
||||
case GeomAbs_BSplineCurve :
|
||||
C2D = PC.BSpline();
|
||||
break;
|
||||
case GeomAbs_BezierCurve :
|
||||
case GeomAbs_OtherCurve :
|
||||
default :
|
||||
Standard_NotImplemented::Raise
|
||||
("BOPTools_AlgoTools2D::MakePCurveOfType");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CheckEdgeLength
|
||||
//purpose :
|
||||
@@ -926,4 +897,4 @@ void BOPTools_AlgoTools2D::IsEdgeIsoline( const TopoDS_Edge& theE,
|
||||
|
||||
isTheUIso = (aDPv <= aTol);
|
||||
isTheVIso = (aDPu <= aTol);
|
||||
}
|
||||
}
|
||||
|
@@ -45,9 +45,12 @@ public:
|
||||
|
||||
|
||||
|
||||
//! Compute P-Curve for the edge <aE> on the face <aF>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails
|
||||
Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF);
|
||||
//! Compute P-Curve for the edge <aE> on the face <aF>.<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
|
||||
@@ -55,26 +58,43 @@ public:
|
||||
|
||||
|
||||
//! Compute surface parameters <U,V> of the face <aF>
|
||||
//! for the point from the edge <aE> at parameter <aT>.
|
||||
//! for the point from the edge <aE> at parameter <aT>.<br>
|
||||
//! If <aE> has't pcurve on surface, algorithm tries to get it by
|
||||
//! projection and can
|
||||
//! raise exception Standard_ConstructionError if projection algorithm fails
|
||||
Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, Standard_Real& U, Standard_Real& V);
|
||||
//! raise exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .
|
||||
//! If the P-Curve does not exist, build it using Make2D().
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! If the P-Curve does not exist, build it using Make2D().<br>
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
|
||||
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .
|
||||
//! If the P-Curve does not exist, build it using Make2D().
|
||||
//! [aFirst, aLast] - range of the P-Curve
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
|
||||
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! If the P-Curve does not exist, build it using Make2D().<br>
|
||||
//! [aFirst, aLast] - range of the P-Curve<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Returns TRUE if the edge <aE> has P-Curve <aC>
|
||||
@@ -91,18 +111,28 @@ public:
|
||||
Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
|
||||
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
|
||||
//! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
|
||||
const Handle(Geom_Curve)& theC3D,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
|
||||
//! [aT1, aT2] - range to adjust<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& theC2D,
|
||||
Handle(Geom2d_Curve)& theC2DA,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
|
||||
//! [aT1, aT2] - range to adjust
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
|
||||
|
||||
|
||||
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
|
||||
//! [aT1, aT2] - range to adjust
|
||||
Standard_EXPORT static void AdjustPCurveOnFace (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
|
||||
Standard_EXPORT static void AdjustPCurveOnSurf (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
|
||||
|
||||
|
||||
//! Compute intermediate value in between [aFirst, aLast] .
|
||||
@@ -123,30 +153,44 @@ public:
|
||||
Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF);
|
||||
|
||||
|
||||
//! Make P-Curve <aC> for the edge <aE> on surface <aF> .
|
||||
//! [aFirst, aLast] - range of the P-Curve
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if algorithm fails
|
||||
Standard_EXPORT static void Make2D (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
|
||||
//! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
|
||||
//! [aFirst, aLast] - range of the P-Curve<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void Make2D (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aFirst,
|
||||
Standard_Real& aLast,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
|
||||
//! [aT1, aT2] - range to build
|
||||
//! [aToler] - reached tolerance
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Standard_Real aT1, const Standard_Real aT2, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
|
||||
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
|
||||
//! [aT1, aT2] - range to build<br>
|
||||
//! [aToler] - reached tolerance<br>
|
||||
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
Handle(Geom2d_Curve)& aC,
|
||||
Standard_Real& aToler,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Make empty P-Curve <aC> of relevant to <PC> type
|
||||
Standard_EXPORT static void MakePCurveOfType (const ProjLib_ProjectedCurve& PC, Handle(Geom2d_Curve)& aC);
|
||||
|
||||
|
||||
//! Attach P-Curve from the edge <aEold> on surface <aF>
|
||||
//! to the edge <aEnew>
|
||||
//! Returns 0 in case of success
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
@@ -127,21 +128,39 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
aBB.SameRange(aE1, Standard_False);
|
||||
aBB.SameParameter(aE1, Standard_False);
|
||||
// create a temporary edge to make same parameter pcurve
|
||||
TopoDS_Edge aE1T;
|
||||
aBB.MakeEdge(aE1T, aCE1, aTol);
|
||||
aBB.Range(aE1T, aT11, aT12);
|
||||
aBB.SameRange(aE1T, Standard_False);
|
||||
aBB.SameParameter(aE1T, Standard_False);
|
||||
//
|
||||
aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
|
||||
BRepLib::SameParameter(aE1);
|
||||
BRepLib::SameRange(aE1);
|
||||
aBB.UpdateEdge(aE1T, aC2DT, aF, aTol);
|
||||
try {
|
||||
BRepLib::SameParameter(aE1T);
|
||||
BRepLib::SameRange(aE1T);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
iRet = 6;
|
||||
return iRet;
|
||||
}
|
||||
//
|
||||
bIsClosed = IsClosed(aE2, aF);
|
||||
if (bIsClosed) {
|
||||
iRet = UpdateClosedPCurve(aE2, aE1, aF, aCtx);
|
||||
iRet = UpdateClosedPCurve(aE2, aE1T, aF, aCtx);
|
||||
if(iRet) {
|
||||
iRet = 5;
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
//
|
||||
// transfer pcurve(s) from the temporary edge to the new edge
|
||||
aBB.Transfert(aE1T, aE1);
|
||||
// update tolerance of vertices
|
||||
Standard_Real aNewTol = BRep_Tool::Tolerance(aE1T);
|
||||
TopoDS_Iterator it(aE1);
|
||||
for (; it.More(); it.Next())
|
||||
aBB.UpdateVertex(TopoDS::Vertex(it.Value()), aNewTol);
|
||||
return iRet;
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <BRep_TFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_TVertex.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
@@ -231,14 +230,15 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
gp_Dir& aDNF)
|
||||
gp_Dir& aDNF,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aT, aT1, aT2;
|
||||
|
||||
BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
|
||||
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
|
||||
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
|
||||
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF, theContext);
|
||||
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
@@ -251,7 +251,8 @@ void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF1,
|
||||
const Standard_Real aT,
|
||||
gp_Dir& aDNF1)
|
||||
gp_Dir& aDNF1,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real U, V, aTolPC;
|
||||
gp_Pnt2d aP2D;
|
||||
@@ -261,7 +262,7 @@ void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
|
||||
|
||||
Handle(Geom2d_Curve)aC2D1;
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC);
|
||||
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC, theContext);
|
||||
|
||||
aC2D1->D0(aT, aP2D);
|
||||
U=aP2D.X();
|
||||
@@ -330,7 +331,7 @@ Standard_Boolean BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
//function : GetApproxNormalToFaceOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
Standard_Boolean BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
@@ -338,29 +339,27 @@ void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
gp_Dir& aDNF,
|
||||
Standard_Real aDt2D)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aC2D=
|
||||
BRep_Tool::CurveOnSurface (aE, aF, aFirst, aLast);
|
||||
|
||||
if (aC2D.IsNull()) {
|
||||
return;
|
||||
}
|
||||
gp_Pnt2d aPx2DNear;
|
||||
PointNearEdge (aE, aF, aT, aDt2D, aPx2DNear, aPNear);
|
||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aE, aF, aT, aDt2D, aPx2DNear, aPNear);
|
||||
if (iErr != 1) {
|
||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
||||
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
(aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
(aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
|
||||
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
return (iErr == 0);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetApproxNormalToFaceOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
Standard_Boolean BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
@@ -368,37 +367,62 @@ void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
gp_Dir& aDNF,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aC2D=
|
||||
BRep_Tool::CurveOnSurface (aE, aF, aFirst, aLast);
|
||||
|
||||
if (aC2D.IsNull()) {
|
||||
return;
|
||||
}
|
||||
//gp_Pnt aPNear;
|
||||
gp_Pnt2d aPx2DNear;
|
||||
BOPTools_AlgoTools3D::PointNearEdge
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aE, aF, aT, aPx2DNear, aPNear, theContext);
|
||||
if (iErr != 1) {
|
||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
||||
|
||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
(aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
|
||||
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
(aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
|
||||
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
return (iErr == 0);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetApproxNormalToFaceOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real theStep,
|
||||
gp_Pnt& aPNear,
|
||||
gp_Dir& aDNF,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
gp_Pnt2d aPx2DNear;
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aE, aF, aT, theStep, aPx2DNear, aPNear, theContext);
|
||||
if (iErr != 1) {
|
||||
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
|
||||
|
||||
BOPTools_AlgoTools3D::GetNormalToSurface
|
||||
(aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
|
||||
|
||||
if (aF.Orientation()==TopAbs_REVERSED){
|
||||
aDNF.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
return (iErr == 0);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointNearEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::PointNearEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real aDt2D,
|
||||
gp_Pnt2d& aPx2DNear,
|
||||
gp_Pnt& aPxNear)
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointNearEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real aDt2D,
|
||||
gp_Pnt2d& aPx2DNear,
|
||||
gp_Pnt& aPxNear)
|
||||
{
|
||||
Standard_Real aFirst, aLast, aETol, aFTol, transVal;
|
||||
GeomAbs_SurfaceType aTS;
|
||||
@@ -406,9 +430,9 @@ void BOPTools_AlgoTools3D::PointNearEdge (const TopoDS_Edge& aE,
|
||||
Handle(Geom_Surface) aS;
|
||||
//
|
||||
aC2D= BRep_Tool::CurveOnSurface (aE, aF, aFirst, aLast);
|
||||
if (aC2D.IsNull()) {
|
||||
aPx2DNear.SetCoord (99., 99);
|
||||
return;
|
||||
Standard_Integer iErr = aC2D.IsNull() ? 1 : 0;
|
||||
if (iErr) {
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
@@ -470,12 +494,13 @@ void BOPTools_AlgoTools3D::PointNearEdge (const TopoDS_Edge& aE,
|
||||
}
|
||||
//
|
||||
aS->D0(aPx2DNear.X(), aPx2DNear.Y(), aPxNear);
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointNearEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::PointNearEdge
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointNearEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
@@ -494,7 +519,7 @@ void BOPTools_AlgoTools3D::PointNearEdge
|
||||
if (aGAS.GetType()==GeomAbs_Cylinder ||
|
||||
aGAS.GetType()==GeomAbs_Sphere) {
|
||||
dT2D=10.*dT2D;
|
||||
}
|
||||
}
|
||||
//
|
||||
aTolE = BRep_Tool::Tolerance(aE);
|
||||
aTolF = BRep_Tool::Tolerance(aF);
|
||||
@@ -503,39 +528,63 @@ void BOPTools_AlgoTools3D::PointNearEdge
|
||||
dT2D=dTx;
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools3D::PointNearEdge
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aE, aF, aT, dT2D, aPx2DNear, aPxNear);
|
||||
if (!theContext->IsPointInOnFace(aF, aPx2DNear)) {
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aU1, aU2, aV1, aV2, dV, dU, dTresh;
|
||||
if ((iErr != 1) && !theContext->IsPointInOnFace(aF, aPx2DNear)) {
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2d;
|
||||
//
|
||||
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
|
||||
//
|
||||
dU=aU2-aU1;
|
||||
dV=aV2-aV1;
|
||||
//
|
||||
dTresh=1.e-4;
|
||||
if (dT2D > dTresh) {
|
||||
dTresh=dT2D;
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||
(aF, aE, aT, dT2D, aP, aP2d, theContext);
|
||||
if (iErr == 0) {
|
||||
aPxNear = aP;
|
||||
aPx2DNear = aP2d;
|
||||
}
|
||||
//
|
||||
if (dU < dTresh || dV < dTresh) {
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||
(aF, aP, aP2d, theContext);
|
||||
if (!iErr) {
|
||||
aPxNear = aP;
|
||||
aPx2DNear = aP2d;
|
||||
}
|
||||
else {
|
||||
iErr = 2; // point is out of the face
|
||||
}
|
||||
}
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointNearEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointNearEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real theStep,
|
||||
gp_Pnt2d& aPx2DNear,
|
||||
gp_Pnt& aPxNear,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aE, aF, aT, theStep, aPx2DNear, aPxNear);
|
||||
if ((iErr != 1) && !theContext->IsPointInOnFace(aF, aPx2DNear)) {
|
||||
gp_Pnt aP;
|
||||
gp_Pnt2d aP2d;
|
||||
//
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||
(aF, aE, aT, theStep, aP, aP2d, theContext);
|
||||
if (iErr == 0) {
|
||||
aPxNear = aP;
|
||||
aPx2DNear = aP2d;
|
||||
}
|
||||
else {
|
||||
iErr = 2; // point is out of the face
|
||||
}
|
||||
}
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: PointNearEdge
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPTools_AlgoTools3D::PointNearEdge
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointNearEdge
|
||||
(const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
gp_Pnt2d& aPInFace2D,
|
||||
@@ -544,18 +593,20 @@ void BOPTools_AlgoTools3D::PointNearEdge
|
||||
{
|
||||
Standard_Real aT, aT1, aT2;
|
||||
//
|
||||
// 1.
|
||||
// 1. compute parameter on edge
|
||||
BRep_Tool::Range(aE, aT1, aT2);
|
||||
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
|
||||
//
|
||||
// 2. a Point inside Face near aPOnEdge aPInFace;
|
||||
// 2. compute point inside the face near the edge
|
||||
TopoDS_Face aFF=aF;
|
||||
TopoDS_Edge aERight;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
BOPTools_AlgoTools3D::OrientEdgeOnFace (aE, aFF, aERight);
|
||||
|
||||
BOPTools_AlgoTools3D::PointNearEdge
|
||||
//
|
||||
Standard_Integer iErr = BOPTools_AlgoTools3D::PointNearEdge
|
||||
(aERight, aFF, aT, aPInFace2D, aPInFace, theContext);
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MinStepIn2d
|
||||
@@ -725,103 +776,158 @@ void BOPTools_AlgoTools3D::OrientEdgeOnFace (const TopoDS_Edge& aE,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointInFace
|
||||
(const TopoDS_Face& aF,
|
||||
(const TopoDS_Face& theF,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
|
||||
Standard_Integer iErr, aIx = 0, aNbDomains = 0;
|
||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
||||
Standard_Real aVx = 0., aUx, aV1, aV2;
|
||||
gp_Dir2d aD2D (0., 1.);
|
||||
gp_Pnt2d aP2D;
|
||||
gp_Pnt aPx;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
Handle(Geom2d_Line) aL2D;
|
||||
Handle(Geom_Surface) aS;
|
||||
TopoDS_Face aFF;
|
||||
Standard_Integer i, iErr = 1;
|
||||
Standard_Real aUMin, aUMax, aVMin, aVMax, aUx;
|
||||
//
|
||||
Geom2dHatch_Hatcher& aHatcher = theContext->Hatcher(aF);
|
||||
theContext->UVBounds(theF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
iErr=0;
|
||||
gp_Dir2d aD2D(0. , 1.);
|
||||
aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax);
|
||||
//
|
||||
aFF=aF;
|
||||
aFF.Orientation (TopAbs_FORWARD);
|
||||
//
|
||||
aS=BRep_Tool::Surface(aFF);
|
||||
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
|
||||
//
|
||||
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
|
||||
Standard_Integer i;
|
||||
for(i = 1; i <= 2; ++i)
|
||||
{
|
||||
aP2D.SetCoord(aUx, 0.);
|
||||
aL2D=new Geom2d_Line (aP2D, aD2D);
|
||||
Geom2dAdaptor_Curve aHCur(aL2D);
|
||||
//
|
||||
aIx=aHatcher.AddHatching(aHCur) ;
|
||||
//
|
||||
aHatcher.Trim(aIx);
|
||||
bIsDone=aHatcher.TrimDone(aIx);
|
||||
if (!bIsDone) {
|
||||
iErr=1;
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
if(aHatcher.NbPoints(aIx) > 1)
|
||||
{
|
||||
aHatcher.ComputeDomains(aIx);
|
||||
bIsDone=aHatcher.IsDone(aIx);
|
||||
if (!bIsDone) {
|
||||
iErr=2;
|
||||
return iErr;
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
gp_Pnt2d aP2D(aUx, 0.);
|
||||
Handle(Geom2d_Line) aL2D = new Geom2d_Line (aP2D, aD2D);
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||
(theF, aL2D, theP, theP2D, theContext);
|
||||
if (iErr == 0) {
|
||||
// done
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// possible reason - incorrect computation of the 2d box of the face.
|
||||
// try to compute the point with the translated line.
|
||||
aUx = aUMax - (aUx - aUMin);
|
||||
}
|
||||
}
|
||||
//
|
||||
if(!aHatcher.IsDone(aIx))
|
||||
{
|
||||
iErr=2;
|
||||
return iErr;
|
||||
}
|
||||
|
||||
aNbDomains=aHatcher.NbDomains(aIx);
|
||||
if (aNbDomains > 0) {
|
||||
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, 1);
|
||||
bHasFirstPoint=aDomain.HasFirstPoint();
|
||||
if (!bHasFirstPoint) {
|
||||
iErr=3;
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
aV1=aDomain.FirstPoint().Parameter();
|
||||
//
|
||||
bHasSecondPoint=aDomain.HasSecondPoint();
|
||||
if (!bHasSecondPoint) {
|
||||
iErr=4;
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
aV2=aDomain.SecondPoint().Parameter();
|
||||
//
|
||||
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
|
||||
//
|
||||
}
|
||||
else {
|
||||
iErr=2;
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointInFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointInFace
|
||||
(const TopoDS_Face& theF,
|
||||
const TopoDS_Edge& theE,
|
||||
const Standard_Real theT,
|
||||
const Standard_Real theDt2D,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Integer iErr;
|
||||
Standard_Real f, l;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
//
|
||||
iErr = 0;
|
||||
aC2D = BRep_Tool::CurveOnSurface (theE, theF, f, l);
|
||||
if (aC2D.IsNull()) {
|
||||
iErr = 5;
|
||||
return iErr;
|
||||
}
|
||||
//
|
||||
aS->D0(aUx, aVx, aPx);
|
||||
gp_Pnt2d aP2D;
|
||||
gp_Vec2d aV2D;
|
||||
//
|
||||
theP2D.SetCoord(aUx, aVx);
|
||||
theP=aPx;
|
||||
aC2D->D1(theT, aP2D, aV2D);
|
||||
gp_Dir2d aD2Dx(aV2D);
|
||||
//
|
||||
gp_Dir2d aD2D;
|
||||
aD2D.SetCoord (-aD2Dx.Y(), aD2Dx.X());
|
||||
//
|
||||
if (theE.Orientation()==TopAbs_REVERSED){
|
||||
aD2D.Reverse();
|
||||
}
|
||||
//
|
||||
if (theF.Orientation()==TopAbs_REVERSED) {
|
||||
aD2D.Reverse();
|
||||
}
|
||||
//
|
||||
Handle(Geom2d_Line) aL2D = new Geom2d_Line(aP2D, aD2D);
|
||||
Handle(Geom2d_TrimmedCurve) aL2DTrim =
|
||||
new Geom2d_TrimmedCurve(aL2D, 0., Precision::Infinite());
|
||||
//
|
||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||
(theF, aL2DTrim, theP, theP2D, theContext, theDt2D);
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PointInFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPTools_AlgoTools3D::PointInFace
|
||||
(const TopoDS_Face& theF,
|
||||
const Handle(Geom2d_Curve)& theL2D,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
const Standard_Real theDt2D)
|
||||
{
|
||||
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
|
||||
Standard_Integer iErr, aIH, aNbDomains;
|
||||
Standard_Real aVx, aV1, aV2;
|
||||
//
|
||||
Geom2dHatch_Hatcher& aHatcher = theContext->Hatcher(theF);
|
||||
//
|
||||
Geom2dAdaptor_Curve aHCur(theL2D);
|
||||
//
|
||||
aHatcher.ClrHatchings();
|
||||
aIH = aHatcher.AddHatching(aHCur);
|
||||
//
|
||||
iErr = 0;
|
||||
for (;;) {
|
||||
aHatcher.Trim();
|
||||
bIsDone = aHatcher.TrimDone(aIH);
|
||||
if (!bIsDone) {
|
||||
iErr = 1;
|
||||
break;
|
||||
}
|
||||
//
|
||||
aHatcher.ComputeDomains(aIH);
|
||||
bIsDone = aHatcher.IsDone(aIH);
|
||||
if (!bIsDone) {
|
||||
iErr = 2;
|
||||
break;
|
||||
}
|
||||
//
|
||||
aNbDomains = aHatcher.NbDomains(aIH);
|
||||
if (aNbDomains == 0) {
|
||||
iErr = 2;
|
||||
break;
|
||||
}
|
||||
//
|
||||
const HatchGen_Domain& aDomain = aHatcher.Domain (aIH, 1);
|
||||
bHasFirstPoint = aDomain.HasFirstPoint();
|
||||
if (!bHasFirstPoint) {
|
||||
iErr = 3;
|
||||
break;
|
||||
}
|
||||
//
|
||||
bHasSecondPoint = aDomain.HasSecondPoint();
|
||||
if (!bHasSecondPoint) {
|
||||
iErr = 4;
|
||||
break;
|
||||
}
|
||||
//
|
||||
aV1 = aDomain.FirstPoint().Parameter();
|
||||
aV2 = aDomain.SecondPoint().Parameter();
|
||||
//
|
||||
aVx = (theDt2D > 0. && (aV2 - aV1) > theDt2D) ? (aV1 + theDt2D) :
|
||||
IntTools_Tools::IntermediatePoint(aV1, aV2);
|
||||
//
|
||||
Handle(Geom_Surface) aS = BRep_Tool::Surface(theF);
|
||||
//
|
||||
theL2D->D0(aVx, theP2D);
|
||||
aS->D0(theP2D.X(), theP2D.Y(), theP);
|
||||
break;
|
||||
}
|
||||
//
|
||||
aHatcher.RemHatching(aIH);
|
||||
return iErr;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class gp_Dir;
|
||||
class Geom_Surface;
|
||||
class Geom2d_Curve;
|
||||
class gp_Pnt;
|
||||
class IntTools_Context;
|
||||
class gp_Pnt2d;
|
||||
@@ -45,64 +46,169 @@ public:
|
||||
|
||||
|
||||
//! Make the edge <aSp> seam edge for the face <aF>
|
||||
Standard_EXPORT static void DoSplitSEAMOnFace (const TopoDS_Edge& aSp, const TopoDS_Face& aF);
|
||||
Standard_EXPORT static void DoSplitSEAMOnFace (const TopoDS_Edge& aSp,
|
||||
const TopoDS_Face& aF);
|
||||
|
||||
//! Computes normal to the face <aF> for the point on the edge <aE>
|
||||
//! at parameter <aT>.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
gp_Dir& aD,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Computes normal to the face <aF> for the point on the edge <aE>
|
||||
//! at parameter <aT>
|
||||
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, gp_Dir& aD);
|
||||
//! at arbitrary intermediate parameter.<br>
|
||||
//! <theContext> - storage for caching the geometrical tools
|
||||
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
gp_Dir& aD,
|
||||
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
|
||||
|
||||
|
||||
//! Computes normal to the face <aF> for the point on the edge <aE>
|
||||
//! at arbitrary intermediate parameter
|
||||
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, gp_Dir& aD);
|
||||
|
||||
|
||||
//! Returns 1 if scalar product aNF1* aNF2>0.
|
||||
//! Returns 0 if directions aNF1 aNF2 coinside
|
||||
//! Returns 1 if scalar product aNF1* aNF2>0.<br>
|
||||
//! Returns 0 if directions aNF1 aNF2 coincide<br>
|
||||
//! Returns -1 if scalar product aNF1* aNF2<0.
|
||||
Standard_EXPORT static Standard_Integer SenseFlag (const gp_Dir& aNF1, const gp_Dir& aNF2);
|
||||
|
||||
Standard_EXPORT static Standard_Integer SenseFlag (const gp_Dir& aNF1,
|
||||
const gp_Dir& aNF2);
|
||||
|
||||
//! Compute normal <aD> to surface <aS> in point (U,V)
|
||||
//! Returns TRUE if directions aD1U, aD1V coinside
|
||||
Standard_EXPORT static Standard_Boolean GetNormalToSurface (const Handle(Geom_Surface)& aS, const Standard_Real U, const Standard_Real V, gp_Dir& aD);
|
||||
|
||||
//! Returns TRUE if directions aD1U, aD1V coincide
|
||||
Standard_EXPORT static Standard_Boolean GetNormalToSurface (const Handle(Geom_Surface)& aS,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Dir& aD);
|
||||
|
||||
//! Computes normal to the face <aF> for the 3D-point that
|
||||
//! belonds to the edge <aE> at parameter <aT>.
|
||||
//! Output:
|
||||
//! aPx - the 3D-point where the normal computed
|
||||
//! aD - the normal;
|
||||
//!
|
||||
//! Warning:
|
||||
//! belongs to the edge <aE> at parameter <aT>.<br>
|
||||
//! Output:<br>
|
||||
//! aPx - the 3D-point where the normal computed<br>
|
||||
//! aD - the normal;<br>
|
||||
//! Warning:<br>
|
||||
//! The normal is computed not exactly in the point on the
|
||||
//! edge, but in point that is near to the edge towards to
|
||||
//! the face material (so, we'll have approx. normal)
|
||||
Standard_EXPORT static void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, gp_Pnt& aPx, gp_Dir& aD, Handle(IntTools_Context)& theContext);
|
||||
//! the face material (so, we'll have approx. normal);<br>
|
||||
//! The point is computed using PointNearEdge function,
|
||||
//! with the shifting value BOPTools_AlgoTools3D::MinStepIn2d(),
|
||||
//! from the edge, but if this value is too big,
|
||||
//! the point will be computed using Hatcher (PointInFace function).<br>
|
||||
//! Returns TRUE in case of success.
|
||||
Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt& aPx,
|
||||
gp_Dir& aD,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
Standard_EXPORT static void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& theE, const TopoDS_Face& theF, const Standard_Real aT, gp_Pnt& aP, gp_Dir& aDNF, const Standard_Real aDt2D);
|
||||
//! Computes normal to the face <aF> for the 3D-point that
|
||||
//! belongs to the edge <aE> at parameter <aT>.<br>
|
||||
//! Output:<br>
|
||||
//! aPx - the 3D-point where the normal computed<br>
|
||||
//! aD - the normal;<br>
|
||||
//! Warning:<br>
|
||||
//! The normal is computed not exactly in the point on the
|
||||
//! edge, but in point that is near to the edge towards to
|
||||
//! the face material (so, we'll have approx. normal);<br>
|
||||
//! The point is computed using PointNearEdge function
|
||||
//! with the shifting value <aDt2D> from the edge;<br>
|
||||
//! No checks on this value will be done.<br>
|
||||
//! Returns TRUE in case of success.
|
||||
Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& theE,
|
||||
const TopoDS_Face& theF,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt& aP,
|
||||
gp_Dir& aDNF,
|
||||
const Standard_Real aDt2D);
|
||||
|
||||
//! Computes normal to the face <aF> for the 3D-point that
|
||||
//! belongs to the edge <aE> at parameter <aT>.<br>
|
||||
//! Output:<br>
|
||||
//! aPx - the 3D-point where the normal computed<br>
|
||||
//! aD - the normal;<br>
|
||||
//! Warning:<br>
|
||||
//! The normal is computed not exactly in the point on the
|
||||
//! edge, but in point that is near to the edge towards to
|
||||
//! the face material (so, we'll have approx. normal);<br>
|
||||
//! The point is computed using PointNearEdge function
|
||||
//! with the shifting value <aDt2D> from the edge,
|
||||
//! but if this value is too big the point will be
|
||||
//! computed using Hatcher (PointInFace function).<br>
|
||||
//! Returns TRUE in case of success.
|
||||
Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& theE,
|
||||
const TopoDS_Face& theF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real aDt2D,
|
||||
gp_Pnt& aP,
|
||||
gp_Dir& aDNF,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
//! Compute the point <aPx>, (<aP2D>) that is near to
|
||||
//! the edge <aE> at parameter <aT> towards to the
|
||||
//! material of the face <aF>. The value of shifting in
|
||||
//! 2D is <aDt2D>
|
||||
Standard_EXPORT static void PointNearEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, const Standard_Real aDt2D, gp_Pnt2d& aP2D, gp_Pnt& aPx);
|
||||
|
||||
//! 2D is <aDt2D><br>
|
||||
//! If the value of shifting is too big the point
|
||||
//! will be computed using Hatcher (PointInFace function).<br>
|
||||
//! Returns error status:<br>
|
||||
//! 0 - in case of success;<br>
|
||||
//! 1 - <aE> does not have 2d curve on the face <aF>;<br>
|
||||
//! 2 - the computed point is out of the face.
|
||||
Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real aDt2D,
|
||||
gp_Pnt2d& aP2D,
|
||||
gp_Pnt& aPx,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
//! Compute the point <aPx>, (<aP2D>) that is near to
|
||||
//! the edge <aE> at parameter <aT> towards to the
|
||||
//! material of the face <aF>. The value of shifting in
|
||||
//! 2D is <aDt2D>. No checks on this value will be done.<br>
|
||||
//! Returns error status:<br>
|
||||
//! 0 - in case of success;<br>
|
||||
//! 1 - <aE> does not have 2d curve on the face <aF>.
|
||||
Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
const Standard_Real aDt2D,
|
||||
gp_Pnt2d& aP2D,
|
||||
gp_Pnt& aPx);
|
||||
|
||||
//! Computes the point <aPx>, (<aP2D>) that is near to
|
||||
//! the edge <aE> at parameter <aT> towards to the
|
||||
//! material of the face <aF>. The value of shifting in
|
||||
//! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d()
|
||||
Standard_EXPORT static void PointNearEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, gp_Pnt2d& aP2D, gp_Pnt& aPx, Handle(IntTools_Context)& theContext);
|
||||
//! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d()<br>
|
||||
//! If the value of shifting is too big the point will be computed
|
||||
//! using Hatcher (PointInFace function).<br>
|
||||
//! Returns error status:<br>
|
||||
//! 0 - in case of success;<br>
|
||||
//! 1 - <aE> does not have 2d curve on the face <aF>;<br>
|
||||
//! 2 - the computed point is out of the face.
|
||||
Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt2d& aP2D,
|
||||
gp_Pnt& aPx,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
|
||||
//! Compute the point <aPx>, (<aP2D>) that is near to
|
||||
//! the edge <aE> at arbitrary parameter towards to the
|
||||
//! material of the face <aF>. The value of shifting in
|
||||
//! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d()
|
||||
Standard_EXPORT static void PointNearEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, gp_Pnt2d& aP2D, gp_Pnt& aPx, Handle(IntTools_Context)& theContext);
|
||||
//! 2D is dt2D=BOPTools_AlgoTools3D::MinStepIn2d().<br>
|
||||
//! If the value of shifting is too big the point will be computed
|
||||
//! using Hatcher (PointInFace function).<br>
|
||||
//! Returns error status:<br>
|
||||
//! 0 - in case of success;<br>
|
||||
//! 1 - <aE> does not have 2d curve on the face <aF>;<br>
|
||||
//! 2 - the computed point is out of the face.
|
||||
Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
|
||||
const TopoDS_Face& aF,
|
||||
gp_Pnt2d& aP2D,
|
||||
gp_Pnt& aPx,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
|
||||
//! Returns simple step value that is used in 2D-computations
|
||||
@@ -119,33 +225,49 @@ public:
|
||||
//! the edge <aE>
|
||||
Standard_EXPORT static void OrientEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF, TopoDS_Edge& aER);
|
||||
|
||||
//! Computes a point <theP> inside the face <theF>. <br>
|
||||
//! <theP2D> - 2D representation of <theP> <br>
|
||||
//! on the surface of <theF> <br>
|
||||
//! Returns 0 in case of success. <br>
|
||||
Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF, gp_Pnt& theP, gp_Pnt2d& theP2D, Handle(IntTools_Context)& theContext);
|
||||
//! Computes arbitrary point <theP> inside the face <theF>.<br>
|
||||
//! <theP2D> - 2D representation of <theP>
|
||||
//! on the surface of <theF><br>
|
||||
//! Returns 0 in case of success.
|
||||
Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
//! Computes a point <theP> inside the face <theF>
|
||||
//! using starting point taken by the parameter <theT>
|
||||
//! from the 2d curve of the edge <theE> on the face <theF>
|
||||
//! in the direction perpendicular to the tangent vector
|
||||
//! of the 2d curve of the edge.<br>
|
||||
//! The point will be distanced on <theDt2D> from the 2d curve.
|
||||
//! <theP2D> - 2D representation of <theP>
|
||||
//! on the surface of <theF><br>
|
||||
//! Returns 0 in case of success.
|
||||
Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF,
|
||||
const TopoDS_Edge& theE,
|
||||
const Standard_Real theT,
|
||||
const Standard_Real theDt2D,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext);
|
||||
|
||||
//! Computes a point <theP> inside the face <theF>
|
||||
//! using the line <theL> so that 2D point
|
||||
//! <theP2D>, 2D representation of <theP>
|
||||
//! on the surface of <theF>, lies on that line.<br>
|
||||
//! Returns 0 in case of success.
|
||||
Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF,
|
||||
const Handle(Geom2d_Curve)& theL,
|
||||
gp_Pnt& theP,
|
||||
gp_Pnt2d& theP2D,
|
||||
Handle(IntTools_Context)& theContext,
|
||||
const Standard_Real theDt2D = 0.0);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPTools_AlgoTools3D_HeaderFile
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_TVertex.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepLib_CheckCurveOnSurface.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
@@ -48,6 +49,7 @@
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <IntRes2d_Domain.hxx>
|
||||
@@ -116,7 +118,8 @@ static
|
||||
const TopoDS_Face& theF,
|
||||
const Handle(Geom_Surface)& theS,
|
||||
const TopoDS_Edge& theE1,
|
||||
const TopoDS_Edge& theE2);
|
||||
const TopoDS_Edge& theE2,
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen);
|
||||
|
||||
//=======================================================================
|
||||
//class : BOPTools_CPC
|
||||
@@ -578,6 +581,7 @@ void CorrectWires(const TopoDS_Face& aFx,
|
||||
TopAbs_VERTEX,
|
||||
TopAbs_EDGE,
|
||||
aMVE);
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Real> aMapEdgeLen;
|
||||
aNbV=aMVE.Extent();
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMVE.FindKey(i));
|
||||
@@ -615,7 +619,7 @@ void CorrectWires(const TopoDS_Face& aFx,
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aD2 = IntersectCurves2d(aV, aF, aS, aE1, aE2);
|
||||
aD2 = IntersectCurves2d(aV, aF, aS, aE1, aE2, aMapEdgeLen);
|
||||
if (aD2 > aD2max) {
|
||||
aD2max = aD2;
|
||||
}
|
||||
@@ -629,6 +633,26 @@ void CorrectWires(const TopoDS_Face& aFx,
|
||||
}// for (i=1; i<=aNbV; ++i) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : MapEdgeLength
|
||||
// purpose : Compute edge length and cache it in the map
|
||||
//=======================================================================
|
||||
static Standard_Real MapEdgeLength(const TopoDS_Edge& theEdge,
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen)
|
||||
{
|
||||
const Standard_Real* pLen = theMapEdgeLen.Seek(theEdge);
|
||||
if (!pLen)
|
||||
{
|
||||
Standard_Real aLen = 0.;
|
||||
if (!BRep_Tool::Degenerated(theEdge))
|
||||
{
|
||||
BRepAdaptor_Curve aCurve(theEdge);
|
||||
aLen = GCPnts_AbscissaPoint::Length(aCurve);
|
||||
}
|
||||
pLen = theMapEdgeLen.Bound(theEdge, aLen);
|
||||
}
|
||||
return *pLen;
|
||||
}
|
||||
//=======================================================================
|
||||
// Function : IntersectCurves2d
|
||||
// purpose : Intersect 2d curves of edges
|
||||
@@ -637,7 +661,8 @@ Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
|
||||
const TopoDS_Face& theF,
|
||||
const Handle(Geom_Surface)& theS,
|
||||
const TopoDS_Edge& theE1,
|
||||
const TopoDS_Edge& theE2)
|
||||
const TopoDS_Edge& theE2,
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Real>& theMapEdgeLen)
|
||||
{
|
||||
Standard_Real aT11, aT12, aT21, aT22, aTol2d, aMaxDist;
|
||||
Geom2dInt_GInter anInter;
|
||||
@@ -657,7 +682,7 @@ Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
|
||||
aC2D2->Value(aT22), aT22, aTol2d);
|
||||
//
|
||||
anInter.Perform(aGAC1, aDom1, aGAC2, aDom2, aTol2d, aTol2d);
|
||||
if (!anInter.IsDone()) {
|
||||
if (!anInter.IsDone() || (!anInter.NbSegments() && !anInter.NbPoints())) {
|
||||
return aMaxDist;
|
||||
}
|
||||
//
|
||||
@@ -690,6 +715,12 @@ Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
|
||||
aLP.Append(aPnt);
|
||||
}
|
||||
//
|
||||
// evaluate the length of the smallest edge, so that not to return too large distance
|
||||
Standard_Real aLen1 = MapEdgeLength(theE1, theMapEdgeLen);
|
||||
Standard_Real aLen2 = MapEdgeLength(theE2, theMapEdgeLen);
|
||||
const Standard_Real MaxEdgePartCoveredByVertex = 0.3;
|
||||
Standard_Real aMaxThresDist = Min(aLen1, aLen2) * MaxEdgePartCoveredByVertex;
|
||||
aMaxThresDist *= aMaxThresDist;
|
||||
aItLP.Initialize(aLP);
|
||||
for (; aItLP.More(); aItLP.Next()) {
|
||||
const IntRes2d_IntersectionPoint& aPnt = aItLP.Value();
|
||||
@@ -712,7 +743,7 @@ Standard_Real IntersectCurves2d(const TopoDS_Vertex& theV,
|
||||
aP2d = aPnt.Value();
|
||||
theS->D0(aP2d.X(), aP2d.Y(), aP);
|
||||
aDist = aPV.SquareDistance(aP);
|
||||
if (aDist > aMaxDist) {
|
||||
if (aDist > aMaxDist && aDist < aMaxThresDist) {
|
||||
aMaxDist = aDist;
|
||||
}
|
||||
}
|
||||
|
@@ -308,6 +308,7 @@ void BRepAlgoAPI_BooleanOperation::Build()
|
||||
myDSFiller->SetProgressIndicator(myProgressIndicator);
|
||||
myDSFiller->SetFuzzyValue(myFuzzyValue);
|
||||
myDSFiller->SetNonDestructive(myNonDestructive);
|
||||
myDSFiller->SetGlue(myGlue);
|
||||
//
|
||||
SetAttributes();
|
||||
//
|
||||
|
@@ -29,7 +29,8 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
|
||||
myDSFiller(NULL),
|
||||
myBuilder(NULL),
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
myNonDestructive(Standard_False),
|
||||
myGlue(BOPAlgo_GlueOff)
|
||||
{}
|
||||
//=======================================================================
|
||||
// function:
|
||||
@@ -42,7 +43,8 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
|
||||
myEntryType(0),
|
||||
myBuilder(NULL),
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
myNonDestructive(Standard_False),
|
||||
myGlue(BOPAlgo_GlueOff)
|
||||
{
|
||||
BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
|
||||
myDSFiller=pPF;
|
||||
@@ -88,6 +90,22 @@ Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
|
||||
return myNonDestructive;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetGlue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepAlgoAPI_BuilderAlgo::SetGlue(const BOPAlgo_GlueEnum theGlue)
|
||||
{
|
||||
myGlue=theGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Glue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BOPAlgo_GlueEnum BRepAlgoAPI_BuilderAlgo::Glue() const
|
||||
{
|
||||
return myGlue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@@ -144,6 +162,7 @@ void BRepAlgoAPI_BuilderAlgo::Build()
|
||||
myDSFiller->SetProgressIndicator(myProgressIndicator);
|
||||
myDSFiller->SetFuzzyValue(myFuzzyValue);
|
||||
myDSFiller->SetNonDestructive(myNonDestructive);
|
||||
myDSFiller->SetGlue(myGlue);
|
||||
//
|
||||
myDSFiller->Perform();
|
||||
iErr=myDSFiller->ErrorStatus();
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <BOPAlgo_PPaveFiller.hxx>
|
||||
#include <BOPAlgo_PBuilder.hxx>
|
||||
#include <BOPAlgo_GlueEnum.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <BRepAlgoAPI_Algo.hxx>
|
||||
@@ -62,6 +63,12 @@ Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
|
||||
//! a copy of a sub-shape is created in the result if it is needed to be updated.
|
||||
Standard_EXPORT Standard_Boolean NonDestructive() const;
|
||||
|
||||
//! Sets the glue option for the algorithm
|
||||
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
|
||||
|
||||
//! Returns the glue option of the algorithm
|
||||
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
|
||||
|
||||
//! Sets the arguments
|
||||
Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
|
||||
|
||||
@@ -113,6 +120,7 @@ protected:
|
||||
Standard_Real myFuzzyValue;
|
||||
Standard_Boolean myNonDestructive;
|
||||
TopTools_ListOfShape myArguments;
|
||||
BOPAlgo_GlueEnum myGlue;
|
||||
|
||||
|
||||
private:
|
||||
|
@@ -641,8 +641,8 @@
|
||||
aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
|
||||
aV2.Orientation(TopAbs_REVERSED);
|
||||
//
|
||||
BOPTools_AlgoTools::MakeSplitEdge(aE, aV1, aT1, aV2, aT2, aSp);
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aSp, theF);
|
||||
BOPTools_AlgoTools::MakeSplitEdge(aE, aV1, aT1, aV2, aT2, aSp);
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aSp, theF, myContext);
|
||||
//
|
||||
aSI.SetShape(aSp);
|
||||
//
|
||||
|
@@ -1608,7 +1608,9 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
// Store Result
|
||||
L1.Clear(); L2.Clear();
|
||||
TopAbs_Orientation O1,O2;
|
||||
|
||||
//
|
||||
const Handle(IntTools_Context)& aContext = pPF->Context();
|
||||
//
|
||||
for (i = 0; i < aNb; i++) {
|
||||
BOPDS_InterfFF& aFFi=aFFs(i);
|
||||
const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
|
||||
@@ -1645,10 +1647,10 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l, aC2d, aC2dNew);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
@@ -1661,10 +1663,10 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
|
||||
Handle(Geom2d_Curve) aC2dNew;
|
||||
|
||||
if(aC3DE->IsPeriodic()) {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l, aC2d, aC2dNew);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
else {
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew);
|
||||
BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew, aContext);
|
||||
}
|
||||
aC2d = aC2dNew;
|
||||
}
|
||||
|
@@ -175,7 +175,6 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
||||
theSource >> aNbShapes;
|
||||
TDF_Label aLabel = theTarget->Label ();
|
||||
TNaming_Builder aBuilder (aLabel);
|
||||
if (aNbShapes == 0) return Standard_False;
|
||||
Standard_Integer aVer;
|
||||
Standard_Boolean ok = theSource >> aVer;
|
||||
if(!ok) return Standard_False;
|
||||
@@ -188,39 +187,49 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
||||
|
||||
BinTools_ShapeSet& aShapeSet = (BinTools_ShapeSet&) myShapeSet;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbShapes; i++) {
|
||||
NCollection_List<TopoDS_Shape> anOldShapes, aNewShapes;
|
||||
for (Standard_Integer i = 1; i <= aNbShapes; i++)
|
||||
{
|
||||
TopoDS_Shape anOldShape, aNewShape;
|
||||
|
||||
if ( anEvol != TNaming_PRIMITIVE )
|
||||
if(TranslateFrom(theSource, anOldShape, aShapeSet)) return Standard_False;
|
||||
|
||||
if (anEvol != TNaming_DELETE)
|
||||
if(TranslateFrom(theSource, aNewShape, aShapeSet)) return Standard_False;
|
||||
if (anEvol != TNaming_PRIMITIVE)
|
||||
if (TranslateFrom (theSource, anOldShape, aShapeSet)) return Standard_False;
|
||||
|
||||
switch (anEvol) {
|
||||
case TNaming_PRIMITIVE :
|
||||
aBuilder.Generated(aNewShape);
|
||||
break;
|
||||
case TNaming_GENERATED :
|
||||
aBuilder.Generated(anOldShape, aNewShape);
|
||||
break;
|
||||
case TNaming_MODIFY :
|
||||
aBuilder.Modify(anOldShape, aNewShape);
|
||||
break;
|
||||
case TNaming_DELETE :
|
||||
aBuilder.Delete (anOldShape);
|
||||
break;
|
||||
case TNaming_SELECTED :
|
||||
aBuilder.Select(aNewShape, anOldShape);
|
||||
break;
|
||||
case TNaming_REPLACE :
|
||||
aBuilder.Modify(anOldShape, aNewShape); // for compatibility aBuilder.Replace(anOldShape, aNewShape);
|
||||
break;
|
||||
default :
|
||||
Standard_DomainError::Raise("TNaming_Evolution:: Evolution Unknown");
|
||||
if (anEvol != TNaming_DELETE)
|
||||
if (TranslateFrom (theSource, aNewShape, aShapeSet)) return Standard_False;
|
||||
|
||||
// Here we add shapes in reverse order because TNaming_Builder also adds them in reverse order.
|
||||
anOldShapes.Prepend (anOldShape);
|
||||
aNewShapes.Prepend (aNewShape);
|
||||
}
|
||||
|
||||
for (NCollection_List<TopoDS_Shape>::Iterator anOldIt (anOldShapes), aNewIt (aNewShapes);
|
||||
anOldIt.More() && aNewIt.More();
|
||||
anOldIt.Next(), aNewIt.Next())
|
||||
{
|
||||
switch (anEvol)
|
||||
{
|
||||
case TNaming_PRIMITIVE:
|
||||
aBuilder.Generated (aNewIt.Value ());
|
||||
break;
|
||||
case TNaming_GENERATED:
|
||||
aBuilder.Generated (anOldIt.Value(), aNewIt.Value());
|
||||
break;
|
||||
case TNaming_MODIFY:
|
||||
aBuilder.Modify (anOldIt.Value(), aNewIt.Value());
|
||||
break;
|
||||
case TNaming_DELETE:
|
||||
aBuilder.Delete (anOldIt.Value());
|
||||
break;
|
||||
case TNaming_SELECTED:
|
||||
aBuilder.Select (aNewIt.Value(), anOldIt.Value());
|
||||
break;
|
||||
case TNaming_REPLACE:
|
||||
aBuilder.Modify (anOldIt.Value(), aNewIt.Value()); // for compatibility aBuilder.Replace(anOldShape, aNewShape);
|
||||
break;
|
||||
default:
|
||||
Standard_DomainError::Raise("TNaming_Evolution:: Evolution Unknown");
|
||||
}
|
||||
anOldShape.Nullify();
|
||||
aNewShape.Nullify();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -241,8 +250,6 @@ void BinMNaming_NamedShapeDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
for (TNaming_Iterator SItr (aSAtt); SItr.More (); SItr.Next ()) NbShapes++;
|
||||
//--------------------------------------------------------------
|
||||
|
||||
if (NbShapes == 0) return;
|
||||
|
||||
BinTools_ShapeSet& aShapeSet = (BinTools_ShapeSet&) myShapeSet;
|
||||
TNaming_Evolution anEvol = aSAtt->Evolution();
|
||||
|
||||
@@ -311,4 +318,3 @@ void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS)
|
||||
else
|
||||
theIS.seekg(aPos); // no shape section is present, try to return to initial point
|
||||
}
|
||||
|
||||
|
@@ -3697,7 +3697,7 @@ static Standard_Integer DDataStd_SetRefArray (Draw_Interpretor& di,
|
||||
|
||||
Handle(TDataStd_ReferenceArray) A = TDataStd_ReferenceArray::Set(label, From, To);
|
||||
|
||||
if (nb > 6) {
|
||||
if (nb >= 6) {
|
||||
j = 5;
|
||||
for(Standard_Integer i = From; i<=To; i++) {
|
||||
TDF_Label aRefLabel;
|
||||
|
@@ -180,13 +180,22 @@ void Geom2dAPI_InterCurveCurve::Segment
|
||||
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > NbSegments(),
|
||||
"Geom2dAPI_InterCurveCurve::Segment");
|
||||
|
||||
Standard_NullObject_Raise_if(myCurve1.IsNull() || myCurve2.IsNull(),
|
||||
Standard_NullObject_Raise_if(myCurve1.IsNull(),
|
||||
"Geom2dAPI_InterCurveCurve::Segment");
|
||||
|
||||
Standard_Real aU1 = myCurve1->FirstParameter(),
|
||||
aU2 = myCurve1->LastParameter(),
|
||||
aV1 = myCurve2->FirstParameter(),
|
||||
aV2 = myCurve2->LastParameter();
|
||||
Standard_Real aU1, aU2, aV1, aV2;
|
||||
aU1 = myCurve1->FirstParameter();
|
||||
aU2 = myCurve1->LastParameter();
|
||||
if (myCurve2.IsNull())
|
||||
{
|
||||
aV1 = aU1;
|
||||
aV2 = aU2;
|
||||
}
|
||||
else
|
||||
{
|
||||
aV1 = myCurve2->FirstParameter();
|
||||
aV2 = myCurve2->LastParameter();
|
||||
}
|
||||
|
||||
const IntRes2d_IntersectionSegment& aSeg = myIntersector.Segment(theIndex);
|
||||
const Standard_Boolean isOpposite = aSeg.IsOpposite();
|
||||
@@ -214,7 +223,10 @@ void Geom2dAPI_InterCurveCurve::Segment
|
||||
}
|
||||
|
||||
theCurve1 = new Geom2d_TrimmedCurve(myCurve1, aU1, aU2);
|
||||
theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2);
|
||||
if (myCurve2.IsNull())
|
||||
theCurve2 = new Geom2d_TrimmedCurve(myCurve1, aV1, aV2);
|
||||
else
|
||||
theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -510,8 +510,8 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
{
|
||||
typename BVH_Box<T, 4>::BVH_VecNt& aCorner = anArrayOfCorners[anIt];
|
||||
aCorner = aTPers * aCorner;
|
||||
aCorner /= aCorner.w();
|
||||
theBoundingBox.Add (aCorner.xyz());
|
||||
aCorner = aCorner / aCorner.w();
|
||||
theBoundingBox.Add (typename BVH_Box<T, 3>::BVH_VecNt (aCorner.x(), aCorner.y(), aCorner.z()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -486,6 +486,181 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
|
||||
delete [] PtrSegIndex1;
|
||||
delete [] PtrSegIndex2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Processing of TangentZone
|
||||
//----------------------------------------------------------------------
|
||||
Standard_Integer Nbtz = InterPP.NbTangentZones();
|
||||
for(Standard_Integer tz=1; tz <= Nbtz; tz++) {
|
||||
Standard_Integer NbPnts = InterPP.ZoneValue(tz).NumberOfPoints();
|
||||
//====================================================================
|
||||
//== Find the first and the last point in the tangency zone.
|
||||
//====================================================================
|
||||
Standard_Real ParamSupOnCurve2,ParamInfOnCurve2;
|
||||
Standard_Real ParamSupOnCurve1,ParamInfOnCurve1;
|
||||
// Standard_Integer SegIndex,SegIndex1onP1,SegIndex1onP2,SegIndex2onP1,SegIndex2onP2;
|
||||
Standard_Integer SegIndex1onP1,SegIndex1onP2;
|
||||
Intf_PIType Type;
|
||||
Standard_Real ParamOnLine;
|
||||
Standard_Real PolyUInf,PolyUSup,PolyVInf,PolyVSup;
|
||||
ParamSupOnCurve2=ParamSupOnCurve1=PolyUSup=PolyVSup=-RealLast();
|
||||
ParamInfOnCurve2=ParamInfOnCurve1=PolyUInf=PolyVInf= RealLast();
|
||||
for(Standard_Integer qq=1;qq<=NbPnts;qq++) {
|
||||
const Intf_SectionPoint& SPnt1 = InterPP.ZoneValue(tz).GetPoint(qq);
|
||||
//====================================================================
|
||||
//== The zones of tangency are discretized
|
||||
//== Test of stop : Check if
|
||||
//== (Deflection < Tolerance)
|
||||
//== Or (Sample < EpsX) (normally the first condition is
|
||||
//== more strict)
|
||||
//====================================================================
|
||||
// Standard_Real _PolyUInf,_PolyUSup,_PolyVInf,_PolyVSup;
|
||||
Standard_Real _PolyUInf,_PolyVInf;
|
||||
|
||||
SPnt1.InfoFirst(Type,SegIndex1onP1,ParamOnLine);
|
||||
if(SegIndex1onP1 > Poly1.NbSegments()) { SegIndex1onP1--; ParamOnLine = 1.0; }
|
||||
if(SegIndex1onP1 <= 0) { SegIndex1onP1=1; ParamOnLine = 0.0; }
|
||||
_PolyUInf = Poly1.ApproxParamOnCurve(SegIndex1onP1,ParamOnLine);
|
||||
|
||||
SPnt1.InfoSecond(Type,SegIndex1onP2,ParamOnLine);
|
||||
if(SegIndex1onP2 > Poly1.NbSegments()) { SegIndex1onP2--; ParamOnLine = 1.0; }
|
||||
if(SegIndex1onP2 <= 0) { SegIndex1onP2=1; ParamOnLine = 0.0; }
|
||||
_PolyVInf = Poly1.ApproxParamOnCurve(SegIndex1onP2,ParamOnLine);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
if(ParamInfOnCurve1 > _PolyUInf) ParamInfOnCurve1=_PolyUInf;
|
||||
if(ParamInfOnCurve2 > _PolyVInf) ParamInfOnCurve2=_PolyVInf;
|
||||
|
||||
if(ParamSupOnCurve1 < _PolyUInf) ParamSupOnCurve1=_PolyUInf;
|
||||
if(ParamSupOnCurve2 < _PolyVInf) ParamSupOnCurve2=_PolyVInf;
|
||||
}
|
||||
|
||||
PolyUInf= ParamInfOnCurve1;
|
||||
PolyUSup= ParamSupOnCurve1;
|
||||
PolyVInf= ParamInfOnCurve2;
|
||||
PolyVSup= ParamSupOnCurve2;
|
||||
|
||||
TheCurveTool::D0(C1,PolyUInf,P1);
|
||||
TheCurveTool::D0(C1,PolyVInf,P2);
|
||||
Standard_Real distmemesens = P1.SquareDistance(P2);
|
||||
TheCurveTool::D0(C1,PolyVSup,P2);
|
||||
Standard_Real distdiffsens = P1.SquareDistance(P2);
|
||||
if(distmemesens > distdiffsens) {
|
||||
Standard_Real qwerty=PolyVInf; PolyVInf=PolyVSup; PolyVSup=qwerty;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
//-- Calculate Positions of Points on the curve and
|
||||
//-- Transitions on each limit of the segment
|
||||
|
||||
IntRes2d_Position Pos1 = IntRes2d_Middle;
|
||||
IntRes2d_Position Pos2 = IntRes2d_Middle;
|
||||
IntRes2d_Transition Trans1,Trans2;
|
||||
|
||||
TheCurveTool::D1(C1,PolyUInf,P1,Tan1);
|
||||
TheCurveTool::D1(C1,PolyVInf,P2,Tan2);
|
||||
|
||||
if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance()) {
|
||||
Pos1 = IntRes2d_Head;
|
||||
}
|
||||
else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) {
|
||||
Pos1 = IntRes2d_End;
|
||||
}
|
||||
if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance()) {
|
||||
Pos2 = IntRes2d_Head;
|
||||
}
|
||||
else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) {
|
||||
Pos2 = IntRes2d_End;
|
||||
}
|
||||
|
||||
if(Pos1==IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
|
||||
PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else if(Pos1!=IntRes2d_Middle && Pos2==IntRes2d_Middle) {
|
||||
PolyVInf=TheProjPCur::FindParameter( C1,P1,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else if(Abs(ParamInfOnCurve1-ParamSupOnCurve1) > Abs(ParamInfOnCurve2-ParamSupOnCurve2)) {
|
||||
PolyVInf=TheProjPCur::FindParameter( C1,P1,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else {
|
||||
PolyUInf=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1,Pos2,Tan2,Trans2,TolConf)
|
||||
== Standard_False)
|
||||
{
|
||||
TheCurveTool::D2(C1,PolyUInf,P1,Tan1,Norm1);
|
||||
TheCurveTool::D2(C1,PolyVInf,P2,Tan2,Norm2);
|
||||
IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
|
||||
Pos2,Tan2,Norm2,Trans2,TolConf);
|
||||
}
|
||||
IntRes2d_IntersectionPoint PtSeg1(P1,PolyUInf,PolyVInf
|
||||
,Trans1,Trans2,Standard_False);
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
if((Abs(PolyUInf-PolyUSup) <= TheCurveTool::EpsX(C1)) ||
|
||||
(Abs(PolyVInf-PolyVSup) <= TheCurveTool::EpsX(C1)))
|
||||
{
|
||||
//bad segment
|
||||
}
|
||||
else
|
||||
{
|
||||
TheCurveTool::D1(C1,PolyUSup,P1,Tan1);
|
||||
TheCurveTool::D1(C1,PolyVSup,P2,Tan2);
|
||||
Pos1 = IntRes2d_Middle; Pos2 = IntRes2d_Middle;
|
||||
|
||||
if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance()) {
|
||||
Pos1 = IntRes2d_Head;
|
||||
}
|
||||
else if(P1.Distance(DomainOnCurve1.LastPoint())<=DomainOnCurve1.LastTolerance()) {
|
||||
Pos1 = IntRes2d_End;
|
||||
}
|
||||
if(P2.Distance(DomainOnCurve2.FirstPoint())<=DomainOnCurve2.FirstTolerance()) {
|
||||
Pos2 = IntRes2d_Head;
|
||||
}
|
||||
else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance()) {
|
||||
Pos2 = IntRes2d_End;
|
||||
}
|
||||
|
||||
|
||||
if(Pos1==IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
|
||||
PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else if(Pos1!=IntRes2d_Middle && Pos2==IntRes2d_Middle) {
|
||||
PolyVSup=TheProjPCur::FindParameter( C1,P1,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else if(Abs(ParamInfOnCurve1-ParamSupOnCurve1) > Abs(ParamInfOnCurve2-ParamSupOnCurve2)) {
|
||||
PolyVSup=TheProjPCur::FindParameter( C1,P1,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
else {
|
||||
PolyUSup=TheProjPCur::FindParameter( C1,P2,D1.FirstParameter(),D1.LastParameter(),TheCurveTool::EpsX(C1));
|
||||
}
|
||||
|
||||
if(IntImpParGen::DetermineTransition( Pos1,Tan1,Trans1,Pos2,Tan2,Trans2,TolConf)
|
||||
==Standard_False) {
|
||||
TheCurveTool::D2(C1,PolyUSup,P1,Tan1,Norm1);
|
||||
TheCurveTool::D2(C1,PolyVSup,P2,Tan2,Norm2);
|
||||
IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
|
||||
Pos2,Tan2,Norm2,Trans2,TolConf);
|
||||
}
|
||||
IntRes2d_IntersectionPoint PtSeg2(P1,PolyUSup,PolyVSup
|
||||
,Trans1,Trans2,Standard_False);
|
||||
|
||||
Standard_Boolean Oppos = (Tan1.Dot(Tan2) > 0.0)? Standard_False : Standard_True;
|
||||
if(ParamInfOnCurve1 > ParamSupOnCurve1) {
|
||||
IntRes2d_IntersectionSegment Seg(PtSeg2,PtSeg1,Oppos,Standard_False);
|
||||
Append(Seg);
|
||||
}
|
||||
else {
|
||||
IntRes2d_IntersectionSegment Seg(PtSeg1,PtSeg2,Oppos,Standard_False);
|
||||
Append(Seg);
|
||||
}
|
||||
}
|
||||
} //end of processing of TangentZone
|
||||
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,15 @@
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <IntPatch_WLineTool.hxx>
|
||||
|
||||
#include <ProjLib_ProjectOnPlane.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <ProjLib.hxx>
|
||||
|
||||
//======================================================================
|
||||
// function: SequenceOfLine
|
||||
//======================================================================
|
||||
@@ -129,12 +138,35 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
|
||||
switch (S1->GetType())
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Sphere:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Torus: break;
|
||||
default:
|
||||
case GeomAbs_Plane:
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Sphere:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Torus:
|
||||
break;
|
||||
case GeomAbs_SurfaceOfExtrusion:
|
||||
{
|
||||
gp_Dir aDirection = S1->Direction();
|
||||
gp_Ax3 anAxis(gp::Origin(), aDirection);
|
||||
Handle(Adaptor3d_HCurve) aBasisCurve = S1->BasisCurve();
|
||||
ProjLib_ProjectOnPlane Projector(anAxis);
|
||||
Projector.Load(aBasisCurve, Precision::Confusion());
|
||||
Handle(GeomAdaptor_HCurve) aProjCurve = Projector.GetResult();
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane(anAxis);
|
||||
Handle(GeomAdaptor_HSurface) aGAHsurf = new GeomAdaptor_HSurface(aPlane);
|
||||
ProjLib_ProjectedCurve aProjectedCurve(aGAHsurf, aProjCurve);
|
||||
Handle(Geom2d_Curve) aPCurve;
|
||||
ProjLib::MakePCurveOfType(aProjectedCurve, aPCurve);
|
||||
Geom2dAdaptor_Curve AC(aPCurve,
|
||||
aProjectedCurve.FirstParameter(),
|
||||
aProjectedCurve.LastParameter());
|
||||
Geom2dInt_GInter Intersector(AC,
|
||||
Precision::Confusion(),
|
||||
Precision::Confusion());
|
||||
if (Intersector.IsDone() && Intersector.IsEmpty())
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
IntPatch_PrmPrmIntersection interpp;
|
||||
interpp.Perform(S1,D1,TolTang,TolArc,myFleche,myUVMaxStep);
|
||||
|
@@ -44,7 +44,7 @@
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_CurveRangeLocalizeData.hxx>
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <IntTools_EdgeFace.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfBox.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfSurfaceRangeSample.hxx>
|
||||
@@ -214,8 +214,12 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
|
||||
void IntTools_BeanFaceIntersector::Init(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
if (myContext.IsNull()) {
|
||||
myContext = new IntTools_Context;
|
||||
}
|
||||
//
|
||||
myCurve.Initialize(theEdge);
|
||||
mySurface.Initialize(theFace);
|
||||
mySurface = myContext->SurfaceAdaptor(theFace);
|
||||
myTrsfSurface = Handle(Geom_Surface)::DownCast(mySurface.Surface().Surface()->Transformed(mySurface.Trsf()));
|
||||
myBeanTolerance = BRep_Tool::Tolerance(theEdge);
|
||||
myFaceTolerance = BRep_Tool::Tolerance(theFace);
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
|
||||
|
||||
//
|
||||
//=======================================================================
|
||||
@@ -64,6 +64,7 @@ IntTools_Context::IntTools_Context()
|
||||
myHatcherMap(100, myAllocator),
|
||||
myProjSDataMap(100, myAllocator),
|
||||
myBndBoxDataMap(100, myAllocator),
|
||||
mySurfAdaptorMap(100, myAllocator),
|
||||
myCreateFlag(0),
|
||||
myPOnSTolerance(1.e-12)
|
||||
{
|
||||
@@ -84,6 +85,7 @@ IntTools_Context::IntTools_Context
|
||||
myHatcherMap(100, myAllocator),
|
||||
myProjSDataMap(100, myAllocator),
|
||||
myBndBoxDataMap(100, myAllocator),
|
||||
mySurfAdaptorMap(100, myAllocator),
|
||||
myCreateFlag(1),
|
||||
myPOnSTolerance(1.e-12)
|
||||
{
|
||||
@@ -171,6 +173,16 @@ IntTools_Context::~IntTools_Context()
|
||||
myAllocator->Free(anAdr);
|
||||
}
|
||||
myBndBoxDataMap.Clear();
|
||||
//
|
||||
BRepAdaptor_Surface* pSurfAdaptor;
|
||||
aIt.Initialize(mySurfAdaptorMap);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
anAdr=aIt.Value();
|
||||
pSurfAdaptor=(BRepAdaptor_Surface*)anAdr;
|
||||
(*pSurfAdaptor).~BRepAdaptor_Surface();
|
||||
myAllocator->Free(anAdr);
|
||||
}
|
||||
mySurfAdaptorMap.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BndBox
|
||||
@@ -265,15 +277,8 @@ GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
|
||||
|
||||
if (!myProjPSMap.IsBound(aF)) {
|
||||
Standard_Real Umin, Usup, Vmin, Vsup;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
//
|
||||
UVBounds(aF, Umin, Usup, Vmin, Vsup);
|
||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
|
||||
aBAS.Initialize (aF, Standard_True);
|
||||
//
|
||||
Umin=aBAS.FirstUParameter();
|
||||
Usup=aBAS.LastUParameter ();
|
||||
Vmin=aBAS.FirstVParameter();
|
||||
Vsup=aBAS.LastVParameter ();
|
||||
//
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)myAllocator->Allocate(sizeof(GeomAPI_ProjectPointOnSurf));
|
||||
new (pProjPS) GeomAPI_ProjectPointOnSurf();
|
||||
@@ -376,6 +381,32 @@ BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier
|
||||
return *pSC;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SurfaceAdaptor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepAdaptor_Surface& IntTools_Context::SurfaceAdaptor
|
||||
(const TopoDS_Face& theFace)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
BRepAdaptor_Surface* pBAS;
|
||||
|
||||
if (!mySurfAdaptorMap.IsBound(theFace)) {
|
||||
//
|
||||
pBAS=(BRepAdaptor_Surface*)myAllocator->Allocate(sizeof(BRepAdaptor_Surface));
|
||||
new (pBAS) BRepAdaptor_Surface(theFace, Standard_True);
|
||||
//
|
||||
anAdr=(Standard_Address)pBAS;
|
||||
mySurfAdaptorMap.Bind(theFace, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=mySurfAdaptorMap.Find(theFace);
|
||||
pBAS =(BRepAdaptor_Surface*)anAdr;
|
||||
}
|
||||
return *pBAS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hatcher
|
||||
//purpose :
|
||||
@@ -494,18 +525,43 @@ Standard_Integer IntTools_Context::ComputePE
|
||||
aProjector.Perform(aP1);
|
||||
|
||||
aNbProj=aProjector.NbPoints();
|
||||
if (!aNbProj) {
|
||||
return -3;
|
||||
if (aNbProj)
|
||||
{
|
||||
// point falls on the curve
|
||||
aDist = aProjector.LowerDistance();
|
||||
//
|
||||
aTolE2 = BRep_Tool::Tolerance(aE2);
|
||||
aTolSum = aTolP1 + aTolE2 + Precision::Confusion();
|
||||
//
|
||||
aT = aProjector.LowerDistanceParameter();
|
||||
if (aDist > aTolSum) {
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
//
|
||||
aDist=aProjector.LowerDistance();
|
||||
//
|
||||
aTolE2=BRep_Tool::Tolerance(aE2);
|
||||
aTolSum = aTolP1 + aTolE2 + Precision::Confusion();
|
||||
//
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
if (aDist > aTolSum) {
|
||||
return -4;
|
||||
else
|
||||
{
|
||||
// point falls out of the curve, check distance to vertices
|
||||
TopoDS_Edge aEFwd = TopoDS::Edge(aE2.Oriented(TopAbs_FORWARD));
|
||||
TopoDS_Iterator itV(aEFwd);
|
||||
aDist = RealLast();
|
||||
for (; itV.More(); itV.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(itV.Value());
|
||||
if (aV.Orientation() == TopAbs_FORWARD || aV.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
gp_Pnt aPV = BRep_Tool::Pnt(aV);
|
||||
aTolSum = aTolP1 + BRep_Tool::Tolerance(aV) + Precision::Confusion();
|
||||
Standard_Real aDist1 = aP1.SquareDistance(aPV);
|
||||
if (aDist1 < aDist && aDist1 < Square(aTolSum))
|
||||
{
|
||||
aDist = aDist1;
|
||||
aT = BRep_Tool::Parameter(aV, aEFwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Precision::IsInfinite(aDist)) {
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1042,3 +1098,20 @@ void IntTools_Context::clearCachedPOnSProjectors()
|
||||
}
|
||||
myProjPSMap.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UVBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Context::UVBounds(const TopoDS_Face& theFace,
|
||||
Standard_Real& UMin,
|
||||
Standard_Real& UMax,
|
||||
Standard_Real& VMin,
|
||||
Standard_Real& VMax)
|
||||
{
|
||||
const BRepAdaptor_Surface& aBAS = SurfaceAdaptor(theFace);
|
||||
UMin = aBAS.FirstUParameter();
|
||||
UMax = aBAS.LastUParameter ();
|
||||
VMin = aBAS.FirstVParameter();
|
||||
VMax = aBAS.LastVParameter ();
|
||||
}
|
@@ -27,6 +27,7 @@
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
class IntTools_FClass2d;
|
||||
class TopoDS_Face;
|
||||
class GeomAPI_ProjectPointOnSurf;
|
||||
@@ -45,17 +46,12 @@ class Bnd_Box;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
class IntTools_Context;
|
||||
DEFINE_STANDARD_HANDLE(IntTools_Context, MMgt_TShared)
|
||||
|
||||
|
||||
//! The intersection Context contains geometrical
|
||||
//! and topological toolkit (classifiers, projectors, etc).
|
||||
//! The intersection Context is for caching the tools
|
||||
//! to increase the performance.
|
||||
class IntTools_Context : public MMgt_TShared
|
||||
class IntTools_Context : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -99,6 +95,15 @@ Standard_EXPORT virtual ~IntTools_Context();
|
||||
//! for given face
|
||||
Standard_EXPORT Geom2dHatch_Hatcher& Hatcher (const TopoDS_Face& aF);
|
||||
|
||||
//! Returns a reference to surface adaptor for given face
|
||||
Standard_EXPORT BRepAdaptor_Surface& SurfaceAdaptor (const TopoDS_Face& theFace);
|
||||
|
||||
//! Computes the boundaries of the face using surface adaptor
|
||||
Standard_EXPORT void UVBounds (const TopoDS_Face& theFace,
|
||||
Standard_Real& UMin,
|
||||
Standard_Real& UMax,
|
||||
Standard_Real& VMin,
|
||||
Standard_Real& VMax);
|
||||
|
||||
//! Computes parameter of the Point theP on
|
||||
//! the edge aE.
|
||||
@@ -230,7 +235,7 @@ Standard_EXPORT virtual ~IntTools_Context();
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
|
||||
DEFINE_STANDARD_RTTIEXT(IntTools_Context,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -244,6 +249,7 @@ protected:
|
||||
BOPCol_DataMapOfShapeAddress myHatcherMap;
|
||||
BOPCol_DataMapOfShapeAddress myProjSDataMap;
|
||||
BOPCol_DataMapOfShapeAddress myBndBoxDataMap;
|
||||
BOPCol_DataMapOfShapeAddress mySurfAdaptorMap;
|
||||
Standard_Integer myCreateFlag;
|
||||
Standard_Real myPOnSTolerance;
|
||||
|
||||
@@ -256,4 +262,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(IntTools_Context, Standard_Transient)
|
||||
|
||||
#endif // _IntTools_Context_HeaderFile
|
||||
|
@@ -39,13 +39,12 @@
|
||||
#include <IntCurveSurface_HInter.hxx>
|
||||
#include <IntCurveSurface_IntersectionPoint.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_Array1OfRange.hxx>
|
||||
#include <IntTools_BeanFaceIntersector.hxx>
|
||||
#include <IntTools_CArray1OfInteger.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_EdgeFace.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_Range.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <IntTools_Tools.hxx>
|
||||
@@ -61,10 +60,6 @@ static
|
||||
Standard_Boolean IsRadius (const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface,
|
||||
const Standard_Real aCriteria);
|
||||
static
|
||||
Standard_Integer AdaptiveDiscret (const Standard_Integer iDiscret,
|
||||
const BRepAdaptor_Curve& aCurve ,
|
||||
const BRepAdaptor_Surface& aSurface);
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_EdgeFace::IntTools_EdgeFace
|
||||
@@ -303,170 +298,7 @@ void IntTools_EdgeFace::CheckData()
|
||||
myErrorStatus=3;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_EdgeFace::Prepare()
|
||||
{
|
||||
Standard_Integer pri;
|
||||
Standard_Real aTmin, aTmax;
|
||||
IntTools_CArray1OfReal aPars;
|
||||
|
||||
//
|
||||
// 1.Prepare Curve's data and Surface's data
|
||||
myC.Initialize(myEdge);
|
||||
GeomAbs_CurveType aCurveType;
|
||||
aCurveType=myC.GetType();
|
||||
//
|
||||
// 2.Prepare myCriteria
|
||||
Standard_Real aFuzz = myFuzzyValue / 2.;
|
||||
Standard_Real aTolF = BRep_Tool::Tolerance(myFace) + aFuzz;
|
||||
Standard_Real aTolE = BRep_Tool::Tolerance(myEdge) + aFuzz;
|
||||
if (aCurveType == GeomAbs_BSplineCurve ||
|
||||
aCurveType == GeomAbs_BezierCurve) {
|
||||
myCriteria = 1.5*aTolE + aTolF;
|
||||
}
|
||||
else {
|
||||
myCriteria = aTolE + aTolF;
|
||||
}
|
||||
// 2.a myTmin, myTmax
|
||||
aTmin=myRange.First();
|
||||
aTmax=myRange.Last();
|
||||
// 2.b myFClass2d
|
||||
myS.Initialize (myFace,Standard_True);
|
||||
myFClass2d.Init(myFace, 1.e-6);
|
||||
//
|
||||
// 2.c Prepare adaptive myDiscret
|
||||
myDiscret=AdaptiveDiscret(myDiscret, myC, myS);
|
||||
//
|
||||
//
|
||||
// 3.Prepare myPars
|
||||
pri = IntTools::PrepareArgs(myC, aTmax, aTmin,
|
||||
myDiscret, myDeflection, aPars);
|
||||
if (pri) {
|
||||
myErrorStatus=6;
|
||||
return;
|
||||
}
|
||||
// 4.
|
||||
//ProjectableRanges
|
||||
Standard_Integer i, iProj, aNb, aNbProj, ind0, ind1;
|
||||
Standard_Real t0, t1, tRoot;
|
||||
|
||||
//
|
||||
// Table of Projection's function values
|
||||
aNb=aPars.Length();
|
||||
IntTools_CArray1OfInteger anArrProjectability;
|
||||
anArrProjectability.Resize(aNb);
|
||||
|
||||
for (iProj=0, i=0; i<aNb; i++) {
|
||||
t0=aPars(i);
|
||||
aNbProj=IsProjectable (t0);
|
||||
|
||||
anArrProjectability(i)=0;
|
||||
if (aNbProj) {
|
||||
anArrProjectability(i)=1;
|
||||
iProj++;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Checking
|
||||
if (!iProj ) {
|
||||
myErrorStatus=7;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Projectable Ranges
|
||||
IntTools_Range aRange;
|
||||
|
||||
ind0=anArrProjectability(0);
|
||||
if (ind0) {
|
||||
t0=aPars(0);
|
||||
aRange.SetFirst(t0);
|
||||
}
|
||||
|
||||
for(i=1; i<aNb; i++) {
|
||||
ind1=anArrProjectability(i);
|
||||
t0=aPars(i-1);
|
||||
t1=aPars(i);
|
||||
|
||||
if (i==(aNb-1)) {
|
||||
if (ind1 && ind0) {
|
||||
aRange.SetLast(t1);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
if (ind1 && !ind0) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
aRange.SetFirst(tRoot);
|
||||
aRange.SetLast(t1);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
//
|
||||
if (ind0 && !ind1) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
aRange.SetLast(tRoot);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
if (ind0 != ind1) {
|
||||
FindProjectableRoot(t0, t1, ind0, ind1, tRoot);
|
||||
|
||||
if (ind0 && !ind1) {
|
||||
aRange.SetLast(tRoot);
|
||||
myProjectableRanges.Append(aRange);
|
||||
}
|
||||
else {
|
||||
aRange.SetFirst(tRoot);
|
||||
}
|
||||
} // if (ind0 != ind1)
|
||||
ind0=ind1;
|
||||
} // for(i=1; i<aNb; i++) {
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindProjectableRoot
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_EdgeFace::FindProjectableRoot (const Standard_Real tt1,
|
||||
const Standard_Real tt2,
|
||||
const Standard_Integer ff1,
|
||||
const Standard_Integer /*ff2*/,
|
||||
Standard_Real& tRoot)
|
||||
{
|
||||
Standard_Real tm, t1, t2, aEpsT;
|
||||
Standard_Integer anIsProj1, anIsProjm;
|
||||
aEpsT = 0.5 * myEpsT;
|
||||
|
||||
// Root is inside [tt1, tt2]
|
||||
t1 = tt1;
|
||||
t2 = tt2;
|
||||
anIsProj1 = ff1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if (fabs(t1 - t2) < aEpsT)
|
||||
{
|
||||
tRoot = (anIsProj1) ? t1 : t2;
|
||||
return;
|
||||
}
|
||||
tm = 0.5 * (t1 + t2);
|
||||
anIsProjm = IsProjectable(tm);
|
||||
|
||||
if (anIsProjm != anIsProj1)
|
||||
{
|
||||
t2 = tm;
|
||||
}
|
||||
else
|
||||
{
|
||||
t1 = tm;
|
||||
anIsProj1 = anIsProjm;
|
||||
}
|
||||
} // for(;;)
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsProjectable
|
||||
//purpose :
|
||||
@@ -651,6 +483,11 @@ Standard_Boolean IntTools_EdgeFace::CheckTouch
|
||||
(const IntTools_CommonPrt& aCP,
|
||||
Standard_Real& aTx)
|
||||
{
|
||||
if (myC.GetType() == GeomAbs_Line &&
|
||||
myS.GetType() == GeomAbs_Plane) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
Standard_Real aTF, aTL, Tol, U1f, U1l, V1f, V1l, af, al,aDist2, aMinDist2;
|
||||
Standard_Boolean theflag=Standard_False;
|
||||
Standard_Integer aNbExt, iLower;
|
||||
@@ -816,12 +653,8 @@ void IntTools_EdgeFace::Perform()
|
||||
myCriteria = aTolE + aTolF;
|
||||
}
|
||||
|
||||
myS.Initialize (myFace,Standard_True);
|
||||
myS = myContext->SurfaceAdaptor(myFace);
|
||||
|
||||
if(myContext.IsNull()) {
|
||||
myFClass2d.Init(myFace, 1.e-6);
|
||||
}
|
||||
//
|
||||
if (myQuickCoincidenceCheck) {
|
||||
if (IsCoincident()) {
|
||||
aCommonPrt.SetType(TopAbs_EDGE);
|
||||
|
@@ -28,8 +28,6 @@
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <IntTools_SequenceOfRanges.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_SequenceOfCommonPrts.hxx>
|
||||
#include <IntTools_Range.hxx>
|
||||
class IntTools_Context;
|
||||
@@ -38,7 +36,6 @@ class TopoDS_Face;
|
||||
class IntTools_Range;
|
||||
class gp_Pnt;
|
||||
class BRepAdaptor_Surface;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_CommonPrt;
|
||||
|
||||
|
||||
@@ -151,12 +148,8 @@ protected:
|
||||
Standard_EXPORT static Standard_Boolean IsEqDistance (const gp_Pnt& aP, const BRepAdaptor_Surface& aS, const Standard_Real aT, Standard_Real& aD);
|
||||
Standard_EXPORT void CheckData();
|
||||
|
||||
Standard_EXPORT void Prepare();
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsProjectable (const Standard_Real t) const;
|
||||
|
||||
Standard_EXPORT void FindProjectableRoot (const Standard_Real t1, const Standard_Real t2, const Standard_Integer f1, const Standard_Integer f2, Standard_Real& tRoot);
|
||||
|
||||
Standard_EXPORT Standard_Real DistanceFunction (const Standard_Real t);
|
||||
|
||||
Standard_EXPORT Standard_Integer MakeType (IntTools_CommonPrt& aCP);
|
||||
@@ -186,8 +179,6 @@ private:
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Integer myErrorStatus;
|
||||
Handle(IntTools_Context) myContext;
|
||||
IntTools_SequenceOfRanges myProjectableRanges;
|
||||
IntTools_FClass2d myFClass2d;
|
||||
IntTools_SequenceOfCommonPrts mySeqOfCommonPrts;
|
||||
IntTools_Range myRange;
|
||||
|
||||
|
@@ -134,7 +134,8 @@ static
|
||||
//
|
||||
static
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace);
|
||||
const TopoDS_Face& aFace,
|
||||
const Handle(IntTools_Context)& theCtx);
|
||||
|
||||
static
|
||||
Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
|
||||
@@ -313,26 +314,25 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
}
|
||||
|
||||
|
||||
static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
const TopoDS_Face& theF2,
|
||||
static Standard_Boolean isTreatAnalityc(const BRepAdaptor_Surface& theBAS1,
|
||||
const BRepAdaptor_Surface& theBAS2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
const Standard_Real Tolang = 1.e-8;
|
||||
Standard_Real aHigh = 0.0;
|
||||
|
||||
const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
|
||||
const GeomAbs_SurfaceType aType1=aBAS1.GetType();
|
||||
const GeomAbs_SurfaceType aType2=aBAS2.GetType();
|
||||
const GeomAbs_SurfaceType aType1=theBAS1.GetType();
|
||||
const GeomAbs_SurfaceType aType2=theBAS2.GetType();
|
||||
|
||||
gp_Pln aS1;
|
||||
gp_Cylinder aS2;
|
||||
if(aType1 == GeomAbs_Plane)
|
||||
{
|
||||
aS1=aBAS1.Plane();
|
||||
aS1=theBAS1.Plane();
|
||||
}
|
||||
else if(aType2 == GeomAbs_Plane)
|
||||
{
|
||||
aS1=aBAS2.Plane();
|
||||
aS1=theBAS2.Plane();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,9 +341,9 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
|
||||
if(aType1 == GeomAbs_Cylinder)
|
||||
{
|
||||
aS2=aBAS1.Cylinder();
|
||||
const Standard_Real VMin = aBAS1.FirstVParameter();
|
||||
const Standard_Real VMax = aBAS1.LastVParameter();
|
||||
aS2=theBAS1.Cylinder();
|
||||
const Standard_Real VMin = theBAS1.FirstVParameter();
|
||||
const Standard_Real VMax = theBAS1.LastVParameter();
|
||||
|
||||
if( Precision::IsNegativeInfinite(VMin) ||
|
||||
Precision::IsPositiveInfinite(VMax))
|
||||
@@ -353,10 +353,10 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
|
||||
}
|
||||
else if(aType2 == GeomAbs_Cylinder)
|
||||
{
|
||||
aS2=aBAS2.Cylinder();
|
||||
aS2=theBAS2.Cylinder();
|
||||
|
||||
const Standard_Real VMin = aBAS2.FirstVParameter();
|
||||
const Standard_Real VMax = aBAS2.LastVParameter();
|
||||
const Standard_Real VMin = theBAS2.FirstVParameter();
|
||||
const Standard_Real VMax = theBAS2.LastVParameter();
|
||||
|
||||
if( Precision::IsNegativeInfinite(VMin) ||
|
||||
Precision::IsPositiveInfinite(VMax))
|
||||
@@ -407,8 +407,8 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
myFace1=aF1;
|
||||
myFace2=aF2;
|
||||
|
||||
const BRepAdaptor_Surface aBAS1(myFace1, Standard_False);
|
||||
const BRepAdaptor_Surface aBAS2(myFace2, Standard_False);
|
||||
const BRepAdaptor_Surface& aBAS1 = myContext->SurfaceAdaptor(myFace1);
|
||||
const BRepAdaptor_Surface& aBAS2 = myContext->SurfaceAdaptor(myFace2);
|
||||
GeomAbs_SurfaceType aType1=aBAS1.GetType();
|
||||
GeomAbs_SurfaceType aType2=aBAS2.GetType();
|
||||
|
||||
@@ -462,11 +462,11 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
//
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
//
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
//
|
||||
@@ -514,11 +514,11 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
// F1
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
// F2
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
@@ -526,21 +526,21 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
//F1
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
// F2
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectPlaneBoundaries(umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace1, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
|
||||
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
myContext->UVBounds(myFace2, umin, umax, vmin, vmax);
|
||||
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
|
||||
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
|
||||
}
|
||||
@@ -626,9 +626,12 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
|
||||
}
|
||||
#endif
|
||||
|
||||
const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2, myTol);
|
||||
myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
|
||||
myListOfPnts, RestrictLine, isGeomInt);
|
||||
const Standard_Boolean isGeomInt = isTreatAnalityc(aBAS1, aBAS2, myTol);
|
||||
if (aF1.IsSame(aF2))
|
||||
myIntersector.Perform(myHS1, dom1, TolArc, TolTang);
|
||||
else
|
||||
myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
|
||||
myListOfPnts, RestrictLine, isGeomInt);
|
||||
|
||||
myIsDone = myIntersector.IsDone();
|
||||
|
||||
@@ -1648,7 +1651,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
}
|
||||
}
|
||||
// ###########################################
|
||||
bPCurvesOk = CheckPCurve(BS1, myFace2);
|
||||
bPCurvesOk = CheckPCurve(BS1, myFace2, myContext);
|
||||
aCurve.SetSecondCurve2d(BS1);
|
||||
}
|
||||
else {
|
||||
@@ -1674,7 +1677,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
}
|
||||
}
|
||||
// ###########################################
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(BS2, myFace1, myContext);
|
||||
aCurve.SetFirstCurve2d(BS2);
|
||||
}
|
||||
else {
|
||||
@@ -1693,12 +1696,12 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
|
||||
if(myApprox1) {
|
||||
H1 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_True);
|
||||
bPCurvesOk = CheckPCurve(H1, myFace1);
|
||||
bPCurvesOk = CheckPCurve(H1, myFace1, myContext);
|
||||
}
|
||||
|
||||
if(myApprox2) {
|
||||
H2 = GeomInt_IntSS::MakeBSpline2d(WL, ifprm, ilprm, Standard_False);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2);
|
||||
bPCurvesOk = bPCurvesOk && CheckPCurve(H2, myFace2, myContext);
|
||||
}
|
||||
//
|
||||
//if pcurves created without approximation are out of the
|
||||
@@ -1753,7 +1756,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
newCheck.FixTangent(Standard_True,Standard_True);
|
||||
//
|
||||
if (!reApprox) {
|
||||
bIsValid1=CheckPCurve(BS1, myFace1);
|
||||
bIsValid1=CheckPCurve(BS1, myFace1, myContext);
|
||||
}
|
||||
//
|
||||
aCurve.SetFirstCurve2d(BS1);
|
||||
@@ -1785,7 +1788,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
newCheck.FixTangent(Standard_True,Standard_True);
|
||||
//
|
||||
if (!reApprox) {
|
||||
bIsValid2=CheckPCurve(BS2, myFace2);
|
||||
bIsValid2=CheckPCurve(BS2, myFace2, myContext);
|
||||
}
|
||||
aCurve.SetSecondCurve2d(BS2);
|
||||
}
|
||||
@@ -2961,14 +2964,15 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
|
||||
//function : CheckPCurve
|
||||
//purpose : Checks if points of the pcurve are out of the face bounds.
|
||||
//=======================================================================
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace)
|
||||
Standard_Boolean CheckPCurve(const Handle(Geom2d_Curve)& aPC,
|
||||
const TopoDS_Face& aFace,
|
||||
const Handle(IntTools_Context)& theCtx)
|
||||
{
|
||||
const Standard_Integer NPoints = 23;
|
||||
Standard_Integer i;
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
|
||||
BRepTools::UVBounds(aFace, umin, umax, vmin, vmax);
|
||||
theCtx->UVBounds(aFace, umin, umax, vmin, vmax);
|
||||
Standard_Real tolU = Max ((umax-umin)*0.01, Precision::Confusion());
|
||||
Standard_Real tolV = Max ((vmax-vmin)*0.01, Precision::Confusion());
|
||||
Standard_Real fp = aPC->FirstParameter();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user