1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0021762: Integration of new Boolean Operation algorithm to OCCT.

Modifications:
- BRepOffset/BRepOffset_Tool.cxx, Features and Fillets algorithms have been ported on new BO algorithm.
- Old BO algorithm, that was implemented in BOP, BooleanOperations and BOPTools packages, has - been deleted.
- Porting SALOME algorithms to new BOP algorithm.
- Fixing regressions. Rebased on current master.
- Corrections in post treatment of section edges;
- Corrections in the accordance with the bug 0023293;
- Small corrections in the bopcheck and bopargcheck commands.
- NCollection maps have been replaced by NCollection indexed maps to guarantee the constant order of sub-shapes in the result of boolean operation.
- Test case feat featprism M9 has been fixed.
- Test cases chl 902 E3 H3 have been fixed (corrections in the treatment of section edges).
- Test cases caf driver B6 B7, caf named_shape F6 F7 have been modified according to the new order of sub-shapes in the result of boolean operation.
- Test cases blend buildevol G1, blend simple K4, bcommon_complex C7, feat featprism L6 have been modified as they are improvements.
- Test case boolean bsection A3 has been modified according to the new syntax of the bsection command.
- Test cases boolean bfuse_complex J1 P9 have been fixed (the function IsInternalFace has been modified to use the function GetFaceOff);
- Test case chl 902 H3 has been fixed (changes in the treatment of section edges);
- Test case boolean bsection D8 has been modified (removed TODO statement);
- Test case boolean bsection A3 has been modified (as the shapes have been changed).
- Added correction of the tolerance values of the shapes according to the bug 0023610.
- test cases:
    boolean bcommon_complex C3,
    boolean bcut_complex F2 O7,
    boolean bfuse_complex C4 C5 E4,
    boolean bsection B6 M8 M9 N4 N5 N7,
    boolean bfuse_simple ZP6,
    draft angle G8,
    feat featprism S2
have been marked as invalid according to the bug 0022033;
- New value of result has been set in the test cases :
    boolean bopsection D4
    boolean bsection R8
as it is correct.
- test case bugs modalg bug23472 has been rewritten according to the new format of bsection command.
- The classes IntTools_Context and IntTools_ShrunkRange have been replaced by BOPInt_Context and BOPInt_ShrunkRange accordingly.
- The new class BRepAlgoAPI_Check has been added according to the bug 0023648.
- Some regressions have been fixed.
- The following test cases have been marked as invalid or rewritten
    bugs modalg buc60462_2, 60531_2, 60776_1, bug472_1, bug472_2, bug472_3, bug497_3, bug62
    bugs moddata bug26_1, bug26_2,
- The test case bugs modalg buc60533 has been rewritten to use the general fuse algorithm for building the result.
- The new value of the result has been set in the test case bugs modalg 60776_2.
- The following test cases have been rewritten according to the new format of the bsection command
    bugs modlag fra62369, pro18892
    bugs moddata bug75_1, bug75_2
- Corrected BRepAlgoAPI_Check.
- Removed package BOPTColStd.
- Rewritten test cases caf named_shape F8 F9.
- Removed unnecessary comments.
- Corrected the following test scripts :
    boolean bcut_complex(012) O3 O4 O5 O6 O8
    boolean bfuse_complex(013) O5 O6 P8
    boolean bopcommon_complex(021) D8 D9
    boolean bopfuse_complex(022) H1 J6
    boolean boptuc_complex(024) D5
    bugs modalg(006) bug399 bug497_1
    feat featprism(003) C4
- Corrections in the treatment of section edges (putting paves on the curves);
- Corrections in BRepOffset_Tool;
- The following test cases have been rewritten according to the new format of the bsection command
   bugs modalg bug6502, bug6554, bug6766_1, bug6766_3
- The new value of the result has been set in the following test cases
   bugs modalg bug1255, bug1255_1
- The following test cases have been marked as invalid or rewritten
   bugs modalg bug472_2, bug472_3, bug825_2
   bugs moddata bug10603, bug152_1, bug152_2, bug3721_1, bug3721_2, bug3721_3
- The following test cases have been rewritten as improvements
   bugs modalg bug693, bug693_1, bug817_1
   bugs moddata bug3721_5, bug3721_6, bug6862_3, bug6862_4, bug6862_6
- Test cases bugs modlag buc60787_1, buc60787_2, buc60788_2, buc60788_3 have been corrected.
- Fixed some SALOME regressions (modifications in the treatment of the section edges);
- Fixed test case bugs modalg bug23100;
- Test cases bugs modalg bug21754, bug22990 have been corrected according to the new format of the bsection command.
- Test cases bugs modalg bug13116_*, bug23711 have been fixed;
- Test cases bugs modalg bug697_2, bug697_4, bug697_7, bug697_8 have been marked as invalid according to the issue 0022033;
- Test cases bugs modalg bug22109_2, bug22109_3 have been corrected;
- Test case bugs modalg bug18186 has been corrected as it is improvement;
- Test case bugs modalg bug22802 has been deleted as there is no package BOPTColStd.
This commit is contained in:
emv
2013-02-08 17:42:05 +04:00
parent a8676008f7
commit 4e57c75ee1
642 changed files with 41074 additions and 67959 deletions

View File

@@ -1,4 +1,3 @@
-- Created on: 2000-11-16
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
@@ -17,372 +16,67 @@
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
package BOPTools
package BOPTools
---Purpose:
---Purpose:
--- Contains main and auxiliary classes to fill the
--- Data Structure (DS) to provide boolean
--- operations between a couple BRep shapes.
---
uses
uses
gp,
Bnd,
TopAbs,
TopAbs,
Geom,
Geom2d,
GeomAPI,
BRepClass3d,
TopoDS,
TopTools,
TCollection,
TColStd,
SortTools,
Geom,
Geom2d,
IntTools,
ProjLib,
BooleanOperations,
BOPTColStd,
IntTools
--
BOPCol,
BOPInt
is
--
-- classes
--
class ShapeSet;
class EdgeSet;
class AlgoTools;
class Set;
class SetMapHasher;
class AlgoTools2D;
class AlgoTools3D;
--
imported MapOfSet;
imported DataMapOfShapeSet;
--
-- primitives
--
imported ListOfShapeSet from BOPTools;
imported ListOfEdgeSet from BOPTools;
imported ConnexityBlock from BOPTools;
imported ListOfConnexityBlock from BOPTools;
imported CoupleOfShape from BOPTools;
imported ListOfCoupleOfShape from BOPTools;
--
-- static methods
--
MapShapes(S : Shape from TopoDS;
M : in out MapOfShape from BOPCol);
MapShapes(S : Shape from TopoDS;
M : in out IndexedMapOfShape from BOPCol);
MapShapes(S : Shape from TopoDS;
T : ShapeEnum from TopAbs;
M : in out IndexedMapOfShape from BOPCol);
MapShapesAndAncestors
(S : Shape from TopoDS;
TS : ShapeEnum from TopAbs;
TA : ShapeEnum from TopAbs;
M : in out IndexedDataMapOfShapeListOfShape from BOPCol);
is
---
--- E n u m e r a t i o n s
---
enumeration IntersectionStatus is
INTERSECTED,
BOUNDINGBOXINTERSECTED,
BOUNDINGBOXOFSUBSHAPESINTERSECTED,
NONINTERSECTED,
UNKNOWN
end IntersectionStatus;
enumeration CheckStatus is
CHKUNKNOWN,
VERTEXVERTEX,
VERTEXEDGE,
VERTEXFACE,
EDGEEDGE,
EDGEEDGECOMBLK,
EDGEFACE,
EDGEFACECOMBLK,
FACEFACE,
BADSHRANKRANGE,
NULLSRANKRANGE
end CheckStatus;
---
--- T h e C l a s s e s
---
--- +==========================+
--- ! Fillers and friends !
--- +==========================+
class PaveFiller;
---Purpose:
--- Class that provides
--- 1. computation of interferences of all types
--- 2. storing the interferences in interferences' pool
--- 3. building new vertices, edges and storing them in the DS
--- 4. preparing the information about PaveBlocks, CommonBlocks
---
class DSFiller;
---Purpose:
--- Class that provides
--- 1. creation of the data structure (DS)
--- 2. creation of the interferences' pool
--- 3. invokation of PaveFiller->Perform() to fill the DS
---
---
class DEProcessor;
---Purpose:
--- Class to compute and store in interferences' pool
--- and DS the following values
--- for degenerated edges
--- 1. Paves/Pave set(s)
--- 2. Split parts
--- 3. States (3D) for split parts
---
class PCurveMaker;
---Purpose:
--- Class to compute p-curves for the edges and theirs
--- split parts
---
class SolidStateFiller;
---Purpose:
--- Class to compute states (3D) for the edges (and theirs
--- split parts), vertices, wires, faces, shells
---
class StateFiller;
---Purpose:
--- Root class for state fillers
---
class WireStateFiller;
---Purpose:
--- Class to compute states (3D) for the edges (and theirs
--- split parts), vertices, wires
---
--- +================================+
--- ! Paves and Blocks of Paves !
--- +================================+
class Pave;
---Purpose:
--- Class for storing info about a vertex on an edge
---
class PaveBlock;
---Purpose:
--- Class for storing info about a couple
--- of neighbouring paves on an edge
---
class PaveSet;
---Purpose:
--- Class for storing/sorting paves that belong to an edge
---
class PaveBlockIterator;
---Purpose:
--- Class providing iterations for PaveSet to
--- have the right order of paves along the edge
---
class ComparePave;
---Purpose:
--- Class providing interface necessary for sorting
--- paves along the edge
---
class CommonBlock;
---Purpose:
--- Class for storing info about a couple
--- of pave blocks that are considered as common
---
class CommonBlockAPI;
---Purpose:
--- Class that provide useful tools to manage with
--- List Of Common Block-s
---
--- +==============+
--- ! Intrferences !
--- +==============+
class ShapeShapeInterference;
---Purpose:
--- Root class for storing an Interference
--- between a couple BRep shapes
---
class VVInterference;
---Purpose:
--- Class for storing an Verex/Vertex
--- interference
---
class VSInterference;
---Purpose:
--- Class for storing an Verex/Face
--- interference
---
class VEInterference;
---Purpose:
--- Class for storing an Verex/Edge
--- interference
---
class EEInterference;
---Purpose:
--- Class for storing an Edge/Edge
--- interference
---
class ESInterference;
---Purpose:
--- Class for storing an Edge/Face
--- interference
---
class SSInterference;
---Purpose:
--- Class for storing an Face/Face
--- interference
---
class Interference;
---Purpose:
--- Class for storing information about an
--- interference
---
class InterferenceLine;
---Purpose:
--- Class for storing information about all
--- interferences for given shape
---
class InterferencePool;
---Purpose:
--- Class for storing information about
--- results of all interferences for all shapes
---
--- +=======+
--- ! Tools !
--- +=======+
class Tools;
class Tools2D;
class Tools3D;
--- +=============+
--- ! Miscellanea !
--- +=============+
class DEInfo;
---Purpose:
--- Class for storing information about
--- a degenerated edge
---
class PointBetween;
---Purpose:
--- Class for storing geometry information about
--- a point between neighbouring paves along
--- an edge
---
class Curve;
---Purpose:
--- Class for storing information about
--- intersection curve and set of paves on it
---
class CoupleOfInteger;
class Checker;
---Purpose:
--- Class that provides the algorithm
--- to check a shape on self-interference.
---
class CheckResult;
---Purpose: provides a container to store faulty
--- sub - shapes in tested shape with type of
--- detected faulty
---
--- P o i n t e r s
---
pointer PInterferencePool to InterferencePool from BOPTools;
pointer PPaveFiller to PaveFiller from BOPTools;
pointer PDSFiller to DSFiller from BOPTools;
pointer PShapeShapeInterference to ShapeShapeInterference from BOPTools;
---
--- I n s t a n t i a t i o n s
---
class ListOfCoupleOfInteger instantiates
List from TCollection (CoupleOfInteger from BOPTools);
class ListOfInterference instantiates
List from TCollection (Interference from BOPTools);
class CArray1OfInterferenceLine instantiates
CArray1 from BOPTColStd(InterferenceLine from BOPTools);
class CArray1OfSSInterference instantiates
CArray1 from BOPTColStd(SSInterference from BOPTools);
class CArray1OfESInterference instantiates
CArray1 from BOPTColStd(ESInterference from BOPTools);
class CArray1OfVSInterference instantiates
CArray1 from BOPTColStd(VSInterference from BOPTools);
class CArray1OfEEInterference instantiates
CArray1 from BOPTColStd(EEInterference from BOPTools);
class CArray1OfVEInterference instantiates
CArray1 from BOPTColStd(VEInterference from BOPTools);
class CArray1OfVVInterference instantiates
CArray1 from BOPTColStd(VVInterference from BOPTools);
class PavePool instantiates
CArray1 from BOPTColStd(PaveSet from BOPTools);
class ListOfPave instantiates
List from TCollection(Pave);
class ListOfCommonBlock instantiates
List from TCollection(CommonBlock from BOPTools);
class ListOfPaveBlock instantiates
List from TCollection(PaveBlock from BOPTools);
class CommonBlockPool instantiates
CArray1 from BOPTColStd (ListOfCommonBlock from BOPTools);
class SplitShapesPool instantiates
CArray1 from BOPTColStd (ListOfPaveBlock from BOPTools);
class Array1OfPave instantiates
Array1 from TCollection (Pave from BOPTools);
class CArray1OfPave instantiates
CArray1 from BOPTColStd (Pave from BOPTools);
class QuickSortPave instantiates
QuickSort from SortTools (Pave from BOPTools,
Array1OfPave from BOPTools,
ComparePave from BOPTools);
class IndexedDataMapOfIntegerState instantiates
IndexedDataMap from TCollection (Integer from Standard,
StateOfShape from BooleanOperations,
MapIntegerHasher from TColStd);
class SequenceOfCurves instantiates
Sequence from TCollection(Curve from BOPTools);
class IndexedDataMapOfShapeWithState instantiates
IndexedDataMap from TCollection (Shape from TopoDS,
StateOfShape from BooleanOperations,
ShapeMapHasher from TopTools);
class ListOfShapeEnum instantiates
List from TCollection(ShapeEnum from TopAbs);
class IndexedDataMapOfIntegerDEInfo instantiates
IndexedDataMap from TCollection (Integer from Standard,
DEInfo from BOPTools,
MapIntegerHasher from TColStd);
class Array2OfIntersectionStatus instantiates
Array2 from TCollection (IntersectionStatus from BOPTools);
class HArray2OfIntersectionStatus instantiates
HArray2 from TCollection (IntersectionStatus from BOPTools,
Array2OfIntersectionStatus from BOPTools);
class ListOfCheckResults instantiates
List from TCollection (CheckResult from BOPTools);
class RoughShapeIntersector;
class IteratorOfCoupleOfShape;
class SSIntersectionAttribute;
--
-- additions
--
class CoupleOfIntegerMapHasher;
class PaveBlockMapHasher;
class IndexedMapOfCoupleOfInteger instantiates
IndexedMap from TCollection(CoupleOfInteger from BOPTools,
CoupleOfIntegerMapHasher from BOPTools);
class IndexedDataMapOfIntegerPaveSet instantiates
IndexedDataMap from TCollection (Integer from Standard,
PaveSet from BOPTools,
MapIntegerHasher from TColStd);
class IMapOfPaveBlock instantiates
IndexedMap from TCollection(PaveBlock from BOPTools,
PaveBlockMapHasher from BOPTools);
class IDMapOfPaveBlockIMapOfPaveBlock instantiates
IndexedDataMap from TCollection (PaveBlock from BOPTools ,
IMapOfPaveBlock from BOPTools,
PaveBlockMapHasher from BOPTools);
class IDMapOfPaveBlockIMapOfInteger instantiates
IndexedDataMap from TCollection (PaveBlock from BOPTools ,
IndexedMapOfInteger from TColStd,
PaveBlockMapHasher from BOPTools);
class SequenceOfPaveBlock instantiates
Sequence from TCollection(PaveBlock from BOPTools);
end BOPTools;
end BOPTools;

105
src/BOPTools/BOPTools.cxx Normal file
View File

@@ -0,0 +1,105 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools.ixx>
#include <TopExp_Explorer.hxx>
#include <BOPCol_ListOfShape.hxx>
//=======================================================================
//function : MapShapes
//purpose :
//=======================================================================
void BOPTools::MapShapes(const TopoDS_Shape& S,
BOPCol_MapOfShape& M)
{
M.Add(S);
TopoDS_Iterator It(S);
while (It.More()) {
MapShapes(It.Value(),M);
It.Next();
}
}
//=======================================================================
//function : MapShapes
//purpose :
//=======================================================================
void BOPTools::MapShapes(const TopoDS_Shape& S,
BOPCol_IndexedMapOfShape& M)
{
M.Add(S);
TopoDS_Iterator It(S);
while (It.More()) {
MapShapes(It.Value(),M);
It.Next();
}
}
//=======================================================================
//function : MapShapes
//purpose :
//=======================================================================
void BOPTools::MapShapes(const TopoDS_Shape& S,
const TopAbs_ShapeEnum T,
BOPCol_IndexedMapOfShape& M)
{
TopExp_Explorer Ex(S,T);
while (Ex.More()) {
M.Add(Ex.Current());
Ex.Next();
}
}
//=======================================================================
//function : MapShapesAndAncestors
//purpose :
//=======================================================================
void BOPTools::MapShapesAndAncestors(const TopoDS_Shape& S,
const TopAbs_ShapeEnum TS,
const TopAbs_ShapeEnum TA,
BOPCol_IndexedDataMapOfShapeListOfShape& M)
{
BOPCol_ListOfShape empty;
// visit ancestors
TopExp_Explorer exa(S,TA);
while (exa.More()) {
// visit shapes
const TopoDS_Shape& anc = exa.Current();
TopExp_Explorer exs(anc,TS);
while (exs.More()) {
Standard_Integer index = M.FindIndex(exs.Current());
if (index == 0) index = M.Add(exs.Current(),empty);
M(index).Append(anc);
exs.Next();
}
exa.Next();
}
// visit shapes not under ancestors
TopExp_Explorer ex(S,TS,TA);
while (ex.More()) {
Standard_Integer index = M.FindIndex(ex.Current());
if (index == 0) index = M.Add(ex.Current(),empty);
ex.Next();
}
}

View File

@@ -0,0 +1,470 @@
-- Created by: Peter KURNEV
-- Copyright (c) 2010-2012 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
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class AlgoTools from BOPTools
---Purpose:
uses
Pnt from gp,
Pnt2d from gp,
Dir from gp,
Plane from Geom,
State from TopAbs,
ShapeEnum from TopAbs,
Curve from IntTools,
Shape from TopoDS,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Wire from TopoDS,
Solid from TopoDS,
--
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
IndexedMapOfShape from BOPCol,
IndexedDataMapOfShapeListOfShape from BOPCol,
Context from BOPInt,
ListOfCoupleOfShape from BOPTools,
Range from IntTools
--raises
is
ComputeVV(myclass;
aV1:Vertex from TopoDS;
aP2:Pnt from gp;
aTolP2:Real from Standard)
returns Integer from Standard;
ComputeVV(myclass;
aV1:Vertex from TopoDS;
aV2:Vertex from TopoDS)
returns Integer from Standard;
MakeVertex (myclass;
aLV: out ListOfShape from BOPCol;
aV : out Vertex from TopoDS);
MakeEdge(myclass;
theCurve:Curve from IntTools;
theV1: Vertex from TopoDS;
theT1: Real from Standard;
theV2: Vertex from TopoDS;
theT2: Real from Standard;
theTolR3D: Real from Standard;
theE :out Edge from TopoDS);
MakePCurve(myclass;
theE : Edge from TopoDS;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
theCurve:Curve from IntTools;
thePC1:Boolean from Standard;
thePC2:Boolean from Standard);
MakeContainer(myclass;
theType:ShapeEnum from TopAbs;
theShape:out Shape from TopoDS);
IsHole(myclass;
aW: Shape from TopoDS;
aF: Shape from TopoDS)
returns Boolean from Standard;
IsSplitToReverse(myclass;
theSplit : Shape from TopoDS;
theShape : Shape from TopoDS;
theContext:out Context from BOPInt)
---Purpose: Returns True if the shape theSplit has opposite
-- direction than theShape
-- theContext - cashed geometrical tools
returns Boolean from Standard;
IsSplitToReverse(myclass;
theSplit : Face from TopoDS;
theShape : Face from TopoDS;
theContext:out Context from BOPInt)
---Purpose: Returns True if normal direction of the face
-- theShape is not the same as for the face
-- theSplit
-- theContext - cashed geometrical tools
returns Boolean from Standard;
IsSplitToReverse (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
aContext:out Context from BOPInt)
returns Boolean from Standard;
AreFacesSameDomain(myclass;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
theContext:out Context from BOPInt)
returns Boolean from Standard;
CheckSameGeom (myclass;
theF1: Face from TopoDS;
theF2: Face from TopoDS;
theContext:out Context from BOPInt)
returns Boolean from Standard;
Sense (myclass;
theF1: Face from TopoDS;
theF2: Face from TopoDS)
returns Integer from Standard;
GetEdgeOff (myclass;
theEdge :Edge from TopoDS;
theFace :Face from TopoDS;
theEdgeOff :out Edge from TopoDS)
---Purpose: Returns True if the face theFace contains
-- the edge theEdge but with opposite orientation.
-- If the method returns True theEdgeOff is the
-- edge founded
returns Boolean from Standard;
GetFaceOff(myclass;
theEdge :Edge from TopoDS;
theFace :Face from TopoDS;
theLCEF :out ListOfCoupleOfShape from BOPTools;
theFaceOff :out Face from TopoDS;
theContext :out Context from BOPInt);
---Purpose: For the face theFace and its edge theEdge
-- finds the face suitable to produce shell.
-- theLCEF - set of faces to search. All faces
-- from theLCEF must share edge theEdge
IsInternalFace(myclass;
theFace :Face from TopoDS;
theEdge :Edge from TopoDS;
theFace1 :Face from TopoDS;
theFace2 :Face from TopoDS;
theContext:out Context from BOPInt)
---Purpose: Returns True if the face theFace is inside of the
-- couple of faces theFace1, theFace2.
-- The faces theFace, theFace1, theFace2 must
-- share the edge theEdge
returns Boolean from Standard;
IsInternalFace(myclass;
theFace :Face from TopoDS;
theEdge :Edge from TopoDS;
theLF :out ListOfShape from BOPCol;
theContext:out Context from BOPInt)
---Purpose: Returns True if the face theFace is inside of the
-- appropriate couple of faces (from the set theLF) .
-- The faces of the set theLF and theFace must
-- share the edge theEdge
returns Boolean from Standard;
IsInternalFace(myclass;
theFace :Face from TopoDS;
theSolid :Solid from TopoDS;
theMEF :out IndexedDataMapOfShapeListOfShape from BOPCol;
theTol :Real from Standard;
theContext:out Context from BOPInt)
---Purpose: Returns True if the face theFace is inside the
-- solid theSolid.
-- theMEF - Map Edge/Faces for theSolid
-- theTol - value of precision of computation
-- theContext- cahed geometrical tools
returns Boolean from Standard;
GetEdgeOnFace (myclass;
theEdge :Edge from TopoDS;
theFace :Face from TopoDS;
theEdgeOnF :out Edge from TopoDS)
---Purpose: For the face theFace gets the edge theEdgeOnF
-- that is the same as theEdge
-- Returns True if such edge exists
-- Returns False if there is no such edge
returns Boolean from Standard;
ComputeState(myclass;
thePoint :Pnt from gp;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theContext:out Context from BOPInt)
---Purpose: Computes the 3-D state of the point thePoint
-- toward solid theSolid.
-- theTol - value of precision of computation
-- theContext- cahed geometrical tools
-- Returns 3-D state.
returns State from TopAbs;
ComputeState(myclass;
theVertex:Vertex from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theContext:out Context from BOPInt)
---Purpose: Computes the 3-D state of the vertex theVertex
-- toward solid theSolid.
-- theTol - value of precision of computation
-- theContext- cahed geometrical tools
-- Returns 3-D state.
returns State from TopAbs;
ComputeState(myclass;
theEdge :Edge from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theContext:out Context from BOPInt)
---Purpose: Computes the 3-D state of the edge theEdge
-- toward solid theSolid.
-- theTol - value of precision of computation
-- theContext- cahed geometrical tools
-- Returns 3-D state.
returns State from TopAbs;
ComputeState(myclass;
theFace :Face from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theBounds:out IndexedMapOfShape from BOPCol;
theContext:out Context from BOPInt)
---Purpose: Computes the 3-D state of the face theFace
-- toward solid theSolid.
-- theTol - value of precision of computation
-- theBounds - set of edges of theFace to avoid
-- theContext- cahed geometrical tools
-- Returns 3-D state.
returns State from TopAbs;
ComputeStateByOnePoint(myclass;
theShape :Shape from TopoDS;
theSolid :Solid from TopoDS;
theTol :Real from Standard;
theContext:out Context from BOPInt)
---Purpose: Computes the 3-D state of the shape theShape
-- toward solid theSolid.
-- theTol - value of precision of computation
-- theContext- cahed geometrical tools
-- Returns 3-D state.
returns State from TopAbs;
MakeConnexityBlock(myclass;
theLS :out ListOfShape from BOPCol;
theMapAvoid:out IndexedMapOfShape from BOPCol;
theLSCB :out ListOfShape from BOPCol;
theAllocator:BaseAllocator from BOPCol);
---Purpose: For the list of faces theLS build block
-- theLSCB in terms of connexity by edges
-- theMapAvoid - set of edges to avoid for
-- the treatment
MakeConnexityBlocks(myclass;
theS :Shape from TopoDS;
theType1 :ShapeEnum from TopAbs;
theType2 :ShapeEnum from TopAbs;
theLCB :out ListOfShape from BOPCol);
---Purpose: For the compound theS build the blocks
-- theLCB (as list of compounds)
-- in terms of connexity by the shapes of theType
OrientFacesOnShell (myclass;
theS :out Shape from TopoDS);
CorrectTolerances (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001);
---Purpose:
--- Provides valid values of tolerances for the shape <theS>
--- <theTolMax> is max value of the tolerance that can be
--- accepted for correction. If real value of the tolerance
--- will be greater than <aTolMax>, the correction does not
--- perform.
---
CorrectCurveOnSurface (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001);
---Purpose:
--- Provides valid values of tolerances for the shape <theS>
--- in terms of BRepCheck_InvalidCurveOnSurface.
---
CorrectPointOnCurve (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001);
---Purpose:
--- Provides valid values of tolerances for the shape <theS>
--- in terms of BRepCheck_InvalidPointOnCurve.
---
--fields
CorrectPoint (myclass;
thePnt:Pnt from gp;
thePL:Plane from Geom;
theNewPnt:out Pnt from gp);
--copy from BOPTools_AlgoTools.cdl
MakeNewVertex (myclass;
aP1 : Pnt from gp;
aTol: Real from Standard;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol>
---
MakeNewVertex (myclass;
aV1,aV2: Vertex from TopoDS;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex using couple of vertices <aV1, aV2>
---
MakeNewVertex (myclass;
aE1: Edge from TopoDS;
aP1: Real from Standard;
aE2: Edge from TopoDS;
aP2: Real from Standard;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex in place of intersection between two edges
--- <aE1, aE2> with parameters <aP1, aP2>
---
MakeNewVertex (myclass;
aE1: Edge from TopoDS;
aP1: Real from Standard;
aF2: Face from TopoDS;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex in place of intersection between the edge <aE1>
--- with parameter <aP1> and the face <aF2>
---
PointOnEdge (myclass;
aEdge: Edge from TopoDS;
aPrm: Real from Standard;
aP:out Pnt from gp);
---Purpose:
--- Compute a 3D-point on the edge <aEdge> at parameter <aPrm>
---
MakeSplitEdge (myclass;
aE1: Edge from TopoDS;
aV1: Vertex from TopoDS;
aP1: Real from Standard;
aV2: Vertex from TopoDS;
aP2: Real from Standard;
aNewEdge:out Edge from TopoDS);
---Purpose:
--- Make the edge from base edge <aE1> and two vertices <aV1,aV2>
--- at parameters <aP1,aP2>
---
MakeSectEdge (myclass;
aIC: Curve from IntTools;
aV1: Vertex from TopoDS;
aP1: Real from Standard;
aV2: Vertex from TopoDS;
aP2: Real from Standard;
aNewEdge:out Edge from TopoDS);
---Purpose:
--- Make the edge from 3D-Curve <aIC> and two vertices <aV1,aV2>
--- at parameters <aP1,aP2>
---
UpdateVertex (myclass;
aIC: Curve from IntTools;
aT : Real from Standard;
aV : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aV>
--- taking into account the fact that <aV> lays on
--- the curve <aIC>
---
UpdateVertex (myclass;
aE : Edge from TopoDS;
aT : Real from Standard;
aV : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aV>
--- taking into account the fact that <aV> lays on
--- the edge <aE>
---
UpdateVertex (myclass;
aVF : Vertex from TopoDS;
aVN : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aVN>
--- taking into account the fact that <aVN> should
--- cover tolerance zone of <aVF>
---
CorrectRange (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
aSR: Range from IntTools;
aNewSR:out Range from IntTools);
---Purpose:
--- Correct shrunk range <aSR> taking into account 3D-curve
--- resolution and corresp. tolerances' values of <aE1>, <aE2>
---
CorrectRange (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aSR: Range from IntTools;
aNewSR:out Range from IntTools);
---Purpose:
--- Correct shrunk range <aSR> taking into account 3D-curve
--- resolution and corresp. tolerances' values of <aE>, <aF>
---
IsBlockInOnFace(myclass;
aShR : Range from IntTools;
aF : Face from TopoDS;
aE : Edge from TopoDS;
aContext:out Context from BOPInt)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e
--- the <PB> is IN or ON in 2D of <aF>
GetProjectPoint(myclass;
aF : Face from TopoDS;
aPF : Pnt from gp;
aF1 : Face from TopoDS;
aPF1 : out Pnt from gp;
aDNF1 : out Dir from gp;
theContext : out Context from BOPInt)
returns Boolean from Standard;
---Purpose:
--- Computes projection of the point <aP> on the face <theFace>.
--- Returns TRUE if projection is done.
IsMicroEdge(myclass;
theEdge : Edge from TopoDS;
theContext : Context from BOPInt)
returns Boolean from Standard;
---Purpose:
--- Checks if it is possible to compute shrunk range for the edge <aE>.
---
CorrectShapeTolerances (myclass;
theS: Shape from TopoDS);
---Purpose:
--- Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
---
Dimension(myclass;
theS:Shape from TopoDS)
returns Integer from Standard;
---Purpose:
--- Retutns dimension of the shape <theS>.
end AlgoTools;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,200 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class AlgoTools2D from BOPTools
---Purpose:
--- The class contains handy static functions
--- dealing with the topology
--- This is the copy of the BOPTools_AlgoTools2D.cdl
uses
Vec from gp,
Dir from gp,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Curve from Geom2d,
Curve from Geom,
ProjectedCurve from ProjLib
is
BuildPCurveForEdgeOnFace (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS);
---Purpose:
--- Compute P-Curve for the edge <aE> on the face <aF>
---
EdgeTangent (myclass;
anE : Edge from TopoDS;
aT : Real from Standard;
Tau : out Vec from gp)
returns Boolean from Standard;
---Purpose:
--- Compute tangent for the edge <aE> [in 3D] at parameter <aT>
---
PointOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
U : out Real from Standard;
V : out Real from Standard);
---Purpose:
--- Compute surface parameters <U,V> of the face <aF>
--- for the point from the edge <aE> at parameter <aT>.
---
CurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aToler: out Real from Standard);
---Purpose:
--- Get P-Curve <aC> for the edge <aE> on surface <aF> .
--- If the P-Curve does not exist, build it using Make2D().
--- [aToler] - reached tolerance
---
CurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard);
---Purpose:
--- 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
---
HasCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the edge <aE> has P-Curve <aC>
--- on surface <aF> .
--- [aFirst, aLast] - range of the P-Curve
--- [aToler] - reached tolerance
--- If the P-Curve does not exist, aC.IsNull()=TRUE.
---
HasCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the edge <aE> has P-Curve <aC>
--- on surface <aF> .
--- If the P-Curve does not exist, aC.IsNull()=TRUE.
---
AdjustPCurveOnFace (myclass;
aF : Face from TopoDS;
C3D : Curve from Geom;
aC2D : Curve from Geom2d;
aC2DA : out Curve from Geom2d);
---Purpose:
--- Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
---
AdjustPCurveOnFace (myclass;
aF : Face from TopoDS;
aT1 : Real from Standard;
aT2 : Real from Standard;
aC2D : Curve from Geom2d;
aC2DA : out Curve from Geom2d);
---Purpose:
--- Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
--- [aT1, aT2] - range to adjust
---
IntermediatePoint (myclass;
aFirst: Real from Standard;
aLast : Real from Standard)
returns Real from Standard;
---Purpose:
--- Compute intermediate value in between [aFirst, aLast] .
---
IntermediatePoint (myclass;
anE : Edge from TopoDS)
returns Real from Standard;
---Purpose:
--- Compute intermediate value of parameter for the edge <anE>.
---
BuildPCurveForEdgeOnPlane(myclass;
theE : Edge from TopoDS;
theF : Face from TopoDS);
Make2D (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard);
---Purpose:
--- Make P-Curve <aC> for the edge <aE> on surface <aF> .
--- [aFirst, aLast] - range of the P-Curve
--- [aToler] - reached tolerance
---
MakeCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard);
---Purpose:
--- Same as Make2D()
---
MakePCurveOnFace (myclass;
aF: Face from TopoDS;
C3D : Curve from Geom;
aC : out Curve from Geom2d;
aToler: out Real from Standard) ;
---Purpose:
--- Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
--- [aToler] - reached tolerance
---
MakePCurveOnFace (myclass;
aF: Face from TopoDS;
C3D : Curve from Geom;
aT1 : Real from Standard;
aT2 : Real from Standard;
aC : out Curve from Geom2d;
aToler: out Real from Standard) ;
---Purpose:
--- Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
--- [aT1, aT2] - range to build
--- [aToler] - reached tolerance
---
MakePCurveOfType (myclass;
PC : ProjectedCurve from ProjLib;
aC : out Curve from Geom2d);
---Purpose:
--- Make empty P-Curve <aC> of relevant to <PC> type
---
end AlgoTools2D;

View File

@@ -1,6 +1,5 @@
// Created on: 2001-04-02
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,8 +17,7 @@
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Tools2D.ixx>
#include <BOPTools_AlgoTools2D.ixx>
#include <Standard_NotImplemented.hxx>
#include <Precision.hxx>
@@ -43,7 +41,6 @@
#include <Geom_Surface.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <ProjLib_ProjectedCurve.hxx>
@@ -54,18 +51,53 @@
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <BRep_Builder.hxx>
#include <Geom_Surface.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPTools.hxx>
static
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E);
//=======================================================================
//function : BuildPCurveForEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
Standard_Real aTolPC, aTolFact, aTolEdge, aFirst, aLast;
Standard_Boolean aHasOld;
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, aC2D, aFirst, aLast, aTolEdge);
if (aHasOld) {
return;
}
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
aTolEdge=BRep_Tool::Tolerance(aE);
aTolFact=Max(aTolEdge, aTolPC);
aBB.UpdateEdge(aE, aC2D, aF, aTolFact);
return;
}
//=======================================================================
//function : EdgeTangent
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::EdgeTangent(const TopoDS_Edge& anEdge,
const Standard_Real aT,
gp_Vec& aTau)
Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent(const TopoDS_Edge& anEdge,
const Standard_Real aT,
gp_Vec& aTau)
{
Standard_Boolean isdgE;
Standard_Real first, last;
@@ -95,85 +127,21 @@ static
return Standard_True;
}
//=======================================================================
//function : FaceNormal
//purpose :
//=======================================================================
void BOPTools_Tools2D::FaceNormal (const TopoDS_Face& aF,
const Standard_Real U,
const Standard_Real V,
gp_Vec& aN)
{
gp_Pnt aPnt ;
gp_Vec aD1U, aD1V;
Handle(Geom_Surface) aSurface;
aSurface=BRep_Tool::Surface(aF);
aSurface->D1 (U, V, aPnt, aD1U, aD1V);
aN=aD1U.Crossed(aD1V);
aN.Normalize();
if (aF.Orientation() == TopAbs_REVERSED){
aN.Reverse();
}
return;
}
//=======================================================================
//function : RemovePCurveForEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::RemovePCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
Standard_Real aTol;
aTol=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2D, aF, aTol);
}
//=======================================================================
//function : BuildPCurveForEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
Standard_Real aTolPC, aTolFact, aTolEdge, aFirst, aLast;
Standard_Boolean aHasOld;
aHasOld=BOPTools_Tools2D::HasCurveOnSurface (aE, aF, aC2D, aFirst, aLast, aTolEdge);
if (aHasOld) {
return;
}
BOPTools_Tools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, Standard_True);
aTolEdge=BRep_Tool::Tolerance(aE);
aTolFact=Max(aTolEdge, aTolPC);
aBB.UpdateEdge(aE, aC2D, aF, aTolFact);
return;
}
//=======================================================================
//function : PointOnOnSurface
//purpose :
//=======================================================================
void BOPTools_Tools2D::PointOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aParameter,
Standard_Real& U,
Standard_Real& V)
void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aParameter,
Standard_Real& U,
Standard_Real& V)
{
gp_Pnt2d aP2D;
Handle(Geom2d_Curve) aC2D;
Standard_Real aToler, aFirst, aLast;
BOPTools_Tools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, Standard_True);
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler);
aC2D->D0(aParameter, aP2D);
U=aP2D.X();
V=aP2D.Y();
@@ -184,15 +152,14 @@ static
//function : CurveOnSurface
//purpose :
//=======================================================================
void BOPTools_Tools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aToler,
const Standard_Boolean trim3d)
void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aToler)
{
Standard_Real aFirst, aLast;
BOPTools_Tools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, trim3d);
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler);
return;
}
@@ -200,24 +167,23 @@ static
//function : CurveOnSurface
//purpose :
//=======================================================================
void BOPTools_Tools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler,
const Standard_Boolean trim3d)
void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
{
Standard_Boolean aHasOld;
Handle(Geom2d_Curve) C2D;
aHasOld=BOPTools_Tools2D::HasCurveOnSurface (aE, aF, C2D, aFirst, aLast, aToler);
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, C2D, aFirst, aLast, aToler);
if (aHasOld) {
aC2D=C2D;
return;
}
BOPTools_Tools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, trim3d);
BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
aC2D=C2D;
return;
}
@@ -226,12 +192,12 @@ static
//function : HasCurveOnSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
{
Standard_Boolean aHasOld;
@@ -250,9 +216,9 @@ static
//function : HasCurveOnSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Boolean aHasOld;
Handle(Geom2d_Curve) aC2D;
@@ -267,164 +233,32 @@ static
aHasOld=!aC2D.IsNull();
return aHasOld;
}
//=======================================================================
//function : MakeCurveOnSurface
//purpose :
//=======================================================================
void BOPTools_Tools2D::MakeCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler,
const Standard_Boolean trim3d)
{
BOPTools_Tools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler, trim3d);
}
//=======================================================================
//function : Make2D
//purpose :
//=======================================================================
void BOPTools_Tools2D::Make2D (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler,
const Standard_Boolean trim3d)
{
Standard_Boolean aLocIdentity;
Standard_Real f3d, l3d;
TopLoc_Location aLoc;
Handle(Geom2d_Curve) C2D;
C2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
if (!C2D.IsNull()) {
aC2D=C2D;
return;
}
Handle(Geom_Curve) C3D3, C3D2, C3D;
C3D = BRep_Tool::Curve(aE, aLoc, f3d, l3d);
//
if (C3D.IsNull()) {
// aE has no 3D curve, so nothing is done
}
//
aLocIdentity=aLoc.IsIdentity();
if (aLocIdentity) {
C3D2 = C3D;
}
else {
C3D2 = Handle(Geom_Curve)::
DownCast(C3D->Transformed(aLoc.Transformation()));
}
if (trim3d) {
C3D3=C3D2;
}
else {
C3D3=C3D2;
}
//
aToler=.5*BRep_Tool::Tolerance(aE);
BOPTools_Tools2D::MakePCurveOnFace(aF, C3D3, f3d, l3d, aC2D, aToler);
//
aFirst = f3d;
aLast = l3d;
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
Handle(Geom2d_Curve)& aC2D, //->
Standard_Real& TolReached2d)
{
Standard_Real aFirst, aLast;
aFirst = aC3D -> FirstParameter();
aLast = aC3D -> LastParameter();
//
TolReached2d=0.;
//
BOPTools_Tools2D::MakePCurveOnFace (aF, aC3D, aFirst, aLast, aC2D, TolReached2d);
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Standard_Real aFirst,
const Standard_Real aLast,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& TolReached2d)
{
Standard_Real aTolR;
Handle(Geom2d_Curve) aC2DA;
BRepAdaptor_Surface aBAS(aF, Standard_False);
Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(aBAS);
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aFirst, aLast);
ProjLib_ProjectedCurve aProjCurv(aBAHS, aBAHC);// 1
BOPTools_Tools2D::MakePCurveOfType(aProjCurv, aC2D);
aTolR=aProjCurv.GetTolerance();
//
if (aC2D.IsNull()) {
ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, TolReached2d);// 2
BOPTools_Tools2D::MakePCurveOfType(aProjCurvAgain, aC2D);
aTolR = aProjCurvAgain.GetTolerance();
//
if (aC2D.IsNull()) {
Standard_Real aTR=0.0001;
ProjLib_ProjectedCurve aProj3(aBAHS, aBAHC, aTR);// 3
BOPTools_Tools2D::MakePCurveOfType(aProj3, aC2D);
aTolR = aProj3.GetTolerance();
}
}
TolReached2d=aTolR;
BOPTools_Tools2D::AdjustPCurveOnFace (aF, aFirst, aLast, aC2D, aC2DA);
aC2D=aC2DA;
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::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& aF,
const Handle(Geom_Curve)& aC3D,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
{
Standard_Real first, last;
first = aC3D -> FirstParameter();
last = aC3D -> LastParameter();
BOPTools_Tools2D::AdjustPCurveOnFace (aF, first, last, aC2D, aC2DA);
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, first, last, aC2D, aC2DA);
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_Tools2D::AdjustPCurveOnFace (const TopoDS_Face& aF,
const Standard_Real aFirst,
const Standard_Real aLast,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& aF,
const Standard_Real aFirst,
const Standard_Real aLast,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
{
Standard_Boolean mincond, maxcond, decalu, decalv;
Standard_Integer k, iCnt;
@@ -453,30 +287,29 @@ static
decalu = mincond || maxcond;
if (decalu) {
//du = ( mincond ) ? UPeriod : -UPeriod;
//
iCnt=1;
aUP2=aUPeriod+aUPeriod+aDelta;
aUP1=aUPeriod+aDelta;
//
if (u2 > aUP2) {
for(k=1; 1; ++k) {
aUx=u2-k*aUPeriod;
if (aUx < aUP1) {
iCnt=k;
break;
}
}
for(k=1; 1; ++k) {
aUx=u2-k*aUPeriod;
if (aUx < aUP1) {
iCnt=k;
break;
}
}
}
else if (u2 < -aUP2) {
for(k=1; 1; ++k) {
aUx=u2+k*aUPeriod;
if (aUx > -aUP1) {
//modified by NIZNHY-PKV Thu Apr 12 08:12:09 2012f
iCnt=k+1;
//iCnt=k;
//modified by NIZNHY-PKV Thu Apr 12 08:12:11 2012t
break;
}
}
for(k=1; 1; ++k) {
aUx=u2+k*aUPeriod;
if (aUx > -aUP1) {
iCnt=k+1;
break;
}
}
}
du = ( mincond ) ? aUPeriod : -aUPeriod;
du=iCnt*du;
@@ -484,15 +317,15 @@ static
//
aUNew=u2+du;
if (aUNew<(UMin-aDelta) ||
aUNew>(UMax+aDelta)) {
aUNew>(UMax+aDelta)) {
// So previous correction was wrong.
// Try to be closer to UMin or UMax.
du=0.;
if (u2>UMax){
aDif=u2-UMax;
if (aDif < 4.e-7) {
du=-aDif;
}
aDif=u2-UMax;
if (aDif < 4.e-7) {
du=-aDif;
}
}
}
} // if (BAHS->IsUPeriodic())
@@ -518,7 +351,7 @@ static
dVm=fabs(aVm-aVmid);
dVr=fabs(aVr-aVmid);
if (dVm<dVr) {
dv=0.;
dv=0.;
}
}
//xt
@@ -537,13 +370,192 @@ static
aC2DA=aC2Dx;
}
//=======================================================================
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint (const Standard_Real aFirst,
const Standard_Real aLast)
{
//define parameter division number as 10*e^(-PI) = 0.43213918
const Standard_Real PAR_T = 0.43213918;
Standard_Real aParm;
aParm=(1.-PAR_T)*aFirst + PAR_T*aLast;
return aParm;
}
//=======================================================================
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint (const TopoDS_Edge& aE)
{
Standard_Real aT, aT1, aT2;
Handle(Geom_Curve)aC1=BRep_Tool::Curve(aE, aT1, aT2);
if (aC1.IsNull())
BRep_Tool::Range(aE, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
return aT;
}
//=======================================================================
//function : BuildPCurveForEdgeOnPlane
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Real aTolE;
TopLoc_Location aLoc;
Handle(Geom2d_Curve) aC2D;
Handle(Geom_Plane) aGP;
Handle(Geom_RectangularTrimmedSurface) aGRTS;
BRep_Builder aBB;
//
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(aF, aLoc);
aGRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
if(!aGRTS.IsNull()){
aGP=Handle(Geom_Plane)::DownCast(aGRTS->BasisSurface());
}
else {
aGP=Handle(Geom_Plane)::DownCast(aS);
}
//
if (aGP.IsNull()) {
return;
}
//
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE);
aBB.UpdateEdge(aE, aC2D, aF, aTolE);
//
return;
}
//=======================================================================
//function : Make2D
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
{
Standard_Boolean aLocIdentity;
Standard_Real f3d, l3d;
TopLoc_Location aLoc;
Handle(Geom2d_Curve) C2D;
C2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
if (!C2D.IsNull()) {
aC2D=C2D;
return;
}
Handle(Geom_Curve) C3D2, C3D;
C3D = BRep_Tool::Curve(aE, aLoc, f3d, l3d);
//
if (C3D.IsNull()) {
// aE has no 3D curve, so nothing is done
}
//
aLocIdentity=aLoc.IsIdentity();
if (aLocIdentity) {
C3D2 = C3D;
}
else {
C3D2 = Handle(Geom_Curve)::
DownCast(C3D->Transformed(aLoc.Transformation()));
}
//
aToler=.5*BRep_Tool::Tolerance(aE);
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
//
aFirst = f3d;
aLast = l3d;
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
Handle(Geom2d_Curve)& aC2D, //->
Standard_Real& TolReached2d)
{
Standard_Real aFirst, aLast;
aFirst = aC3D -> FirstParameter();
aLast = aC3D -> LastParameter();
//
TolReached2d=0.;
//
BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst, aLast, aC2D, TolReached2d);
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Standard_Real aFirst,
const Standard_Real aLast,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& TolReached2d)
{
Standard_Real aTolR;
Handle(Geom2d_Curve) aC2DA;
BRepAdaptor_Surface aBAS(aF, Standard_False);
Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(aBAS);
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aFirst, aLast);
//when the type of surface is GeomAbs_SurfaceOfRevolution
if (aBAS.GetType() == GeomAbs_SurfaceOfRevolution) {
Standard_Real aTR = 1.e-7;
ProjLib_ProjectedCurve aProj1(aBAHS, aBAHC, aTR);
BOPTools_AlgoTools2D::MakePCurveOfType(aProj1, aC2D);
aTolR = aProj1.GetTolerance();
} else {
ProjLib_ProjectedCurve aProjCurv(aBAHS, aBAHC);// 1
BOPTools_AlgoTools2D::MakePCurveOfType(aProjCurv, aC2D);
aTolR=aProjCurv.GetTolerance();
}
//
if (aC2D.IsNull()) {
ProjLib_ProjectedCurve aProjCurvAgain(aBAHS, aBAHC, TolReached2d);// 2
BOPTools_AlgoTools2D::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);
aTolR = aProj3.GetTolerance();
}
}
TolReached2d=aTolR;
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aFirst, aLast, aC2D, aC2DA);
aC2D=aC2DA;
}
//=======================================================================
//function : MakePCurveOfType
//purpose :
//=======================================================================
void BOPTools_Tools2D::MakePCurveOfType(const ProjLib_ProjectedCurve& PC,
Handle(Geom2d_Curve)& C2D)
void BOPTools_AlgoTools2D::MakePCurveOfType(const ProjLib_ProjectedCurve& PC,
Handle(Geom2d_Curve)& C2D)
{
switch (PC.GetType()) {
@@ -569,18 +581,115 @@ static
case GeomAbs_BezierCurve :
case GeomAbs_OtherCurve :
default :
Standard_NotImplemented::Raise("BOPTools_Tools2D::MakePCurveOfType");
Standard_NotImplemented::Raise("BOPTools_AlgoTools2D::MakePCurveOfType");
break;
}
}
//=======================================================================
//function : CheckEdgeLength
//purpose :
//=======================================================================
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
{
BRepAdaptor_Curve BC(E);
BOPCol_IndexedMapOfShape aM;
BOPTools::MapShapes(E, TopAbs_VERTEX, aM);
Standard_Integer i, anExtent, aN=10;
Standard_Real ln=0., d, t, f, l, dt;
anExtent=aM.Extent();
if (anExtent!=1)
return Standard_True;
gp_Pnt p1, p2;
f = BC.FirstParameter();
l = BC.LastParameter();
dt=(l-f)/aN;
BC.D0(f, p1);
for (i=1; i<=aN; i++) {
t=f+i*dt;
if (i==aN)
BC.D0(l, p2);
else
BC.D0(t, p2);
d=p1.Distance(p2);
ln+=d;
p1=p2;
}
return (ln > Precision::Confusion());
}
/*
//=======================================================================
//function : FaceNormal
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::FaceNormal (const TopoDS_Face& aF,
const Standard_Real U,
const Standard_Real V,
gp_Vec& aN)
{
gp_Pnt aPnt ;
gp_Vec aD1U, aD1V;
Handle(Geom_Surface) aSurface;
aSurface=BRep_Tool::Surface(aF);
aSurface->D1 (U, V, aPnt, aD1U, aD1V);
aN=aD1U.Crossed(aD1V);
aN.Normalize();
if (aF.Orientation() == TopAbs_REVERSED){
aN.Reverse();
}
return;
}
//=======================================================================
//function : RemovePCurveForEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::RemovePCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
Standard_Real aTol;
aTol=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2D, aF, aTol);
}
//=======================================================================
//function : MakeCurveOnSurface
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakeCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
{
BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler);
}
//=======================================================================
//function : TangentOnEdge
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::TangentOnEdge(const Standard_Real par,
const TopoDS_Edge& E,
gp_Vec& Tg)
Standard_Boolean BOPTools_AlgoTools2D::TangentOnEdge(const Standard_Real par,
const TopoDS_Edge& E,
gp_Vec& Tg)
{
Standard_Boolean isdgE;
@@ -623,16 +732,16 @@ static
//function : TangentOnEdge
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::TangentOnEdge(const TopoDS_Edge& aE,
gp_Dir& DTg)
Standard_Boolean BOPTools_AlgoTools2D::TangentOnEdge(const TopoDS_Edge& aE,
gp_Dir& DTg)
{
Standard_Real aT;
gp_Vec aTg;
DTg.SetCoord(1.,0.,0.);
aT= BOPTools_Tools2D::IntermediatePoint (aE);
Standard_Boolean bIsFound=BOPTools_Tools2D::TangentOnEdge(aT, aE, aTg);
aT= BOPTools_AlgoTools2D::IntermediatePoint (aE);
Standard_Boolean bIsFound=BOPTools_AlgoTools2D::TangentOnEdge(aT, aE, aTg);
if (bIsFound) {
gp_Dir aDTmp(aTg);
DTg=aDTmp;
@@ -644,10 +753,10 @@ static
//function : TangentOnVertex
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools2D::TangentOnVertex (const TopoDS_Vertex& v,
const TopoDS_Vertex& vl,
const TopoDS_Edge& e,
gp_Vec& aVec)
Standard_Boolean BOPTools_AlgoTools2D::TangentOnVertex (const TopoDS_Vertex& v,
const TopoDS_Vertex& vl,
const TopoDS_Edge& e,
gp_Vec& aVec)
// tg oriented INSIDE 1d(e)
// vl : last vertex of e
{
@@ -656,7 +765,7 @@ static
gp_Vec tg;
par = BRep_Tool::Parameter(v, e);
ok =BOPTools_Tools2D::TangentOnEdge (par, e, tg);
ok =BOPTools_AlgoTools2D::TangentOnEdge (par, e, tg);
if (!ok) {
return ok;
}
@@ -672,80 +781,14 @@ static
//function : EdgeBounds
//purpose :
//=======================================================================
void BOPTools_Tools2D::EdgeBounds (const TopoDS_Edge& aE,
Standard_Real& aFirst,
Standard_Real& aLast)
void BOPTools_AlgoTools2D::EdgeBounds (const TopoDS_Edge& aE,
Standard_Real& aFirst,
Standard_Real& aLast)
{
BRepAdaptor_Curve aBC(aE);
aFirst= aBC.FirstParameter();
aLast = aBC.LastParameter();
}
//=======================================================================
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_Tools2D::IntermediatePoint (const Standard_Real aFirst,
const Standard_Real aLast)
{
//define parameter division number as 10*e^(-M_PI) = 0.43213918
const Standard_Real PAR_T = 0.43213918;
Standard_Real aParm;
aParm=(1.-PAR_T)*aFirst + PAR_T*aLast;
return aParm;
}
//=======================================================================
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_Tools2D::IntermediatePoint (const TopoDS_Edge& aE)
{
Standard_Real aT, aT1, aT2;
Handle(Geom_Curve)aC1=BRep_Tool::Curve(aE, aT1, aT2);
if (aC1.IsNull())
BRep_Tool::Range(aE, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
return aT;
}
//=======================================================================
//function : CheckEdgeLength
//purpose :
//=======================================================================
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
{
BRepAdaptor_Curve BC(E);
TopTools_IndexedMapOfShape aM;
TopExp::MapShapes(E, TopAbs_VERTEX, aM);
Standard_Integer i, anExtent, aN=10;
Standard_Real ln=0., d, t, f, l, dt;
anExtent=aM.Extent();
if (anExtent!=1)
return Standard_True;
gp_Pnt p1, p2;
f = BC.FirstParameter();
l = BC.LastParameter();
dt=(l-f)/aN;
BC.D0(f, p1);
for (i=1; i<=aN; i++) {
t=f+i*dt;
if (i==aN)
BC.D0(l, p2);
else
BC.D0(t, p2);
d=p1.Distance(p2);
ln+=d;
p1=p2;
}
return (ln > Precision::Confusion());
}
*/

View File

@@ -0,0 +1,197 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class AlgoTools3D from BOPTools
---Purpose:
-- The class contains handy static functions
-- dealing with the topology
-- This is the copy of BOPTools_AlgoTools3D.cdl file
uses
Pln from gp,
Dir from gp,
Pnt from gp,
Pnt2d from gp,
Surface from Geom,
Shape from TopoDS,
Wire from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Solid from TopoDS,
ShapeEnum from TopAbs,
Orientation from TopAbs,
State from TopAbs,
ListOfShape from BOPCol,
Context from BOPInt,
IndexedDataMapOfShapeListOfShape from BOPCol
is
DoSplitSEAMOnFace (myclass;
aSp: Edge from TopoDS;
aF : Face from TopoDS);
---Purpose:
-- Make the edge <aSp> seam edge for the face <aF>
--
GetNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aD:out Dir from gp);
---Purpose:
--- Computes normal to the face <aF> for the point on the edge <aE>
--- at parameter <aT>
---
GetNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aD:out Dir from gp);
---Purpose:
--- Computes normal to the face <aF> for the point on the edge <aE>
--- at arbitrary intermediate parameter
---
SenseFlag (myclass;
aNF1 : Dir from gp;
aNF2 : Dir from gp)
returns Integer from Standard;
---Purpose:
--- Returns 1 if scalar product aNF1* aNF2>0.
--- Returns 0 if directions aNF1 aNF2 coinside
--- Returns -1 if scalar product aNF1* aNF2<0.
---
GetNormalToSurface (myclass;
aS: Surface from Geom;
U : Real from Standard;
V : Real from Standard;
aD:out Dir from gp)
returns Boolean from Standard;
---Purpose:
--- Compute normal <aD> to surface <aS> in point (U,V)
--- Returns TRUE if directions aD1U, aD1V coinside
---
GetApproxNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aPx:out Pnt from gp;
aD:out Dir from gp;
theContext:out Context from BOPInt);
---Purpose:
--- 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:
--- 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)
---
GetApproxNormalToFaceOnEdge(myclass;
theE : Edge from TopoDS;
theF : Face from TopoDS;
aT : Real from Standard;
aP : out Pnt from gp;
aDNF : out Dir from gp;
aDt2D: Real from Standard);
PointNearEdge (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aT : Real from Standard;
aDt2D: Real from Standard;
aP2D :out Pnt2d from gp;
aPx :out Pnt from gp);
---Purpose:
--- 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>
---
PointNearEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp;
theContext:out Context from BOPInt);
---Purpose:
--- 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()
---
PointNearEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp;
theContext:out Context from BOPInt);
---Purpose:
--- 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()
---
MinStepIn2d(myclass)
returns Real from Standard;
---Purpose:
--- Returns simple step value that is used in 2D-computations
--- = 1.e-5
---
IsEmptyShape(myclass;
aS: Shape from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the shape <aS> does not contain
--- geometry information (e.g. empty compound)
---
OrientEdgeOnFace (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aER : out Edge from TopoDS);
---Purpose:
--- Get the edge <aER> from the face <aF> that is the same as
--- the edge <aE>
---
PointInFace(myclass;
theF:Face from TopoDS;
theP:out Pnt from gp;
theP2D:out Pnt2d from gp;
theContext:out Context from BOPInt)
returns Integer from Standard;
---Purpose: 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>
end AlgoTools3D;

View File

@@ -0,0 +1,779 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_AlgoTools3D.ixx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <gp_Cylinder.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
#include <BRep_PointRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_TFace.hxx>
#include <Poly_Triangulation.hxx>
#include <BRep_Builder.hxx>
#include <BOPInt_Context.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dHatch_Hatcher.hxx>
#include <HatchGen_Domain.hxx>
static void Add(const TopoDS_Shape& aS,
BOPCol_IndexedMapOfShape& myShapes,
Standard_Boolean& bHasGeometry);
static
Standard_Boolean HasGeometry(const TopoDS_Shape& aS);
//=======================================================================
//function : DoSplitSEAMOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
const TopoDS_Face& aF)
{
Standard_Boolean bIsUPeriodic, bIsLeft;
Standard_Real aTol, a, b, anUPeriod, aT, anU, dU=1.e-7, anU1;
Standard_Real aScPr;
gp_Pnt2d aP2D;
gp_Vec2d aVec2D;
Handle(Geom2d_Curve) aTmpC1, aTmpC2;
Handle(Geom2d_Curve) C2D1;
Handle(Geom2d_Line) aLD1;
Handle(Geom_Surface) aS;
BRep_Builder BB;
TopoDS_Edge aSp;
//
aSp=aSplit;
aSp.Orientation(TopAbs_FORWARD);
aTol=BRep_Tool::Tolerance(aSp);
aS=BRep_Tool::Surface(aF);
bIsUPeriodic=aS->IsUPeriodic();
anUPeriod=0.;
if (bIsUPeriodic) {
anUPeriod=aS->UPeriod();
}
else {
Standard_Boolean bIsUClosed;
Standard_Real aUmin, aUmax, aVmin, aVmax;
Handle(Geom_BSplineSurface) aBS;
Handle(Geom_BezierSurface) aBZ;
//
bIsUClosed=Standard_False;
aBS=Handle(Geom_BSplineSurface)::DownCast(aS);
aBZ=Handle(Geom_BezierSurface) ::DownCast(aS);
//
if (!aBS.IsNull()) {
bIsUClosed=aBS->IsUClosed();
aBS->Bounds(aUmin, aUmax, aVmin, aVmax);
}
else if (!aBZ.IsNull()) {
bIsUClosed=aBZ->IsUClosed();
aBZ->Bounds(aUmin, aUmax, aVmin, aVmax);
}
if (!bIsUClosed) {
return;
}
//
anUPeriod=aUmax-aUmin;
}
//
C2D1=BRep_Tool::CurveOnSurface(aSp, aF, a, b);
//
aT=BOPTools_AlgoTools2D::IntermediatePoint(a, b);
C2D1->D1(aT, aP2D, aVec2D);
gp_Dir2d aDir2D1(aVec2D);
//
gp_Dir2d aDOY(0.,1.);
aScPr=aDir2D1*aDOY;
//
//
anU=aP2D.X();
if (fabs (anU) < dU) {
bIsLeft=Standard_True;
anU1=anU+anUPeriod;
}
else if (fabs (anU-anUPeriod) < dU) {
bIsLeft=Standard_False;
anU1=anU-anUPeriod;
}
else {
return;
}
//
aTmpC1=Handle(Geom2d_Curve)::DownCast(C2D1->Copy());
Handle(Geom2d_TrimmedCurve) aC1 = new Geom2d_TrimmedCurve(aTmpC1, a, b);
aTmpC2=Handle(Geom2d_Curve)::DownCast(C2D1->Copy());
Handle(Geom2d_TrimmedCurve) aC2 = new Geom2d_TrimmedCurve(aTmpC2, a, b);
gp_Vec2d aTrV(anU1-anU, 0.);
aC2->Translate(aTrV);
//
if (!bIsLeft) {
if (aScPr<0.) {
BB.UpdateEdge(aSp, aC2, aC1, aF, aTol);
}
else {
BB.UpdateEdge(aSp, aC1, aC2, aF, aTol);
}
}
else {
if (aScPr<0.) {
BB.UpdateEdge(aSp, aC1, aC2, aF, aTol);
}
else {
BB.UpdateEdge(aSp, aC2, aC1, aF, aTol);
}
}
//
}
//=======================================================================
//function : GetNormalToFaceOnEdge
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
gp_Dir& aDNF)
{
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);
if (aF.Orientation()==TopAbs_REVERSED){
aDNF.Reverse();
}
}
//=======================================================================
//function : GetNormalToFaceOnEdge
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF1,
const Standard_Real aT,
gp_Dir& aDNF1)
{
Standard_Real U, V, aTolPC;
gp_Pnt2d aP2D;
gp_Pnt aP;
gp_Vec aD1U, aD1V;
Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
Handle(Geom2d_Curve)aC2D1;
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC);
aC2D1->D0(aT, aP2D);
U=aP2D.X();
V=aP2D.Y();
aS1->D1(U, V, aP, aD1U, aD1V);
gp_Dir aDD1U(aD1U);
gp_Dir aDD1V(aD1V);
aDNF1=aDD1U^aDD1V;
}
//=======================================================================
//function : SenseFlag
//purpose :
//=======================================================================
Standard_Integer BOPTools_AlgoTools3D::SenseFlag (const gp_Dir& aDNF1,
const gp_Dir& aDNF2)
{
Standard_Boolean bIsDirsCoinside;
bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNF1, aDNF2);
if (!bIsDirsCoinside) {
return 0;
}
Standard_Real aScPr;
aScPr=aDNF1*aDNF2;
if (aScPr<0.) {
return -1;
}
else if (aScPr>0.) {
return 1;
}
return -1;
}
//=======================================================================
//function : GetNormalToSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools3D::GetNormalToSurface (const Handle(Geom_Surface)& aS,
const Standard_Real U,
const Standard_Real V,
gp_Dir& aDNS)
{
Standard_Boolean bFlag;
gp_Pnt aP;
gp_Vec aD1U, aD1V;
aS->D1(U, V, aP, aD1U, aD1V);
gp_Dir aDD1U(aD1U);
gp_Dir aDD1V(aD1V);
bFlag=IntTools_Tools::IsDirsCoinside(aDD1U, aDD1U);
if (!bFlag) {
return bFlag;
}
aDNS=aDD1U^aDD1V;
return bFlag;
}
//=======================================================================
//function : GetApproxNormalToFaceOnEdge
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
gp_Pnt& aPNear,
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);
BOPTools_AlgoTools3D::GetNormalToSurface (aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
if (aF.Orientation()==TopAbs_REVERSED){
aDNF.Reverse();
}
}
//=======================================================================
//function : GetApproxNormalToFaceOnEdge
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
gp_Pnt& aPNear,
gp_Dir& aDNF,
Handle(BOPInt_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 (aE, aF, aT, aPx2DNear, aPNear, theContext);
Handle(Geom_Surface) aS=BRep_Tool::Surface(aF);
BOPTools_AlgoTools3D::GetNormalToSurface (aS, aPx2DNear.X(), aPx2DNear.Y(), aDNF);
if (aF.Orientation()==TopAbs_REVERSED){
aDNF.Reverse();
}
}
//=======================================================================
//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_Real aFirst, aLast, aETol, aFTol, transVal;
GeomAbs_SurfaceType aTS;
Handle(Geom2d_Curve) aC2D;
Handle(Geom_Surface) aS;
//
aC2D= BRep_Tool::CurveOnSurface (aE, aF, aFirst, aLast);
if (aC2D.IsNull()) {
aPx2DNear.SetCoord (99., 99);
return;
}
//
aS=BRep_Tool::Surface(aF);
//
gp_Pnt2d aPx2D;
gp_Vec2d aVx2D;
aC2D->D1 (aT, aPx2D, aVx2D);
gp_Dir2d aDx2D(aVx2D);
gp_Dir2d aDP;
aDP.SetCoord (-aDx2D.Y(), aDx2D.X());
if (aE.Orientation()==TopAbs_REVERSED){
aDP.Reverse();
}
if (aF.Orientation()==TopAbs_REVERSED) {
aDP.Reverse();
}
//
aETol = BRep_Tool::Tolerance(aE);
aFTol = BRep_Tool::Tolerance(aF);
// pkv NPAL19220
GeomAdaptor_Surface aGAS(aS);
aTS=aGAS.GetType();
if (aTS==GeomAbs_BSplineSurface) {
if (aETol > 1.e-5) {
aFTol=aETol;
}
}
if( aETol > 1.e-5 || aFTol > 1.e-5 ) {
//if( aETol > 1.e-5 && aFTol > 1.e-5 ) {
//pkv/103/D7
if(aTS!=GeomAbs_Sphere) {
gp_Vec2d transVec( aDP );
transVal = aDt2D + aETol + aFTol;
if (aTS==GeomAbs_Cylinder) {// pkv/909/F8
Standard_Real aR, dT;
//
gp_Cylinder aCyl=aGAS.Cylinder();
aR=aCyl.Radius();
dT=1.-transVal/aR;
if (dT>=-1 && dT<=1) {
dT=acos(dT);
transVal=dT;
}
}
//
transVec.Multiply(transVal);
aPx2DNear = aPx2D.Translated( transVec );
}
else {
aPx2DNear.SetCoord (aPx2D.X()+aDt2D*aDP.X(), aPx2D.Y()+aDt2D*aDP.Y());
}
}
else {
aPx2DNear.SetCoord (aPx2D.X()+aDt2D*aDP.X(), aPx2D.Y()+aDt2D*aDP.Y());
}
//
aS->D0(aPx2DNear.X(), aPx2DNear.Y(), aPxNear);
}
//=======================================================================
//function : PointNearEdge
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::PointNearEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
gp_Pnt2d& aPx2DNear,
gp_Pnt& aPxNear,
Handle(BOPInt_Context)& theContext)
{
Standard_Real dt2D=BOPTools_AlgoTools3D::MinStepIn2d();//~1.e-5;
Standard_Real aTolE, aTolF, dtx;
//
Handle(Geom_Surface) aS = BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aS);
if (aGAS.GetType()==GeomAbs_Cylinder ||
aGAS.GetType()==GeomAbs_Sphere) {
dt2D *= 100;
} else {
dt2D *= 10;
}
aTolE = BRep_Tool::Tolerance(aE);
aTolF = BRep_Tool::Tolerance(aF);
dtx = 2*(aTolE + aTolF);
dt2D = (dtx > dt2D) ? dtx : dt2D;
BOPTools_AlgoTools3D::PointNearEdge (aE, aF, aT, dt2D, aPx2DNear, aPxNear);
if (!theContext->IsPointInOnFace(aF, aPx2DNear)) {
gp_Pnt aP;
gp_Pnt2d aP2d;
Standard_Real u1, u2, v1, v2;
//
BRepTools::UVBounds(aF, u1, u2, v1, v2);
if ((u2-u1) < 1.e-4 || (v2-v1) < 1.e-4) {
Standard_Integer iErr = BOPTools_AlgoTools3D::PointInFace(aF, aP, aP2d, theContext);
if (!iErr) {
aPxNear = aP;
aPx2DNear = aP2d;
}
}
}
}
//=======================================================================
// function: PointNearEdge
// purpose:
//=======================================================================
void BOPTools_AlgoTools3D::PointNearEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
gp_Pnt2d& aPInFace2D,
gp_Pnt& aPInFace,
Handle(BOPInt_Context)& theContext)
{
Standard_Real aT, aT1, aT2;
//
// 1.
BRep_Tool::Range(aE, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
//
// 2. a Point inside Face near aPOnEdge aPInFace;
TopoDS_Face aFF=aF;
TopoDS_Edge aERight;
aFF.Orientation(TopAbs_FORWARD);
BOPTools_AlgoTools3D::OrientEdgeOnFace (aE, aFF, aERight);
BOPTools_AlgoTools3D::PointNearEdge (aERight, aFF, aT, aPInFace2D, aPInFace, theContext);
}
//=======================================================================
//function : MinStepIn2d
//purpose :
//=======================================================================
Standard_Real BOPTools_AlgoTools3D::MinStepIn2d()
{
Standard_Real dt=1.e-5;
return dt;
}
//=======================================================================
//function : IsEmptyShape
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools3D::IsEmptyShape(const TopoDS_Shape& aS)
{
Standard_Boolean bHasGeometry=Standard_False;
//
BOPCol_IndexedMapOfShape myShapes;
//
Add(aS, myShapes, bHasGeometry);
return !bHasGeometry;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void Add(const TopoDS_Shape& aS,
BOPCol_IndexedMapOfShape& myShapes,
Standard_Boolean& bHasGeometry)
{
Standard_Integer anIndex;
//
if (bHasGeometry) {
return;
}
//
if (aS.IsNull()) {
return;
}
//
TopoDS_Shape aSx = aS;
//
anIndex=myShapes.FindIndex(aSx);
if (!anIndex) {
bHasGeometry=HasGeometry (aSx);
if (bHasGeometry) {
return;
}
//
TopoDS_Iterator anIt(aSx, Standard_False, Standard_False);
for(; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aSy=anIt.Value();
Add(aSy, myShapes, bHasGeometry);
//
if (bHasGeometry) {
return;
}
//
myShapes.Add(aSx);
}
}
}
//=======================================================================
//function : HasGeometry
//purpose :
//=======================================================================
Standard_Boolean HasGeometry(const TopoDS_Shape& aS)
{
Standard_Boolean bHasGeometry=Standard_True;
TopAbs_ShapeEnum aType= aS.ShapeType();
if (aType == TopAbs_VERTEX) {
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(aS.TShape());
BRep_ListIteratorOfListOfPointRepresentation itrp(TV->Points());
while (itrp.More()) {
const Handle(BRep_PointRepresentation)& PR = itrp.Value();
if (PR->IsPointOnCurve()) {
return bHasGeometry;
}
else if (PR->IsPointOnCurveOnSurface()) {
return bHasGeometry;
}
else if (PR->IsPointOnSurface()) {
return bHasGeometry;
}
itrp.Next();
}
}
//
else if (aType == TopAbs_EDGE) {
Handle(BRep_TEdge) TE = Handle(BRep_TEdge)::DownCast(aS.TShape());
BRep_ListIteratorOfListOfCurveRepresentation itrc(TE->Curves());
while (itrc.More()) {
const Handle(BRep_CurveRepresentation)& CR = itrc.Value();
if (CR->IsCurve3D()) {
if (!CR->Curve3D().IsNull()) {
return bHasGeometry;
}
}
else if (CR->IsCurveOnSurface()) {
return bHasGeometry;
}
else if (CR->IsRegularity()) {
return bHasGeometry;
}
else if (!CR->Polygon3D().IsNull()) {
return bHasGeometry;
}
else if (CR->IsPolygonOnTriangulation()) {
return bHasGeometry;
}
else if (CR->IsPolygonOnSurface()) {
return bHasGeometry;
}
itrc.Next();
}
}
//
else if (aType == TopAbs_FACE) {
Handle(BRep_TFace) TF = Handle(BRep_TFace)::DownCast(aS.TShape());
if (!TF->Surface().IsNull()) {
return bHasGeometry;
}
Handle(Poly_Triangulation) Tr = TF->Triangulation();
if (!Tr.IsNull()) {
return bHasGeometry;
}
}
return !bHasGeometry;
}
//=======================================================================
//function : OrientEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::OrientEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
TopoDS_Edge& aERight)
{
if (BRep_Tool::IsClosed(aE, aF)) {
aERight=aE;
aERight.Orientation(aE.Orientation());
Standard_Integer iFoundCount = 0;
TopoDS_Edge anEdge = aE;
TopExp_Explorer anExp(aF, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aSS=anExp.Current();
if (aSS.IsSame(aE)) {
anEdge = TopoDS::Edge(aSS);
iFoundCount++;
}
}
if(iFoundCount == 1) {
aERight = anEdge;
}
return;
}
TopExp_Explorer anExp(aF, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aSS=anExp.Current();
if (aSS.IsSame(aE)) {
aERight=aE;
aERight.Orientation(aSS.Orientation());
return;
}
}
aERight=aE;
aERight.Orientation(aE.Orientation());
}
//=======================================================================
//function : PointInFace
//purpose :
//=======================================================================
Standard_Integer BOPTools_AlgoTools3D::PointInFace(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D,
Handle(BOPInt_Context)& theContext)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains, i;
Standard_Real aUMin, aUMax, aVMin, aVMax;
Standard_Real aVx, aUx, aV1, aV2, aEpsT;
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;
//
Geom2dHatch_Hatcher& aHatcher = theContext->Hatcher(aF);
//
iErr=0;
aEpsT=1.e-12;
//
aFF=aF;
aFF.Orientation (TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFF);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
aP2D.SetCoord(aUx, 0.);
aL2D=new Geom2d_Line (aP2D, aD2D);
Geom2dAdaptor_Curve aHCur(aL2D);
//
aIx=aHatcher.AddHatching(aHCur) ;
//
aHatcher.Trim();
bIsDone=aHatcher.TrimDone(aIx);
if (!bIsDone) {
iErr=1;
return iErr;
}
//
aHatcher.ComputeDomains(aIx);
bIsDone=aHatcher.IsDone(aIx);
if (!bIsDone) {
iErr=2;
return iErr;
}
//
aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) {
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
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);
//
break;
}
//
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);
theP=aPx;
//
return iErr;
}

View File

@@ -0,0 +1,750 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_AlgoTools.ixx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <TopLoc_Location.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <BRep_Tool.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_PointRepresentation.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom2dAdaptor.hxx>
#include <GeomProjLib.hxx>
#include <ProjLib_ProjectedCurve.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <gp_Pnt.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Adaptor3d_HCurveOnSurface.hxx>
//
#include <BRepAdaptor_Surface.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <gp_Pnt2d.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
static
void CheckEdge (const TopoDS_Edge& E,
const Standard_Real aMaxTol);
static
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
const Standard_Real aMaxTol);
static
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_Curve& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter,
Standard_Real& aNewTolerance);
static
void CorrectVertexTolerance(const TopoDS_Edge& aE);
static
void CorrectWires(const TopoDS_Face& aF);
static
void UpdateEdges(const TopoDS_Face& aF);
static
void UpdateVertices(const TopoDS_Edge& aE);
//=======================================================================
// Function : CorrectTolerances
// purpose :
//=======================================================================
void BOPTools_AlgoTools::CorrectTolerances(const TopoDS_Shape& aShape,
const Standard_Real aMaxTol)
{
BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol);
BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol);
}
//=======================================================================
// Function : CorrectPointOnCurve
// purpose :
//=======================================================================
void BOPTools_AlgoTools::CorrectPointOnCurve(const TopoDS_Shape& S,
const Standard_Real aMaxTol)
{
Standard_Integer i, aNb;
TopTools_IndexedMapOfShape Edges;
TopExp::MapShapes (S, TopAbs_EDGE, Edges);
aNb=Edges.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
CheckEdge(E, aMaxTol);
}
}
//=======================================================================
// Function : CorrectCurveOnSurface
// purpose :
//=======================================================================
void BOPTools_AlgoTools::CorrectCurveOnSurface(const TopoDS_Shape& S,
const Standard_Real aMaxTol)
{
Standard_Integer i, aNbFaces, j, aNbEdges;
TopTools_IndexedMapOfShape Faces;
TopExp::MapShapes (S, TopAbs_FACE, Faces);
aNbFaces=Faces.Extent();
for (i=1; i<=aNbFaces; i++) {
const TopoDS_Face& F= TopoDS::Face(Faces(i));
//
CorrectWires(F);
//
TopTools_IndexedMapOfShape Edges;
TopExp::MapShapes (F, TopAbs_EDGE, Edges);
aNbEdges=Edges.Extent();
for (j=1; j<=aNbEdges; j++) {
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
CorrectEdgeTolerance (E, F, aMaxTol);
}
}
}
//=======================================================================
// Function : CorrectWires
// purpose :
//=======================================================================
void CorrectWires(const TopoDS_Face& aFx)
{
GeomAbs_SurfaceType aType;
//
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aFx);
//BRepAdaptor_Surface aBAS (aFx, Standard_False);
GeomAdaptor_Surface aGAS (aS);
aType=aGAS.GetType();
if (aType!=GeomAbs_Cylinder) {
return;
}
//
Standard_Integer i, aNbV;
Standard_Real aTol, aTol2, aD2, aD2max, aT1, aT2, aT;
TopoDS_Edge aE1, aE2, aEi, aEj;
gp_Pnt aP, aPV;
gp_Pnt2d aP2D;
TopoDS_Face aF;
BRep_Builder aBB;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListIteratorOfListOfShape aIt;
//
aF=aFx;
aF.Orientation(TopAbs_FORWARD);
//
TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
aNbV=aMVE.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Vertex& aV=TopoDS::Vertex(aMVE.FindKey(i));
aPV=BRep_Tool::Pnt(aV);
aTol=BRep_Tool::Tolerance(aV);
aTol2=aTol*aTol;
//
aD2max=-1.;
const TopTools_ListOfShape& aLE=aMVE.FindFromIndex(i);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aIt.Value());
aT=BRep_Tool::Parameter(aV, aE);
const Handle(Geom2d_Curve)& aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
aC2D->D0(aT, aP2D);
//aP=aBAS.Value(aP2D.X(), aP2D.Y());
aS->D0(aP2D.X(), aP2D.Y(), aP);
aD2=aPV.SquareDistance(aP);
if (aD2>aD2max) {
aD2max=aD2;
}
}
if (aD2max>aTol2) {
aTol=sqrt(aD2max);
aBB.UpdateVertex(aV, aTol);
}
}
}
//=======================================================================
// Function : CorrectEdgeTolerance
// purpose : Correct tolerances for Edge
//=======================================================================
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
const Standard_Real aMaxTol)
{
//
// 1. Minimum of conditions to Perform
Handle (BRep_CurveRepresentation) myCref;
Handle (Adaptor3d_HCurve) myHCurve;
myCref.Nullify();
Handle(BRep_TEdge)& TEx = *((Handle(BRep_TEdge)*)&myShape.TShape());
BRep_ListIteratorOfListOfCurveRepresentation itcrx(TEx->Curves());
Standard_Boolean Degenerated, SameParameterx, SameRangex;
Standard_Integer unique = 0;
Degenerated = TEx->Degenerated();
SameParameterx = TEx->SameParameter();
SameRangex = TEx->SameRange();
if (!SameRangex && SameParameterx) {
return;
}
Handle(Geom_Curve) C3d;
while (itcrx.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
if (cr->IsCurve3D()) {
unique++;
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
myCref = cr;
}
}
itcrx.Next();
}
if (unique==0) {
return;//...No3DCurve
}
if (unique>1) {
return;//...Multiple3DCurve;
}
if (myCref.IsNull() && !Degenerated) {
itcrx.Initialize(TEx->Curves());
while (itcrx.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
if (cr->IsCurveOnSurface()) {
myCref = cr;
break;
}
itcrx.Next();
}
}
else if (!myCref.IsNull() && Degenerated){
return ;//...InvalidDegeneratedFlag;
}
if (!myCref.IsNull()) {
const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref);
Standard_Real First,Last;
GCref->Range(First,Last);
if (Last<=First) {
myCref.Nullify();
return ;//InvalidRange;
}
else {
if (myCref->IsCurve3D()) {
Handle(Geom_Curve) C3dx = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed (myCref->Location().Transformation()));
GeomAdaptor_Curve GAC3d(C3dx, First, Last);
myHCurve = new GeomAdaptor_HCurve(GAC3d);
}
else { // curve on surface
Handle(Geom_Surface) Sref = myCref->Surface();
Sref = Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
Handle(GeomAdaptor_HSurface) GAHSref = new GeomAdaptor_HSurface(Sref);
Handle(Geom2dAdaptor_HCurve) GHPCref = new Geom2dAdaptor_HCurve(PCref, First, Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
myHCurve = new Adaptor3d_HCurveOnSurface(ACSref);
}
}
}
//===============================================
// 2. Tolerances in InContext
{
if (myCref.IsNull())
return;
Standard_Boolean ok=Standard_True;;
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&myShape.TShape());
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
Standard_Real aNewTol=Tol;
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
//Standard_Real Delta =1.e-14;
Standard_Real Delta =1.e-12;
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
const TopLoc_Location& Floc = S.Location();
const TopLoc_Location& TFloc = TF->Location();
const Handle(Geom_Surface)& Su = TF->Surface();
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
// Standard_Boolean checkclosed = Standard_False;
Standard_Boolean pcurvefound = Standard_False;
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
pcurvefound = Standard_True;
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
Standard_Real f,l;
GC->Range(f,l);
if (SameRange && (f != First || l != Last)) {
return ;//BRepCheck_InvalidSameRangeFlag);
if (SameParameter) {
return; //BRepCheck_InvalidSameParameterFlag);
}
}
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast (Su->Transformed(L.Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
if (ok) {
if (cr->IsCurveOnClosedSurface()) {
//return ;// BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
}
else {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
if (SameParameter) {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
//
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
//
CorrectVertexTolerance(myShape);
}
}
if (cr->IsCurveOnClosedSurface()) {
//checkclosed = Standard_True;
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
ACS.Load(GAHS); // sans doute inutile
ACS.Load(GHPC); // meme remarque...
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
if (ok) {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
if (SameParameter) {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
CorrectVertexTolerance(myShape);
}
}
}
}
itcr.Next();
}
if (!pcurvefound) {
Handle(Geom_Plane) P;
Handle(Standard_Type) styp = Su->DynamicType();
if (styp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
P = Handle(Geom_Plane)::DownCast(Handle(Geom_RectangularTrimmedSurface)::
DownCast(Su)->BasisSurface());
}
else {
P = Handle(Geom_Plane)::DownCast(Su);
}
if (P.IsNull()) { // not a plane
return;//BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
}
else {// on fait la projection a la volee, comme BRep_Tool
P = Handle(Geom_Plane)::DownCast(P->Transformed(L.Transformation()));
//on projette Cref sur ce plan
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
GeomAdaptor_Curve& Gac = Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
Handle(Geom_Curve) C3dx = Gac.Curve();
Handle(Geom_Curve) ProjOnPlane = GeomProjLib::ProjectOnPlane
(new Geom_TrimmedCurve(C3dx,First,Last), P, P->Position().Direction(), Standard_True);
Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(ProjOnPlane);
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_HCurve) GHPC =
new Geom2dAdaptor_HCurve(PC, myHCurve->FirstParameter(), myHCurve->LastParameter());
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
Tol,Standard_True, aNewTol); // voir dub...
if (okx) {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
CorrectVertexTolerance(myShape);
}
}
}
}//end of if (!pcurvefound) {
} // end of 2. Tolerances in InContext
}
//=======================================================================
// Function : CorrectShapeTolerances
// purpose :
//=======================================================================
void BOPTools_AlgoTools::CorrectShapeTolerances(const TopoDS_Shape& aShape)
{
TopExp_Explorer aExp;
Standard_Integer aDim;
//
aDim=Dimension(aShape);
if (aDim == 1) {
aExp.Init(aShape, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
UpdateVertices(aE);
}
} else {
aExp.Init(aShape, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
UpdateEdges(aF);
}
}
}
//=======================================================================
//function : CorrectVertexTolerance
//purpose :
//=======================================================================
void CorrectVertexTolerance(const TopoDS_Edge& aE)
{
Standard_Integer k, aNbV;
Standard_Real aTolE, aTolV;
TopTools_IndexedMapOfShape aVMap;
aTolE=BRep_Tool::Tolerance(aE);
TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
aNbV=aVMap.Extent();
for (k=1; k<=aNbV; ++k) {
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
aTolV=BRep_Tool::Tolerance(aV);
if (aTolV<aTolE) {
Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
aTV->UpdateTolerance(aTolE);
}
}
}
#define NCONTROL 23
//=======================================================================
//function : Validate
//purpose :
//=======================================================================
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_Curve& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter,
Standard_Real& aNewTolerance)
{
Standard_Real First, Last, MaxDistance, aD, Tol2;
First = CRef.FirstParameter();
Last = CRef.LastParameter();
MaxDistance = 0.;
Tol2 = Tol*Tol;
Standard_Integer i, aNC1=NCONTROL-1;
Standard_Boolean aFlag=Standard_False;
Standard_Boolean proj = (!SameParameter ||
First != Other.FirstParameter() ||
Last != Other.LastParameter());
//
// 1.
if (!proj) {
for (i = 0; i < NCONTROL; i++) {
Standard_Real prm = ((aNC1-i)*First + i*Last)/aNC1;
gp_Pnt pref = CRef.Value(prm);
gp_Pnt pother = Other.Value(prm);
aD=pref.SquareDistance(pother);
if (aD > Tol2) {
if (aD>MaxDistance) {
MaxDistance=aD;
}
aFlag=Standard_True;
}
}
if (aFlag) {
aNewTolerance=sqrt(MaxDistance);
}
return aFlag;
}
//
// 2.
else {
Extrema_LocateExtPC refd,otherd;
Standard_Real OFirst, OLast;
OFirst = Other.FirstParameter();
OLast = Other.LastParameter();
gp_Pnt pd = CRef.Value(First);
gp_Pnt pdo = Other.Value(OFirst);
aD = pd.SquareDistance(pdo);
if (aD > Tol2) {
if (aD>MaxDistance) {
MaxDistance=aD;
}
aFlag=Standard_True;
}
pd = CRef.Value(Last);
pdo = Other.Value(OLast);
aD = pd.SquareDistance(pdo);
if (aD > Tol2 && aD > MaxDistance) {
MaxDistance=aD;
aFlag=Standard_True;
}
refd.Initialize(CRef, First, Last, CRef.Resolution(Tol));
otherd.Initialize(Other, OFirst, OLast, Other.Resolution(Tol));
for (i = 2; i< aNC1; i++) {
Standard_Real rprm = ((aNC1-i)*First + i*Last)/aNC1;
gp_Pnt pref = CRef.Value(rprm);
Standard_Real oprm = ((aNC1-i)*OFirst + i*OLast)/aNC1;
gp_Pnt pother = Other.Value(oprm);
refd.Perform(pother,rprm);
if (!refd.IsDone() || refd.SquareDistance() > Tol2) {
if (refd.IsDone()) {
aD=refd.SquareDistance();
if (aD > Tol2 && aD>MaxDistance) {
aFlag=Standard_True;
MaxDistance=aD;
}
}
}
otherd.Perform(pref,oprm);
if (!otherd.IsDone() || otherd.SquareDistance() > Tol2) {
if (otherd.IsDone()) {
aD=otherd.SquareDistance();
if (aD > Tol2 && aD>MaxDistance) {
aFlag=Standard_True;
MaxDistance=aD;
}
}
}
}
}
aD=sqrt (MaxDistance);
aNewTolerance=aD;
return aFlag;
}
//=======================================================================
// Function : CheckEdge
// purpose : Correct tolerances for Vertices on Edge
//=======================================================================
void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
{
TopoDS_Edge E=Ed;
E.Orientation(TopAbs_FORWARD);
gp_Pnt Controlp;
TopExp_Explorer aVExp;
aVExp.Init(E, TopAbs_VERTEX);
for (; aVExp.More(); aVExp.Next()) {
TopoDS_Vertex aVertex= TopoDS::Vertex(aVExp.Current());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &aVertex.TShape());
const gp_Pnt& prep = TV->Pnt();
Standard_Real Tol, aD2, aNewTolerance, dd;
Tol =BRep_Tool::Tolerance(aVertex);
Tol = Max(Tol, BRep_Tool::Tolerance(E));
dd=0.1*Tol;
Tol*=Tol;
const TopLoc_Location& Eloc = E.Location();
BRep_ListIteratorOfListOfPointRepresentation itpr;
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&E.TShape());
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
const TopLoc_Location& loc = cr->Location();
TopLoc_Location L = (Eloc * loc).Predivided(aVertex.Location());
if (cr->IsCurve3D()) {
const Handle(Geom_Curve)& C = cr->Curve3D();
if (!C.IsNull()) {
itpr.Initialize(TV->Points());
while (itpr.More()) {
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
if (pr->IsPointOnCurve(C,L)) {
Controlp = C->Value(pr->Parameter());
Controlp.Transform(L.Transformation());
aD2=prep.SquareDistance(Controlp);
if (aD2 > Tol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
TV->UpdateTolerance(aNewTolerance);
}
}
itpr.Next();
}
TopAbs_Orientation orv = aVertex.Orientation();
if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) {
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
if (orv==TopAbs_FORWARD)
Controlp = C->Value(GC->First());
else
Controlp = C->Value(GC->Last());
Controlp.Transform(L.Transformation());
aD2=prep.SquareDistance(Controlp);
if (aD2 > Tol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
TV->UpdateTolerance(aNewTolerance);
}
}
}
}
itcr.Next();
}
}
}
//=======================================================================
// Function : UpdateVertices
// purpose :
//=======================================================================
void UpdateVertices(const TopoDS_Edge& aE)
{
Standard_Real aTolE, aTolV;
TopoDS_Iterator aItE;
BRep_Builder aBB;
//
aTolE = BRep_Tool::Tolerance(aE);
aItE.Initialize(aE);
for (; aItE.More(); aItE.Next()) {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aItE.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
aBB.UpdateVertex(aV, aTolE);
}
}
}
//=======================================================================
// Function : UpdateEdges
// purpose :
//=======================================================================
void UpdateEdges(const TopoDS_Face& aF)
{
Standard_Real aTolF, aTolE, aTolV;
TopoDS_Iterator aItF, aItW, aItE;
BRep_Builder aBB;
//
aTolF = BRep_Tool::Tolerance(aF);
aItF.Initialize(aF);
for (; aItF.More(); aItF.Next()) {
const TopoDS_Shape& aS = aItF.Value();
if (aS.ShapeType()==TopAbs_WIRE) {
aItW.Initialize(aS);
for (; aItW.More(); aItW.Next()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aItW.Value();
aTolE = BRep_Tool::Tolerance(aE);
if (aTolE < aTolF) {
aBB.UpdateEdge(aE, aTolF);
aTolE = aTolF;
}
UpdateVertices(aE);
}
}
else {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aItF.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
aBB.UpdateVertex(aV, aTolF);
}
}
}
}

View File

@@ -1,6 +1,5 @@
// Created on: 2000-11-16
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,198 +17,34 @@
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Tools.ixx>
#include <Precision.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <BOPTools_AlgoTools.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Edge.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt2d.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <IntTools_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <GeomAbs_CurveType.hxx>
#include <BooleanOperations_OnceExplorer.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Iterator.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_Range.hxx>
static
void TreatCompound(const TopoDS_Shape& theC1,
BOPCol_ListOfShape& theLSX);
static
void CopySrc(const TopoDS_Shape& E,
TopTools_IndexedDataMapOfShapeShape& aMapSS,
TopoDS_Shape& anEdge);
//=======================================================================
// function: IsBlockInOnFace
// purpose:
//=======================================================================
Standard_Boolean BOPTools_Tools::IsBlockInOnFace (const BOPTools_PaveBlock& aPB1,
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag;
Standard_Real f1, l1, ULD, VLD;
gp_Pnt2d aP2D;
gp_Pnt aP11, aP12;
//
// Edge's data
const IntTools_ShrunkRange& aSR1=aPB1.ShrunkRange();
const TopoDS_Edge& aE1=aSR1.Edge();
const IntTools_Range& aShrR= aSR1.ShrunkRange();
aShrR.Range(f1, l1);
//
Standard_Real dt=0.0075, k;//dt=0.001, k;
k=dt*(l1-f1);
f1=f1+k;
l1=l1-k;
//
// Treatment P11
BOPTools_Tools::PointOnEdge(aE1, f1, aP11);
//
GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
aProjector.Perform(aP11);
//
bFlag=aProjector.IsDone();
if (!bFlag) {
return bFlag;
}
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
}
//
// Treatment P12
BOPTools_Tools::PointOnEdge(aE1, l1, aP12);
//
aProjector.Perform(aP12);
//
bFlag=aProjector.IsDone();
if (!bFlag) {
return bFlag;
}
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
}
//
// Treatment intemediate
Standard_Real m1, aTolF, aTolE, aTol, aDist;
m1=IntTools_Tools::IntermediatePoint(f1, l1);
BOPTools_Tools::PointOnEdge(aE1, m1, aP12);
//
aProjector.Perform(aP12);
//
bFlag=aProjector.IsDone();
if (!bFlag) {
return bFlag;
}
//
aTolE=BRep_Tool::Tolerance(aE1);
aTolF=BRep_Tool::Tolerance(aF);
aTol=aTolE+aTolF;
aDist=aProjector.LowerDistance();
if (aDist > aTol){
return Standard_False;
}
aProjector.LowerDistanceParameters(ULD, VLD);
aP2D.SetCoord(ULD, VLD);
//
bFlag=aContext->IsPointInOnFace (aF, aP2D);
//
if (!bFlag) {
return bFlag;
}
return bFlag;
}
//=======================================================================
// function: IsBlocksCoinside
// purpose:
//=======================================================================
Standard_Boolean BOPTools_Tools::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
const BOPTools_PaveBlock& aPB2)
{
//
Standard_Real f1, l1, aTol1;
const IntTools_ShrunkRange aSR1=aPB1.ShrunkRange();
const TopoDS_Edge& aE1=aSR1.Edge();
aTol1=BRep_Tool::Tolerance(aE1);
aPB1.Parameters(f1, l1);
gp_Pnt aP11, aP12;
BOPTools_Tools::PointOnEdge(aE1, f1, aP11);
BOPTools_Tools::PointOnEdge(aE1, l1, aP12);
//
Standard_Real f2, l2, aTol2;
const IntTools_ShrunkRange aSR2=aPB2.ShrunkRange();
const TopoDS_Edge& aE2=aSR2.Edge();
aTol2=BRep_Tool::Tolerance(aE2);
aPB2.Parameters(f2, l2);
gp_Pnt aP21, aP22;
BOPTools_Tools::PointOnEdge(aE2, f2, aP21);
BOPTools_Tools::PointOnEdge(aE2, l2, aP22);
////
Standard_Real aTolSum, d1121, d1122, d1222, d1221;
aTolSum=1.05*(aTol1+aTol2);
d1121=aP11.Distance(aP21);
if (d1121<aTolSum) {
d1222=aP12.Distance(aP22);
if (d1222<aTolSum) {
return Standard_True;
}
}
//
d1122=aP11.Distance(aP22);
if (d1122<aTolSum) {
d1221=aP12.Distance(aP21);
if (d1221<aTolSum) {
return Standard_True;
}
}
return Standard_False;
}
//
//=======================================================================
// function: UpdateVertex
// purpose:
//=======================================================================
void BOPTools_Tools::UpdateVertex (const TopoDS_Vertex& aVF,
const TopoDS_Vertex& aNewVertex)
void BOPTools_AlgoTools::UpdateVertex (const TopoDS_Vertex& aVF,
const TopoDS_Vertex& aNewVertex)
{
Standard_Real aTolVF, aTolNewVertex, aDist, aDTol=1.e-12, aNewTol;
//
@@ -226,14 +61,14 @@ static
BB.UpdateVertex (aVF, aNewTol+aDTol);
}
}
//
//=======================================================================
// function: UpdateVertex
// purpose:
//=======================================================================
void BOPTools_Tools::UpdateVertex (const TopoDS_Edge& aE,
const Standard_Real aT,
const TopoDS_Vertex& aV)
void BOPTools_AlgoTools::UpdateVertex (const TopoDS_Edge& aE,
const Standard_Real aT,
const TopoDS_Vertex& aV)
{
Standard_Real aTolV, aDist, aDTol=1.e-12, aFirst, aLast;
gp_Pnt aPc;
@@ -254,9 +89,9 @@ static
// function: UpdateVertex
// purpose:
//=======================================================================
void BOPTools_Tools::UpdateVertex (const IntTools_Curve& aC,
const Standard_Real aT,
const TopoDS_Vertex& aV)
void BOPTools_AlgoTools::UpdateVertex (const IntTools_Curve& aC,
const Standard_Real aT,
const TopoDS_Vertex& aV)
{
Standard_Real aTolV, aDist, aDTol=1.e-12;
gp_Pnt aPc;
@@ -276,12 +111,12 @@ static
// function: MakeSectEdge
// purpose:
//=======================================================================
void BOPTools_Tools::MakeSectEdge(const IntTools_Curve& aIC,
const TopoDS_Vertex& aV1,
const Standard_Real aP1,
const TopoDS_Vertex& aV2,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
void BOPTools_AlgoTools::MakeSectEdge(const IntTools_Curve& aIC,
const TopoDS_Vertex& aV1,
const Standard_Real aP1,
const TopoDS_Vertex& aV2,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
{
Handle(Geom_Curve) aC=aIC.Curve ();
@@ -301,12 +136,12 @@ static
// function: MakeSplitEdge
// purpose:
//=======================================================================
void BOPTools_Tools::MakeSplitEdge(const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1,
const Standard_Real aP1,
const TopoDS_Vertex& aV2,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1,
const Standard_Real aP1,
const TopoDS_Vertex& aV2,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
{
Standard_Real f, l, aTol;
Handle(Geom_Curve) aC=BRep_Tool::Curve (aE, f, l);
@@ -330,26 +165,26 @@ static
// function: MakeNewVertex
// purpose:
//=======================================================================
void BOPTools_Tools::MakeNewVertex(const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2,
TopoDS_Vertex& aNewVertex)
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2,
TopoDS_Vertex& aNewVertex)
{
gp_Pnt aPnt1=BRep_Tool::Pnt(aV1);
Standard_Real aTol1=BRep_Tool::Tolerance(aV1);
gp_Pnt aPnt2=BRep_Tool::Pnt(aV2);
Standard_Real aTol2=BRep_Tool::Tolerance(aV2);
Standard_Real aMaxTol, aDist;
aDist=aPnt1.Distance(aPnt2);
aMaxTol=(aTol1>aTol2)? aTol1 : aTol2;
aMaxTol=aMaxTol+0.5*aDist;
const gp_XYZ& aXYZ1=aPnt1.XYZ();
const gp_XYZ& aXYZ2=aPnt2.XYZ();
gp_XYZ aNewXYZ=0.5*(aXYZ1+aXYZ2);
gp_Pnt aNewPnt(aNewXYZ);
BRep_Builder aBB;
aBB.MakeVertex (aNewVertex, aNewPnt, aMaxTol);
@@ -358,9 +193,9 @@ static
// function: MakeNewVertex
// purpose:
//=======================================================================
void BOPTools_Tools::MakeNewVertex(const gp_Pnt& aP,
const Standard_Real aTol,
TopoDS_Vertex& aNewVertex)
void BOPTools_AlgoTools::MakeNewVertex(const gp_Pnt& aP,
const Standard_Real aTol,
TopoDS_Vertex& aNewVertex)
{
BRep_Builder aBB;
aBB.MakeVertex (aNewVertex, aP, aTol);
@@ -370,11 +205,11 @@ static
// function: MakeNewVertex
// purpose:
//=======================================================================
void BOPTools_Tools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1,
const TopoDS_Edge& aE2,
const Standard_Real aParm2,
TopoDS_Vertex& aNewVertex)
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1,
const TopoDS_Edge& aE2,
const Standard_Real aParm2,
TopoDS_Vertex& aNewVertex)
{
Standard_Real aTol1, aTol2, aMaxTol, aDist;
gp_Pnt aPnt1, aPnt2;
@@ -392,7 +227,7 @@ static
const gp_XYZ& aXYZ1=aPnt1.XYZ();
const gp_XYZ& aXYZ2=aPnt2.XYZ();
gp_XYZ aNewXYZ=0.5*(aXYZ1+aXYZ2);
gp_Pnt aNewPnt(aNewXYZ);
BRep_Builder aBB;
aBB.MakeVertex (aNewVertex, aNewPnt, aMaxTol);
@@ -401,10 +236,10 @@ static
// function: MakeNewVertex
// purpose:
//=======================================================================
void BOPTools_Tools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1,
const TopoDS_Face& aF1,
TopoDS_Vertex& aNewVertex)
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1,
const TopoDS_Face& aF1,
TopoDS_Vertex& aNewVertex)
{
Standard_Real aTol1, aTol2, aMaxTol, delta=1.e-12;
gp_Pnt aPnt;
@@ -425,50 +260,23 @@ static
// function: PointOnEdge
// purpose:
//=======================================================================
void BOPTools_Tools::PointOnEdge(const TopoDS_Edge& aE,
const Standard_Real aParm,
gp_Pnt& aPnt)
void BOPTools_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
const Standard_Real aParm,
gp_Pnt& aPnt)
{
Standard_Real f, l;
Handle(Geom_Curve) C1=BRep_Tool::Curve(aE, f, l);
C1->D0(aParm, aPnt);
}
//=======================================================================
//function : CopySource
//purpose :
//=======================================================================
void BOPTools_Tools::CopySource(const TopoDS_Shape& aSS,
TopoDS_Shape& aSD)
{
TopTools_IndexedDataMapOfShapeShape aMapSS;
CopySrc (aSS, aMapSS, aSD);
}
//=======================================================================
//function : MapShapes
//purpose :
//=======================================================================
void BOPTools_Tools::MapShapes(const TopoDS_Shape& aS,
TopTools_IndexedMapOfShape& aM)
{
aM.Add(aS);
TopoDS_Iterator anIt;
anIt.Initialize(aS);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aSx=anIt.Value();
BOPTools_Tools::MapShapes(aSx, aM);
}
}
//=======================================================================
//function : CorrectRange
//purpose :
//=======================================================================
void BOPTools_Tools::CorrectRange(const TopoDS_Edge& aE1,
const TopoDS_Edge& aE2,
const IntTools_Range& aSR,
IntTools_Range& aNewSR)
void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE1,
const TopoDS_Edge& aE2,
const IntTools_Range& aSR,
IntTools_Range& aNewSR)
{
Standard_Integer i;
Standard_Real aRes, aTolE1, aTolE2, aTF, aTL, dT;
@@ -479,25 +287,16 @@ static
//
aNewSR=aSR;
//
//modified by NIZNHY-PKV Tue Feb 10 08:47:03 2009f
aBC.Initialize(aE1);
aCT=aBC.GetType();
if (aCT==GeomAbs_Line) {
return;
}
//modified by NIZNHY-PKV Tue Feb 10 08:47:06 2009t
//
dT=Precision::PConfusion();
aTF=aSR.First();
aTL=aSR.Last();
//
//modified by NIZNHY-PKV Tue Feb 10 08:47:39 2009f
/*
aBC.Initialize(aE1);
aCT=aBC.GetType();
*/
//modified by NIZNHY-PKV Tue Feb 10 08:47:43 2009t
//
aTolE1=BRep_Tool::Tolerance(aE1);
aTolE2=BRep_Tool::Tolerance(aE2);
//
@@ -505,23 +304,23 @@ static
aRes = 2.*(aTolE1 + aTolE2);
//
if (aCT==GeomAbs_BezierCurve ||
aCT==GeomAbs_BSplineCurve||
aCT==GeomAbs_OtherCurve) {
aCT==GeomAbs_BSplineCurve||
aCT==GeomAbs_OtherCurve) {
if(!i){
aBC.D1 (aTF, aP, aDer);
aBC.D1 (aTF, aP, aDer);
}
else {
aBC.D1 (aTL, aP, aDer);
aBC.D1 (aTL, aP, aDer);
}
//
Standard_Real aMgn = aDer.Magnitude();
if(aMgn > 1.e-12) {
aRes = aRes/aMgn ;
aRes = aRes/aMgn ;
}
else {
aRes = aBC.Resolution(aRes);
aRes = aBC.Resolution(aRes);
}
} // if (aCT==GeomAbs_BezierCurve||...
else {
@@ -541,15 +340,15 @@ static
//aNewSR=((aNewSR.Last()-aNewSR.First()) < dT) ? aSR : aNewSR;
}
}
//=======================================================================
//function : CorrectRange
//purpose :
//=======================================================================
void BOPTools_Tools::CorrectRange(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const IntTools_Range& aSR,
IntTools_Range& aNewSR)
void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const IntTools_Range& aSR,
IntTools_Range& aNewSR)
{
Standard_Integer i;
Standard_Real aRes, aTolF, aTF, aTL, dT;
@@ -573,23 +372,23 @@ static
aRes =aTolF;
if (aCT==GeomAbs_BezierCurve ||
aCT==GeomAbs_BSplineCurve||
aCT==GeomAbs_OtherCurve) {
aCT==GeomAbs_BSplineCurve||
aCT==GeomAbs_OtherCurve) {
if(!i){
aBC.D1 (aTF, aP, aDer);
aBC.D1 (aTF, aP, aDer);
}
else {
aBC.D1 (aTL, aP, aDer);
aBC.D1 (aTL, aP, aDer);
}
//
Standard_Real aMgn = aDer.Magnitude();
if(aMgn > 1.e-12) {
aRes = aRes/aMgn ;
aRes = aRes/aMgn ;
}
else {
aRes = aBC.Resolution(aRes);
aRes = aBC.Resolution(aRes);
}
} // if (aCT==GeomAbs_BezierCurve||...
else {
@@ -608,50 +407,103 @@ static
}
}
}
//=======================================================================
//function : CopySrc
//function : Dimension
//purpose :
//=======================================================================
void CopySrc(const TopoDS_Shape& E,
TopTools_IndexedDataMapOfShapeShape& aMapSS,
TopoDS_Shape& anEdge)
Standard_Integer BOPTools_AlgoTools::Dimension(const TopoDS_Shape& theS)
{
BRep_Builder BB;
TopAbs_ShapeEnum aTT;
Standard_Integer aR;
aTT=E.ShapeType();
if (aMapSS.Contains(E)) {
anEdge=aMapSS.ChangeFromKey(E);
if (aTT==TopAbs_EDGE)
return;
Standard_Integer i, iRet, iRx0, iRx;
TopAbs_ShapeEnum aTS;
BOPCol_ListOfShape aLS;
BOPCol_ListIteratorOfListOfShape aIt;
//
aTS=theS.ShapeType();
if (aTS!=TopAbs_COMPOUND) {
switch (aTS) {
case TopAbs_EDGE:
case TopAbs_WIRE:
iRet=1;
break;
case TopAbs_FACE:
case TopAbs_SHELL:
iRet=2;
break;
case TopAbs_SOLID:
case TopAbs_COMPSOLID:
iRet=3;
break;
default:
iRet=0;
}
return iRet;
}
else {
anEdge=E.EmptyCopied();
aMapSS.Add(E, anEdge);
//
iRet=-1;
TreatCompound(theS, aLS);
if(aLS.IsEmpty()) {
iRet = -2; //empty compound
return iRet;
}
aR=(Standard_Integer)aTT+1;
if (aR>TopAbs_VERTEX) {
return;
aIt.Initialize(aLS);
for (i=0; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
iRx=Dimension(aSx);
if (!i) {
iRx0=iRx;
i=1;
continue;
}
if (iRx!=iRx0) {
return iRet;// -1
}
}
Standard_Boolean free = anEdge.Free();
anEdge.Free(Standard_True);
aTT=(TopAbs_ShapeEnum) aR;
TopExp_Explorer anExpVertices(E, aTT);
for (; anExpVertices.More(); anExpVertices.Next()) {
const TopoDS_Shape& V=anExpVertices.Current();
TopoDS_Shape aVertex;
CopySrc (V, aMapSS, aVertex);
aVertex.Orientation(V.Orientation());
BB.Add(anEdge, aVertex);
}
anEdge.Free(free);
return iRx;
}
//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
void TreatCompound(const TopoDS_Shape& theC1,
BOPCol_ListOfShape& theLSX)
{
Standard_Integer aNbC1;
TopAbs_ShapeEnum aType;
BOPCol_ListOfShape aLC, aLC1;
BOPCol_ListIteratorOfListOfShape aIt, aIt1;
TopoDS_Iterator aItC;
//
aLC.Append (theC1);
while(1) {
aLC1.Clear();
aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aC=aIt.Value(); //C is compound
//
aItC.Initialize(aC);
for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aS=aItC.Value();
aType=aS.ShapeType();
if (aType==TopAbs_COMPOUND) {
aLC1.Append(aS);
}
else {
theLSX.Append(aS);
}
}
}
//
aNbC1=aLC1.Extent();
if (!aNbC1) {
break;
}
//
aLC.Clear();
aIt.Initialize(aLC1);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSC=aIt.Value();
aLC.Append(aSC);
}
}// while(1)
}

View File

@@ -1,66 +0,0 @@
-- Created on: 2004-09-02
-- Created by: Oleg FEDYAEV
-- Copyright (c) 2004-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class CheckResult from BOPTools
---Purpose: contains information about faulty shapes
-- and faulty types
uses
Shape from TopoDS,
ListOfShape from TopTools,
CheckStatus from BOPTools,
Geometry from Geom
is
Create
returns CheckResult;
---Purpose: empty constructor
AddShape(me: in out; TheShape: Shape from TopoDS);
---Purpose: adds a shape with faulty to a list
GetShapes(me)
returns ListOfShape from TopTools;
---C++: return const &
---Purpose: gets access to faulty shapes in a list const
SetCheckStatus(me:in out; TheStatus: CheckStatus from BOPTools);
---Purpose: sets faulty status for shapes
GetCheckStatus(me)
returns CheckStatus from BOPTools;
---Purpose: gets faulty status for shapes
SetInterferenceGeometry(me: in out; TheGeometry: Geometry from Geom);
---Purpose: sets an attached geometry to faulty shapes if any
GetInterferenceGeometry(me)
returns Geometry from Geom;
---C++: return const &
---Purpose: gets an attached geometry to shapes if any
fields
myStatus : CheckStatus from BOPTools;
myShapes : ListOfShape from TopTools;
myGeometry : Geometry from Geom;
end CheckResult;

View File

@@ -1,90 +0,0 @@
// Created on: 2004-09-02
// Created by: Oleg FEDYAEV
// Copyright (c) 2004-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_CheckResult.ixx>
//=======================================================================
//function : BOPTools_CheckResult()
//purpose :
//=======================================================================
BOPTools_CheckResult::BOPTools_CheckResult() : myStatus(BOPTools_CHKUNKNOWN), myGeometry(0)
{
}
//=======================================================================
//function : AddShape()
//purpose :
//=======================================================================
void BOPTools_CheckResult::AddShape(const TopoDS_Shape & TheShape)
{
myShapes.Append(TheShape);
}
//=======================================================================
//function : GetShapes()
//purpose :
//=======================================================================
const TopTools_ListOfShape & BOPTools_CheckResult::GetShapes() const
{
return myShapes;
}
//=======================================================================
//function : SetCheckStatus()
//purpose :
//=======================================================================
void BOPTools_CheckResult::SetCheckStatus(const BOPTools_CheckStatus TheStatus)
{
myStatus = TheStatus;
}
//=======================================================================
//function : GetCheckStatus()
//purpose :
//=======================================================================
BOPTools_CheckStatus BOPTools_CheckResult::GetCheckStatus() const
{
return myStatus;
}
//=======================================================================
//function : SetGeometry()
//purpose :
//=======================================================================
void BOPTools_CheckResult::SetInterferenceGeometry(const Handle(Geom_Geometry)& TheGeometry)
{
myGeometry = TheGeometry;
}
//=======================================================================
//function : GetGeometry()
//purpose :
//=======================================================================
const Handle(Geom_Geometry)& BOPTools_CheckResult::GetInterferenceGeometry() const
{
return myGeometry;
}

View File

@@ -1,145 +0,0 @@
-- Created on: 2002-08-05
-- Created by: Peter KURNEV
-- Copyright (c) 2002-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Checker from BOPTools inherits PaveFiller from BOPTools
---Purpose:
-- class that provides the algorithm
-- to check a shape on self-interference.
uses
ListOfCheckResults from BOPTools,
InterferencePool from BOPTools,
Shape from TopoDS,
ShapeEnum from TopAbs,
Geometry from Geom
is
Create
returns Checker from BOPTools;
---Purpose:
--- Empty Contructor
---
Create (aS:Shape from TopoDS)
returns Checker from BOPTools;
---Purpose:
--- Contructs the object using the shape <aS> to check
---
Create (aIP: InterferencePool from BOPTools)
returns Checker from BOPTools;
---Purpose:
--- Contructs the object using the <InterferencePool>
---
Destroy (me:out)
is redefined;
---C++: alias "Standard_EXPORT virtual ~BOPTools_Checker(){Destroy();}"
---Purpose:
--- Destructor
---
SetPerformType(me: in out; StopOnFirstFaulty: Boolean from Standard);
---Purpose: if <StopOnFirstFaulty == Standard_True> the process stops
-- and the exception throws; otherwise all faulties are searched
Perform (me:out)
is redefined;
---Purpose:
--- Launches the algorithm
---
SetShape(me:out;
aS:Shape from TopoDS);
---Purpose:
--- Selector
---
Shape(me)
returns Shape from TopoDS;
---C++:return const &
---Purpose:
--- Selector
---
GetCheckResult(me)
returns ListOfCheckResults from BOPTools;
---C++: return const &
---Purpose: returnes a result of check
HasFaulty(me)
returns Boolean from Standard;
---Purpose:
--- Selector.
--- Retrns TRUE if there is interferred sub-shapes .
---
PerformVV (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PerformVE (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PerformVF (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PerformEE (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PerformEF (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PerformFF (me:out)
is redefined protected ;
---Purpose:
--- See in base classe, please
---
PrepareEdges (me:out)
is redefined protected ;
---Purpose:
--- Prepare end paves for each edge
---
PreparePaveBlocks (me:out;
aType1: ShapeEnum from TopAbs;
aType2: ShapeEnum from TopAbs)
is redefined protected ;
---Purpose:
--- Internal usage
---
PreparePaveBlocks (me:out;
anE:Integer from Standard)
is redefined protected ;
---Purpose:
--- Prepare end paves for the edge <anE>
---
fields
myShape : Shape from TopoDS;
myCheckResults : ListOfCheckResults from BOPTools;
myStopOnFirst : Boolean from Standard;
myEntryType : Integer from Standard;
end Checker;

File diff suppressed because it is too large Load Diff

View File

@@ -1,108 +0,0 @@
-- Created on: 2001-02-15
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class CommonBlock from BOPTools
---Purpose:
-- The class hold a structure for storing info about a couple
-- of pave blocks that are considered as common
uses
PaveBlock from BOPTools
is
Create
returns CommonBlock from BOPTools;
---Purpose:
--- Empty constructor
---
Create (aPB1:PaveBlock from BOPTools;
aPB2:PaveBlock from BOPTools);
---Purpose:
--- Constructor that uses couple of pave blocks
---
Create (aPB1:PaveBlock from BOPTools;
aF:Integer from Standard);
---Purpose:
--- Constructor that uses a pave block and a face
---
SetPaveBlock1 (me:out; aPB1:PaveBlock from BOPTools);
---Purpose:
--- Modifier
--- Sets first block
---
SetPaveBlock2 (me:out; aPB2:PaveBlock from BOPTools);
---Purpose:
--- Modifier
--- Sets second block
---
SetFace (me:out; aF: Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index of the face (if it exists) with which the
--- CommonBlock is common. 0 is default value
---
PaveBlock1 (me)
returns PaveBlock from BOPTools;
---C++: return const &
---Purpose:
--- Selector
--- Always returns first block myPB1
---
PaveBlock1 (me:out; anIndex: Integer from Standard)
returns PaveBlock from BOPTools;
---C++: return &
---Purpose:
--- Selector
--- Returns block that belongs to the original edge with
--- DS-index=anIndex
---
PaveBlock2 (me)
returns PaveBlock from BOPTools;
---C++: return const &
---Purpose:
--- Selector
--- Always returns first block myPB2
---
PaveBlock2 (me:out; anIndex: Integer from Standard)
returns PaveBlock from BOPTools;
---C++: return &
---Purpose:
--- Selector
--- Returns block that does not belong to the original edge with
--- DS-index=anIndex
---
Face(me)
returns Integer from Standard;
---Purpose:
--- Selector
--- Returns the DS-index of the face (if exists)
--- with which the CommonBlock is common.
--- Otherwise it returns 0.
---
fields
myPB1 : PaveBlock from BOPTools;
myPB2 : PaveBlock from BOPTools;
myFace : Integer from Standard;
end CommonBlock;

View File

@@ -1,64 +0,0 @@
-- Created on: 2001-03-14
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class CommonBlockAPI from BOPTools
---Purpose:
--- class that provide some useful tools
--- to manage with a List Of Common Block-s
uses
ListOfCommonBlock from BOPTools,
ListOfPaveBlock from BOPTools,
PaveBlock from BOPTools
is
Create (aList:ListOfCommonBlock from BOPTools)
returns CommonBlockAPI from BOPTools;
---Purpose:
--- Constructor
---
List(me)
returns ListOfCommonBlock from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
CommonPaveBlocks(me;
anE:Integer from Standard)
returns ListOfPaveBlock from BOPTools;
---C++: return const &
---Purpose:
--- Returns all PaveBlock-s (from the list) that are
--- common for the given edge with DS-index <anE>
---
IsCommonBlock (me;
aPB: PaveBlock from BOPTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if given PaveBlock <aPB> is
--- common for the Blocks from the list
---
fields
myListOfCommonBlock :Address from Standard;
myListOfPaveBlock :ListOfPaveBlock from BOPTools;
end CommonBlockAPI;

View File

@@ -1,106 +0,0 @@
// Created on: 2001-03-14
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_CommonBlockAPI.ixx>
#include <BOPTools_CommonBlock.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListOfCommonBlock.hxx>
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
//=======================================================================
// function: BOPTools_CommonBlockAPI::BOPTools_CommonBlockAPI
// purpose:
//=======================================================================
BOPTools_CommonBlockAPI::BOPTools_CommonBlockAPI
(const BOPTools_ListOfCommonBlock& aLCB)
{
myListOfCommonBlock=(void *)&aLCB;
}
//=======================================================================
// function: List
// purpose:
//=======================================================================
const BOPTools_ListOfCommonBlock& BOPTools_CommonBlockAPI::List () const
{
BOPTools_ListOfCommonBlock* pListOfCommonBlock=
(BOPTools_ListOfCommonBlock*)myListOfCommonBlock;
return *pListOfCommonBlock;
}
//=======================================================================
// function: CommonPaveBlocks
// purpose: get all CommonPaveBlocks
//=======================================================================
const BOPTools_ListOfPaveBlock&
BOPTools_CommonBlockAPI::CommonPaveBlocks
(const Standard_Integer anE) const
{
Standard_Integer anECurrent, i;
BOPTools_ListOfPaveBlock* pmyListOfPaveBlock=
(BOPTools_ListOfPaveBlock*) &myListOfPaveBlock;
pmyListOfPaveBlock->Clear();
BOPTools_ListOfCommonBlock* pListOfCommonBlock=
(BOPTools_ListOfCommonBlock*)myListOfCommonBlock;
BOPTools_ListIteratorOfListOfCommonBlock anIt(*pListOfCommonBlock);
for (; anIt.More(); anIt.Next()) {
const BOPTools_CommonBlock& aCB=anIt.Value();
for (i=0; i<2; i++) {
const BOPTools_PaveBlock& aPB=(!i) ? aCB.PaveBlock1() : aCB.PaveBlock2();
anECurrent=aPB.OriginalEdge();
if (anECurrent==anE) {
pmyListOfPaveBlock->Append(aPB);
break;
}
}
}
return myListOfPaveBlock;
}
//=======================================================================
// function: IsCommonBlock
// purpose:
//=======================================================================
Standard_Boolean BOPTools_CommonBlockAPI::IsCommonBlock
(const BOPTools_PaveBlock& aPB) const
{
Standard_Integer anE;
anE=aPB.OriginalEdge();
CommonPaveBlocks(anE);
BOPTools_ListIteratorOfListOfPaveBlock anIt(myListOfPaveBlock);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB1=anIt.Value();
if (aPB1.IsEqual(aPB)) {
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -1,63 +0,0 @@
-- Created on: 2001-02-16
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ComparePave from BOPTools
---Purpose:
---
--- Auxiliary class for sorting paves along the edge
--- in acoordance with increasing order of parameter
uses
Pave from BOPTools
is
Create
returns ComparePave from BOPTools;
---Purpose:
--- Empty constructor
--- Default comparing tolerance value=1.e-12
---
Create (aTol:Real from Standard)
returns ComparePave from BOPTools;
---Purpose:
--- Constructor that use comparing tolerance value as parameter.
---
IsLower (me; Left, Right: Pave from BOPTools)
returns Boolean ;
---Purpose:
--- Returns True if <Left> is lower than <Right>.
---
IsGreater (me; Left, Right: Pave from BOPTools)
returns Boolean from Standard ;
---Purpose:
--- Returns True if <Left> is greater than <Right>.
---
IsEqual(me; Left, Right: Pave from BOPTools)
returns Boolean from Standard ;
---Purpose:
--- Returns True when <Right> and <Left> are equal.
---
fields
myTol: Real from Standard;
end ComparePave;

View File

@@ -1,69 +0,0 @@
// Created on: 2001-02-16
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_ComparePave.ixx>
//=======================================================================
// function: BOPTools_ComparePave::BOPTools_ComparePave
// purpose:
//=======================================================================
BOPTools_ComparePave::BOPTools_ComparePave()
:myTol(1.e-12)
{}
//=======================================================================
// function: BOPTools_ComparePave::BOPTools_ComparePave
// purpose:
//=======================================================================
BOPTools_ComparePave::BOPTools_ComparePave(const Standard_Real aTol)
{
myTol=aTol;
}
//=======================================================================
// function: IsLower
// purpose:
//=======================================================================
Standard_Boolean BOPTools_ComparePave::IsLower(const BOPTools_Pave& aLeft,
const BOPTools_Pave& aRight)const
{
return aLeft.Param()<aRight.Param();
}
//=======================================================================
// function: IsGreater
// purpose:
//=======================================================================
Standard_Boolean BOPTools_ComparePave::IsGreater(const BOPTools_Pave& aLeft,
const BOPTools_Pave& aRight)const
{
return aLeft.Param()>aRight.Param();
}
//=======================================================================
// function: IsEqual
// purpose:
//=======================================================================
Standard_Boolean BOPTools_ComparePave::IsEqual(const BOPTools_Pave& aLeft,
const BOPTools_Pave& aRight)const
{
Standard_Real a, b;
a=aLeft.Param();
b=aRight.Param();
return fabs(a-b) < myTol;
}

View File

@@ -0,0 +1,85 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_ConnexityBlock_HeaderFile
#define BOPTools_ConnexityBlock_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <NCollection_BaseAllocator.hxx>
#include <BOPCol_ListOfShape.hxx>
//=======================================================================
//class : ConnexityBlock
//purpose :
//=======================================================================
class BOPTools_ConnexityBlock {
public:
BOPTools_ConnexityBlock() :
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myRegular(Standard_True),
myShapes(myAllocator),
myLoops(myAllocator) {
};
//
BOPTools_ConnexityBlock(const Handle(NCollection_BaseAllocator)& theAllocator):
myRegular(Standard_True),
myAllocator(theAllocator),
myShapes(myAllocator),
myLoops(myAllocator) {
};
//
const BOPCol_ListOfShape& Shapes()const {
return myShapes;
};
//
BOPCol_ListOfShape& ChangeShapes() {
return myShapes;
};
//
void SetRegular(const Standard_Boolean theFlag) {
myRegular=theFlag;
}
//
Standard_Boolean IsRegular()const {
return myRegular;
}
//
const BOPCol_ListOfShape& Loops()const {
return myLoops;
};
//
BOPCol_ListOfShape& ChangeLoops() {
return myLoops;
};
//
protected:
Standard_Boolean myRegular;
Handle(NCollection_BaseAllocator) myAllocator;
BOPCol_ListOfShape myShapes;
BOPCol_ListOfShape myLoops;
};
#endif

View File

@@ -1,88 +0,0 @@
-- Created on: 2002-04-01
-- Created by: Peter KURNEV
-- Copyright (c) 2002-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class CoupleOfInteger from BOPTools
---Purpose:
-- Auxiliary class providing structure to
-- store info about a couple of integers
--uses
--raises
is
Create
returns CoupleOfInteger from BOPTools;
---Purpose:
--- Empty Constructor
---
Create(aFirst : Integer from Standard;
aSecond : Integer from Standard)
returns CoupleOfInteger from BOPTools;
---Purpose:
--- Constructor
---
SetCouple(me:out;
aFirst : Integer from Standard;
aSecond : Integer from Standard);
---Purpose:
--- Modifier
---
SetFirst(me:out;
aFirst : Integer from Standard);
---Purpose:
--- Modifier
---
SetSecond(me:out;
aSecond : Integer from Standard);
---Purpose:
--- Modifier
---
Couple (me;
aFirst :out Integer from Standard;
aSecond :out Integer from Standard);
---Purpose:
--- Selector
---
First(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Second(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
IsEqual(me;
aOther:like me)
returns Boolean from Standard;
HashCode(me;
Upper : Integer from Standard)
returns Integer from Standard;
fields
myFirst : Integer from Standard;
mySecond : Integer from Standard;
end CoupleOfInteger;

View File

@@ -1,119 +0,0 @@
// Created on: 2002-04-01
// Created by: Peter KURNEV
// Copyright (c) 2002-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_CoupleOfInteger.ixx>
//=======================================================================
// function: BOPTools_CoupleOfInteger::BOPTools_CoupleOfInteger
// purpose:
//=======================================================================
BOPTools_CoupleOfInteger::BOPTools_CoupleOfInteger()
:
myFirst(99),
mySecond(99)
{}
//=======================================================================
// function: BOPTools_CoupleOfInteger::BOPTools_CoupleOfInteger
// purpose:
//=======================================================================
BOPTools_CoupleOfInteger::BOPTools_CoupleOfInteger(const Standard_Integer aFirst,
const Standard_Integer aSecond)
:
myFirst(aFirst),
mySecond(aSecond)
{}
//=======================================================================
// function: SetCouple
// purpose:
//=======================================================================
void BOPTools_CoupleOfInteger::SetCouple(const Standard_Integer aFirst,
const Standard_Integer aSecond)
{
myFirst=aFirst;
mySecond=aSecond;
}
//=======================================================================
// function: SetFirst
// purpose:
//=======================================================================
void BOPTools_CoupleOfInteger::SetFirst(const Standard_Integer aFirst)
{
myFirst=aFirst;
}
//=======================================================================
// function: SetSecond
// purpose:
//=======================================================================
void BOPTools_CoupleOfInteger::SetSecond(const Standard_Integer aSecond)
{
mySecond=aSecond;
}
//=======================================================================
// function: Couple
// purpose:
//=======================================================================
void BOPTools_CoupleOfInteger::Couple(Standard_Integer& aFirst,
Standard_Integer& aSecond)const
{
aFirst=myFirst;
aSecond=mySecond;
}
//=======================================================================
// function: First
// purpose:
//=======================================================================
Standard_Integer BOPTools_CoupleOfInteger::First()const
{
return myFirst;
}
//=======================================================================
// function: Second
// purpose:
//=======================================================================
Standard_Integer BOPTools_CoupleOfInteger::Second()const
{
return mySecond;
}
//=======================================================================
// function: IsEqual
// purpose:
//=======================================================================
Standard_Boolean BOPTools_CoupleOfInteger::IsEqual(const BOPTools_CoupleOfInteger& aOther)const
{
Standard_Boolean b1, b2;
//
b1=(Standard_Boolean)((myFirst==aOther.myFirst ) && (mySecond==aOther.mySecond));
b2=(Standard_Boolean)((myFirst==aOther.mySecond) && (mySecond==aOther.myFirst ));
return (Standard_Boolean)(b1||b2);
}
//=======================================================================
// function: HashCode
// purpose:
//=======================================================================
Standard_Integer BOPTools_CoupleOfInteger::HashCode(const Standard_Integer aUpper)const
{
return (myFirst+mySecond)%aUpper;
}

View File

@@ -1,46 +0,0 @@
-- Created on: 2003-12-05
-- Created by: Peter KURNEV
-- Copyright (c) 2003-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class CoupleOfIntegerMapHasher from BOPTools
---Purpose:
uses
CoupleOfInteger from BOPTools
--raises
is
HashCode(myclass;
aPKey : CoupleOfInteger from BOPTools;
Upper : Integer from Standard)
returns Integer from Standard;
IsEqual(myclass;
aPKey1 : CoupleOfInteger from BOPTools;
aPKey2 : CoupleOfInteger from BOPTools)
returns Boolean from Standard;
--fields
end CoupleOfIntegerMapHasher;

View File

@@ -1,6 +1,5 @@
// Created on: 2003-12-05
// Created by: Peter KURNEV
// Copyright (c) 2003-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,24 +17,41 @@
// and conditions governing the rights and limitations under the License.
#include <BOPTools_CoupleOfIntegerMapHasher.ixx>
#ifndef BOPTools_CoupleOfShape_HeaderFile
#define BOPTools_CoupleOfShape_HeaderFile
//=======================================================================
//function : HashCode
//class :
//purpose :
//=======================================================================
Standard_Integer BOPTools_CoupleOfIntegerMapHasher::HashCode(const BOPTools_CoupleOfInteger& aPKey,
const Standard_Integer Upper)
{
return aPKey.HashCode(Upper);
}
//=======================================================================
//function :IsEqual
//purpose :
//=======================================================================
Standard_Boolean BOPTools_CoupleOfIntegerMapHasher::IsEqual(const BOPTools_CoupleOfInteger& aPKey1,
const BOPTools_CoupleOfInteger& aPKey2)
{
return aPKey1.IsEqual(aPKey2);
}
class BOPTools_CoupleOfShape {
public:
BOPTools_CoupleOfShape() {
};
//
~BOPTools_CoupleOfShape() {
};
//
void SetShape1(const TopoDS_Shape& theShape) {
myShape1=theShape;
}
//
const TopoDS_Shape& Shape1()const{
return myShape1;
}
//
void SetShape2(const TopoDS_Shape& theShape) {
myShape2=theShape;
}
//
const TopoDS_Shape& Shape2()const{
return myShape2;
}
//
protected:
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
#endif

View File

@@ -1,89 +0,0 @@
-- Created on: 2001-05-08
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Curve from BOPTools
---Purpose:
-- Class holds the structure for storing information about
--- intersection curve and set of paves on it
---
uses
ListOfInteger from TColStd,
Curve from IntTools,
PaveSet from BOPTools,
PaveBlock from BOPTools,
ListOfPaveBlock from BOPTools
is
Create
returns Curve from BOPTools;
---Purpose:
--- Empty constructor
---
Create (aIC:Curve from IntTools)
returns Curve from BOPTools;
---Purpose:
--- Constructor
---
SetCurve(me:out;
aIC:Curve from IntTools);
---Purpose:
--- Modifier
---
Curve(me)
returns Curve from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
Set(me:out)
returns PaveSet from BOPTools;
---C++: return &
---Purpose:
--- Selector
---
AppendNewBlock(me:out;
aPB:PaveBlock from BOPTools);
---Purpose:
--- Adds the PaveBlock <aPB> to the pave set
---
NewPaveBlocks(me)
returns ListOfPaveBlock from BOPTools;
---C++: return const &
---Purpose:
--- Returns the PaveBlock-s attached to the curve
---
TechnoVertices (me:out)
returns ListOfInteger from TColStd;
---C++: return &
---Purpose:
--- Returns indices TechnoVertices attached to the curve
---
fields
myCurve : Curve from IntTools;
myPaveSet: PaveSet from BOPTools;
myNewPBs : ListOfPaveBlock from BOPTools;
myTechnoVertices : ListOfInteger from TColStd;
end Curve;

View File

@@ -1,87 +0,0 @@
// Created on: 2001-05-08
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Curve.ixx>
//=======================================================================
// function: BOPTools_Curve::BOPTools_Curve
// purpose:
//=======================================================================
BOPTools_Curve::BOPTools_Curve()
{}
//=======================================================================
// function: BOPTools_Curve::BOPTools_Curve
// purpose:
//=======================================================================
BOPTools_Curve::BOPTools_Curve (const IntTools_Curve& aIC)
{
myCurve=aIC;
}
//=======================================================================
// function: SetCurve
// purpose:
//=======================================================================
void BOPTools_Curve::SetCurve (const IntTools_Curve& aIC)
{
myCurve=aIC;
}
//=======================================================================
// function: Curve
// purpose:
//=======================================================================
const IntTools_Curve& BOPTools_Curve::Curve () const
{
return myCurve;
}
//=======================================================================
// function: Set
// purpose:
//=======================================================================
BOPTools_PaveSet& BOPTools_Curve::Set()
{
return myPaveSet;
}
//=======================================================================
//function : AppendNewBlock
//purpose :
//=======================================================================
void BOPTools_Curve::AppendNewBlock(const BOPTools_PaveBlock& aPB)
{
myNewPBs.Append(aPB);
}
//=======================================================================
//function : NewPaveBlocks
//purpose :
//=======================================================================
const BOPTools_ListOfPaveBlock& BOPTools_Curve::NewPaveBlocks() const
{
return myNewPBs;
}
//=======================================================================
//function : TechnoVertices
//purpose :
//=======================================================================
TColStd_ListOfInteger& BOPTools_Curve::TechnoVertices()
{
return myTechnoVertices;
}

View File

@@ -1,74 +0,0 @@
-- Created on: 2001-09-12
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class DEInfo from BOPTools
---Purpose:
-- Auxiliary class for storing information about
--- a degenerated edge
---
uses
ListOfInteger from TColStd
is
Create
returns DEInfo from BOPTools;
---Purpose:
--- Empty constructor
---
SetVertex (me:out;
nV:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the vertex to which
--- degenerated edge belongs to
---
SetFaces (me:out;
aLF: ListOfInteger from TColStd);
---Purpose:
--- Modifier
--- Sets DS-indices for the faces to which
--- degenerated edge belongs to
---
Faces(me)
returns ListOfInteger from TColStd;
---C++: return const &
---Purpose:
--- Selector
---
ChangeFaces(me:out)
returns ListOfInteger from TColStd;
---C++: return &
---Purpose:
--- Selector/Modifier
---
Vertex(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
fields
myFaces : ListOfInteger from TColStd;
myVertex : Integer from Standard;
end DEInfo;

View File

@@ -1,80 +0,0 @@
// Created on: 2001-09-12
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_DEInfo.ixx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
//=======================================================================
// function: BOPTools_DEInfo::BOPTools_DEInfo
// purpose:
//=======================================================================
BOPTools_DEInfo::BOPTools_DEInfo()
{}
//=======================================================================
// function: SetVertex
// purpose:
//=======================================================================
void BOPTools_DEInfo::SetVertex(const Standard_Integer nV)
{
myVertex=nV;
}
//=======================================================================
// function: Vertex
// purpose:
//=======================================================================
Standard_Integer BOPTools_DEInfo::Vertex()const
{
return myVertex;
}
//=======================================================================
// function: SetFaces
// purpose:
//=======================================================================
void BOPTools_DEInfo::SetFaces(const TColStd_ListOfInteger& aLI)
{
myFaces.Clear();
TColStd_ListIteratorOfListOfInteger anIt(aLI);
for (; anIt.More(); anIt.Next()) {
Standard_Integer nF=anIt.Value();
myFaces.Append(nF);
}
}
//=======================================================================
// function: Faces
// purpose:
//=======================================================================
const TColStd_ListOfInteger& BOPTools_DEInfo::Faces()const
{
return myFaces;
}
//=======================================================================
// function: ChangeFaces
// purpose:
//=======================================================================
TColStd_ListOfInteger& BOPTools_DEInfo::ChangeFaces()
{
return myFaces;
}

View File

@@ -1,128 +0,0 @@
-- Created on: 2001-09-12
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class DEProcessor from BOPTools
---Purpose:
--
-- The Algorithm to compute and store in interferences' pool
--- and in the Data Structure the following values
--- for degenerated edges
--- 1. Paves/Pave set(s)
--- 2. Split parts
--- 3. States (3D) for split parts
---
uses
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
PPaveFiller from BOPTools,
PaveFiller from BOPTools,
ListOfPaveBlock from BOPTools,
PShapesDataStructure from BooleanOperations,
IndexedDataMapOfIntegerDEInfo from BOPTools
is
Create (aFiller: PaveFiller from BOPTools;
aDim : Integer from Standard=3)
returns DEProcessor from BOPTools;
---Purpose:
--- Constructor
---
Do(me:out);
---Purpose:
--- Launches the processor
---
IsDone(me)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if it is Ok
---
---
--- Private block
---
---
FindDegeneratedEdges (me:out)
is private;
DoPaves (me:out)
is private;
FindPaveBlocks (me:out;
nED:Integer from Standard;
nVD:Integer from Standard;
nFD:Integer from Standard;
aLPB:out ListOfPaveBlock from BOPTools)
is private;
FillPaveSet (me:out;
nED:Integer from Standard;
nVD:Integer from Standard;
nFD:Integer from Standard;
aLPB:out ListOfPaveBlock from BOPTools)
is private;
FillSplitEdgesPool(me:out;
nED:Integer from Standard)
is private;
MakeSplitEdges(me:out;
nED:Integer from Standard;
nFD:Integer from Standard)
is private;
MakeSplitEdge (me:out;
aS1: Edge from TopoDS;
aF : Face from TopoDS;
aV1: Vertex from TopoDS;
aP1: Real from Standard;
aV2: Vertex from TopoDS;
aP2: Real from Standard;
aNewEdge:out Edge from TopoDS)
is private;
DoStates (me:out;
nED:Integer from Standard;
nFD:Integer from Standard)
is private;
DoStates2D (me:out;
nED:Integer from Standard;
nFD:Integer from Standard)
is private;
fields
myDim : Integer from Standard;
myFiller : PPaveFiller from BOPTools;
myDS : PShapesDataStructure from BooleanOperations;
myIsDone : Boolean from Standard;
myDEMap : IndexedDataMapOfIntegerDEInfo from BOPTools;
end DEProcessor;

View File

@@ -1,713 +0,0 @@
// Created on: 2001-09-12
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_DEProcessor.ixx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Solid.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Sphere.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <Precision.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_DEInfo.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_PavePool.hxx>
#include <BOPTools_Pave.hxx>
#include <BOPTools_PaveSet.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_PaveBlockIterator.hxx>
#include <BOPTools_ListOfPave.hxx>
#include <BOPTools_ListIteratorOfListOfPave.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_StateFiller.hxx>
//=======================================================================
// function: BOPTools_DEProcessor::BOPTools_DEProcessor
// purpose:
//=======================================================================
BOPTools_DEProcessor::BOPTools_DEProcessor(const BOPTools_PaveFiller& aFiller,
const Standard_Integer aDim)
:
myIsDone(Standard_False)
{
myFiller=(BOPTools_PaveFiller*) &aFiller;
myDS=myFiller->DS();
myDim=aDim;
if (aDim<2 || aDim>3) {
myDim=3;
}
}
//=======================================================================
// function: IsDone
// purpose:
//=======================================================================
Standard_Boolean BOPTools_DEProcessor::IsDone() const
{
return myIsDone;
}
//=======================================================================
// function: Do
// purpose:
//=======================================================================
void BOPTools_DEProcessor::Do()
{
Standard_Integer aNbE;
myIsDone=Standard_False;
FindDegeneratedEdges();
aNbE=myDEMap.Extent();
if (!aNbE) {
myIsDone=Standard_True;
return;
}
DoPaves();
}
//=======================================================================
// function: FindDegeneratedEdges
// purpose:
//=======================================================================
void BOPTools_DEProcessor::FindDegeneratedEdges()
{
const BooleanOperations_ShapesDataStructure& aDS=*myDS;
const BOPTools_PaveFiller& aPaveFiller=*myFiller;
Standard_Integer i, aNbSourceShapes, nV, nF, nVx, ip, iRankE;
TopAbs_ShapeEnum aType;
const TopoDS_Shape& anObj=aDS.Object();
const TopoDS_Shape& aTool=aDS.Tool();
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
TopExp::MapShapesAndAncestors (anObj, TopAbs_EDGE, TopAbs_FACE, aMEF);
TopExp::MapShapesAndAncestors (aTool, TopAbs_EDGE, TopAbs_FACE, aMEF);
aNbSourceShapes=aDS.NumberOfSourceShapes();
for (i=1; i<=aNbSourceShapes; i++) {
const TopoDS_Shape& aS=aDS.Shape(i);
aType=aS.ShapeType();
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE=TopoDS::Edge(aS);
if (BRep_Tool::Degenerated(aE)) {
iRankE=aDS.Rank(i);
TopoDS_Vertex aV=TopExp::FirstVertex(aE);
nVx=aDS.ShapeIndex(aV, iRankE);
//
nV=nVx;
ip=aPaveFiller.FindSDVertex(nV);
if (ip) {
nV=ip;
}
//
TColStd_ListOfInteger aLFn;
const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE);
TopTools_ListIteratorOfListOfShape anIt(aLF);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aF=anIt.Value();
nF=aDS.ShapeIndex(aF, iRankE);
aLFn.Append(nF);
}
BOPTools_DEInfo aDEInfo;
aDEInfo.SetVertex(nV);
aDEInfo.SetFaces(aLFn);
myDEMap.Add (i, aDEInfo);
}
}
}
}
//=======================================================================
// function: DoPaves
// purpose:
//=======================================================================
void BOPTools_DEProcessor::DoPaves()
{
Standard_Integer i, aNbE, nED, nVD, nFD=0;
aNbE=myDEMap.Extent();
for (i=1; i<=aNbE; i++) {
nED=myDEMap.FindKey(i);
const BOPTools_DEInfo& aDEInfo=myDEMap(i);
nVD=aDEInfo.Vertex();
// Fill PaveSet for the edge nED
const TColStd_ListOfInteger& nLF=aDEInfo.Faces();
TColStd_ListIteratorOfListOfInteger anIt(nLF);
for (; anIt.More(); anIt.Next()) {
nFD=anIt.Value();
BOPTools_ListOfPaveBlock aLPB;
FindPaveBlocks(nED, nVD, nFD, aLPB);
FillPaveSet (nED, nVD, nFD, aLPB);
}
//
// Fill aSplitEdges for the edge nED
FillSplitEdgesPool(nED);
//
// MakeSplitEdges
MakeSplitEdges(nED, nFD);
//
// Compute States for Split parts
if (myDim==3) {
DoStates(nED, nFD);
}
if (myDim==2) {
DoStates2D(nED, nFD);
}
}// next nED
}
//=======================================================================
// function: DoStates
// purpose:
//=======================================================================
void BOPTools_DEProcessor::DoStates (const Standard_Integer nED,
const Standard_Integer nFD)
{
const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED));
const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD));
Standard_Integer nSp, iRank;
Standard_Real aT, aT1, aT2, aTol=1e-7;
TopoDS_Face aF;
gp_Pnt2d aPx2DNear;
gp_Pnt aPxNear;
iRank=myDS->Rank(nED);
const TopoDS_Shape& aReference=(iRank==1) ? myDS->Tool() : myDS->Object();
BRepExtrema_DistShapeShape aDSS;
aDSS.LoadS1(aReference);
aF=aDF;
aF.Orientation(TopAbs_FORWARD);
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value();
nSp=aPB.Edge();
const TopoDS_Edge& aSp=TopoDS::Edge(myDS->Shape(nSp));
aPB.Parameters(aT1, aT2);
aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
TopoDS_Edge aDERight, aSpRight;
aDERight=aDE;
aSpRight=aSp;
BOPTools_Tools3D::OrientEdgeOnFace (aDE, aF, aDERight);
aSpRight.Orientation(aDERight.Orientation());
//
{
BRepAdaptor_Surface aBAS;
aBAS.Initialize (aDF, Standard_False);
if (aBAS.GetType()==GeomAbs_Sphere) {
Standard_Real aDt2D, aR, aDelta=1.e-14;
gp_Sphere aSphere=aBAS.Sphere();
aR=aSphere.Radius();
//
aDt2D=acos (1.-4.*aTol/aR)+aDelta ;
//
BOPTools_Tools3D::PointNearEdge(aSpRight, aF, aT, aDt2D, aPx2DNear, aPxNear);
}
else {
BOPTools_Tools3D::PointNearEdge(aSpRight, aF, aT, aPx2DNear, aPxNear);
}
}
//
TopAbs_State aState;
//
TopAbs_ShapeEnum aTypeReference;
aTypeReference=aReference.ShapeType();
if (aTypeReference==TopAbs_SOLID) {
// ... \ Solid processing
const Handle(IntTools_Context)& aContext=myFiller->Context();
const TopoDS_Solid& aReferenceSolid=TopoDS::Solid(aReference);
BRepClass3d_SolidClassifier& SC=aContext->SolidClassifier(aReferenceSolid);
//
SC.Perform(aPxNear, aTol);
//
aState=SC.State();
}
//
else if (aTypeReference==TopAbs_SHELL ||
aTypeReference==TopAbs_FACE) {
// ... \ Shell processing
TopoDS_Vertex aVxNear;
BRep_Builder BB;
BB.MakeVertex(aVxNear, aPxNear, aTol);
aDSS.LoadS2(aVxNear);
aDSS.Perform();
aState=TopAbs_OUT;
if (aDSS.IsDone()) {
Standard_Real aDist=aDSS.Value();
if (aDist < aTol) {
aState=TopAbs_ON;
}
}
}
else {
// unknown aTypeReference
aState=TopAbs_OUT;
}
//
BooleanOperations_StateOfShape aSt;
aSt=BOPTools_StateFiller::ConvertState(aState);
myDS->SetState(nSp, aSt);
}
}
//=======================================================================
// function: DoStates2D
// purpose:
//=======================================================================
void BOPTools_DEProcessor::DoStates2D (const Standard_Integer nED,
const Standard_Integer nFD)
{
const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED));
const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD));
Standard_Integer nSp, iRank;
Standard_Real aT, aT1, aT2;
TopoDS_Face aF;
gp_Pnt2d aPx2DNear;
gp_Pnt aPxNear;
iRank=myDS->Rank(nED);
const TopoDS_Shape& aReference=(iRank==1) ? myDS->Tool() : myDS->Object();
const TopoDS_Face& aFaceReference=TopoDS::Face(aReference);
aF=aDF;
aF.Orientation(TopAbs_FORWARD);
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value();
nSp=aPB.Edge();
const TopoDS_Edge& aSp=TopoDS::Edge(myDS->Shape(nSp));
aPB.Parameters(aT1, aT2);
aT=IntTools_Tools::IntermediatePoint(aT1, aT2);
TopoDS_Edge aDERight, aSpRight;
aDERight=aDE;
aSpRight=aSp;
BOPTools_Tools3D::OrientEdgeOnFace (aDE, aF, aDERight);
aSpRight.Orientation(aDERight.Orientation());
//
BOPTools_Tools3D::PointNearEdge(aSpRight, aDF, aT, aPx2DNear, aPxNear);
//
Standard_Boolean bIsValidPoint;
TopAbs_State aState=TopAbs_OUT;
//
const Handle(IntTools_Context)& aContext=myFiller->Context();
bIsValidPoint=aContext->IsValidPointForFace(aPxNear, aFaceReference, 1.e-3);
//
if (bIsValidPoint) {
aState=TopAbs_IN;
}
//
BooleanOperations_StateOfShape aSt;
aSt=BOPTools_StateFiller::ConvertState(aState);
myDS->SetState(nSp, aSt);
}
}
//=======================================================================
// function: FillSplitEdgesPool
// purpose:
//=======================================================================
void BOPTools_DEProcessor::FillSplitEdgesPool (const Standard_Integer nED)
{
BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->ChangeSplitShapesPool();
//
BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool.ChangeValue(myDS->RefEdge(nED));
//
aSplitEdges.Clear();
//
const BOPTools_PavePool& aPavePool=myFiller->PavePool();
BOPTools_PavePool* pPavePool=(BOPTools_PavePool*) &aPavePool;
BOPTools_PaveSet& aPaveSet= pPavePool->ChangeValue(myDS->RefEdge(nED));
BOPTools_PaveBlockIterator aPBIt(nED, aPaveSet);
for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value();
aSplitEdges.Append(aPB);
}
}
//=======================================================================
// function: MakeSplitEdges
// purpose:
//=======================================================================
void BOPTools_DEProcessor::MakeSplitEdges (const Standard_Integer nED,
const Standard_Integer nFD)
{
const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED));
Standard_Integer nV1, nV2, aNewShapeIndex;
Standard_Real t1, t2;
TopoDS_Edge aE, aESplit;
TopoDS_Vertex aV1, aV2;
const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED));
const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD));
BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value();
const BOPTools_Pave& aPave1=aPB.Pave1();
nV1=aPave1.Index();
t1=aPave1.Param();
aV1=TopoDS::Vertex(myDS->GetShape(nV1));
aV1.Orientation(TopAbs_FORWARD);
const BOPTools_Pave& aPave2=aPB.Pave2();
nV2=aPave2.Index();
t2=aPave2.Param();
aV2=TopoDS::Vertex(myDS->GetShape(nV2));
aV2.Orientation(TopAbs_REVERSED);
MakeSplitEdge(aDE, aDF, aV1, t1, aV2, t2, aESplit);
//
// Add Split Part of the Original Edge to the DS
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
anASSeq.SetNewSuccessor(nV1);
anASSeq.SetNewOrientation(aV1.Orientation());
anASSeq.SetNewSuccessor(nV2);
anASSeq.SetNewOrientation(aV2.Orientation());
myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
aNewShapeIndex=myDS->NumberOfInsertedShapes();
myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
//
// Fill Split Set for the Original Edge
aPB.SetEdge(aNewShapeIndex);
//
}
}
//=======================================================================
// function: MakeSplitEdge
// purpose:
//=======================================================================
void BOPTools_DEProcessor::MakeSplitEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const TopoDS_Vertex& aV1,
const Standard_Real aP1,
const TopoDS_Vertex& aV2,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
{
Standard_Real aTol=1.e-7;
TopoDS_Edge E=aE;
E.EmptyCopy();
BRep_Builder BB;
BB.Add (E, aV1);
BB.Add (E, aV2);
BB.Range(E, aF, aP1, aP2);
BB.Degenerated(E, Standard_True);
BB.UpdateEdge(E, aTol);
aNewEdge=E;
}
//=======================================================================
// function: FillPaveSet
// purpose:
//=======================================================================
void BOPTools_DEProcessor::FillPaveSet (const Standard_Integer nED,
const Standard_Integer nVD,
const Standard_Integer nFD,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Boolean bIsDone, bXDir;
Standard_Integer nE, aNbPoints, j;
Standard_Real aTD1, aTD2, aT1, aT2, aTolInter, aX, aDT;
//
aDT=Precision::PConfusion();
//
BOPTools_PaveSet& aPaveSet= (myFiller->ChangePavePool()).ChangeValue(myDS->RefEdge(nED));
//
// Clear aPaveSet, aSplitEdges
aPaveSet.ChangeSet().Clear();
//
const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD));
//
// 2D Curve of degenerated edge on the face aDF
Handle(Geom2d_Curve) aC2DDE=BRep_Tool::CurveOnSurface(aDE, aDF, aTD1, aTD2);
//
// Choose direction for Degenerated Edge
gp_Pnt2d aP2d1, aP2d2;
aC2DDE->D0(aTD1, aP2d1);
aC2DDE->D0(aTD2, aP2d2);
bXDir=Standard_False;
if (fabs(aP2d1.Y()-aP2d2.Y()) < aDT){
bXDir=!bXDir;
}
//
// Prepare bounding Paves
BOPTools_Pave aPave1 (nVD, aTD1, BooleanOperations_UnknownInterference);
aPaveSet.Append(aPave1);
BOPTools_Pave aPave2 (nVD, aTD2, BooleanOperations_UnknownInterference);
aPaveSet.Append(aPave2);
//
// Fill other paves
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB=anIt.Value();
nE=aPB.Edge();
const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
Handle(Geom2d_Curve) aC2D=BRep_Tool::CurveOnSurface(aE, aDF, aT1, aT2);
//
// Intersection
aTolInter=0.001;
Geom2dAdaptor_Curve aGAC1, aGAC2;
aGAC1.Load(aC2DDE, aTD1, aTD2);
Handle(Geom2d_Line) aL2D= Handle(Geom2d_Line)::DownCast(aC2D);
if (!aL2D.IsNull()) {
aGAC2.Load(aC2D);
}
else {
aGAC2.Load(aC2D, aT1, aT2);
}
Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInter, aTolInter);
bIsDone=aGInter.IsDone();
if(bIsDone) {
aNbPoints=aGInter.NbPoints();
if (aNbPoints) {
for (j=1; j<=aNbPoints; ++j) {
gp_Pnt2d aP2D=aGInter.Point(j).Value();
//
aX=(bXDir) ? aP2D.X(): aP2D.Y();
//
if (fabs (aX-aTD1) < aDT || fabs (aX-aTD2) < aDT) {
continue;
}
if (aX < aTD1 || aX > aTD2) {
continue;
}
//
Standard_Boolean bRejectFlag=Standard_False;
const BOPTools_ListOfPave& aListOfPave=aPaveSet.Set();
BOPTools_ListIteratorOfListOfPave aPaveIt(aListOfPave);
for (; aPaveIt.More(); aPaveIt.Next()) {
const BOPTools_Pave& aPavex=aPaveIt.Value();
Standard_Real aXx=aPavex.Param();
if (fabs (aX-aXx) < aDT) {
bRejectFlag=Standard_True;
break;
}
}
if (bRejectFlag) {
continue;
}
//
BOPTools_Pave aPave(nVD, aX, BooleanOperations_UnknownInterference);
aPaveSet.Append(aPave);
}
}
}
}
}
//=======================================================================
// function: FindPaveBlocks
// purpose:
//=======================================================================
void BOPTools_DEProcessor::FindPaveBlocks(const Standard_Integer ,
const Standard_Integer nVD,
const Standard_Integer nFD,
BOPTools_ListOfPaveBlock& aLPBOut)
{
BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences();
BOPTools_ListIteratorOfListOfPaveBlock anIt;
Standard_Integer i, aNb, nF2, nSp, nV;
//ZZ const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED));
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
BOPTools_SSInterference& aFF=aFFs(i);
//
nF2=aFF.OppositeIndex(nFD);
if (!nF2) {
continue;
}
//
// Split Parts
const BOPTools_ListOfPaveBlock& aLPBSplits=aFF.PaveBlocks();
anIt.Initialize(aLPBSplits);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPBSp=anIt.Value();
nSp=aPBSp.Edge();
const BOPTools_Pave& aPave1=aPBSp.Pave1();
nV=aPave1.Index();
if (nV==nVD) {
aLPBOut.Append(aPBSp);
continue;
}
const BOPTools_Pave& aPave2=aPBSp.Pave2();
nV=aPave2.Index();
if (nV==nVD) {
aLPBOut.Append(aPBSp);
continue;
}
}
//
// Section Parts
Standard_Integer j, aNbCurves;
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
aNbCurves=aSC.Length();
for (j=1; j<=aNbCurves; j++) {
const BOPTools_Curve& aBC=aSC(j);
const BOPTools_ListOfPaveBlock& aLPBSe=aBC.NewPaveBlocks();
anIt.Initialize(aLPBSe);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPBSe=anIt.Value();
const BOPTools_Pave& aPv1=aPBSe.Pave1();
nV=aPv1.Index();
if (nV==nVD) {
aLPBOut.Append(aPBSe);
continue;
}
const BOPTools_Pave& aPv2=aPBSe.Pave2();
nV=aPv2.Index();
if (nV==nVD) {
aLPBOut.Append(aPBSe);
continue;
}
}
}
} // for (i=1; i<=aNb; i++) Next FF interference
}

View File

@@ -1,178 +0,0 @@
-- Created on: 2001-02-20
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class DSFiller from BOPTools
---Purpose:
--- class that provides
--- 1. creation of the data structure (DS)
--- 2. creation of the interferences' pool
--- 3. invokation of PaveFiller->Perform() to fill the DS
---
uses
Shape from TopoDS,
ShapesDataStructure from BooleanOperations,
PShapesDataStructure from BooleanOperations,
InterferencePool from BOPTools,
PInterferencePool from BOPTools,
PavePool from BOPTools,
PPaveFiller from BOPTools,
PaveFiller from BOPTools,
SSIntersectionAttribute from BOPTools,
SplitShapesPool from BOPTools,
CommonBlockPool from BOPTools,
DataMapOfIntegerListOfInteger from TColStd,
SetOfInteger from TColStd
is
Create
returns DSFiller from BOPTools;
---Purpose:
--- Empty constructor
---
Destroy (me:out);
---C++: alias ~
---Purpose: Destructor
---
SetShapes (me:out; aS1, aS2: Shape from TopoDS);
---Purpose:
--- Modifier
--- Sets the arguments of boolean operation
---
Shape1(me)
returns Shape from TopoDS;
---C++: return const&
---Purpose:
--- Selector
---
Shape2(me)
returns Shape from TopoDS;
---C++: return const&
---Purpose:
--- Selector
---
Perform (me:out);
---Purpose:
--- Performs the filling of the DS
---
InitFillersAndPools(me:out);
PartialPerform(me:out; anObjSubSet, aToolSubSet: SetOfInteger from TColStd);
ToCompletePerform(me:out);
Perform (me:out; theSectionAttribute: SSIntersectionAttribute from BOPTools);
---Purpose:
--- Performs the filling of the DS
---
DS (me)
returns ShapesDataStructure from BooleanOperations;
---C++: return const&
---Purpose:
--- Selector
---
InterfPool (me)
returns InterferencePool from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
PavePool (me)
returns PavePool from BOPTools;
---C++: return const&
---Purpose:
--- Selector
---
CommonBlockPool(me)
returns CommonBlockPool from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
SplitShapesPool(me)
returns SplitShapesPool from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
PaveFiller (me)
returns PaveFiller from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
Clear (me:out)
is private;
---Purpose:
--- Clear contents of the DS and the interferences' pool
---
IsNewFiller(me)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if new DS and the interferences' pool has been created
---
SetNewFiller(me;
aFlag:Boolean from Standard);
---Purpose:
--- Modifier
---
IsDone(me)
returns Boolean from Standard;
---Purpose:
--- Selector
---
SplitFacePool(me)
---C++: return const&
---C++: inline
returns DataMapOfIntegerListOfInteger from TColStd;
ChangeSplitFacePool(me: out)
---C++: return &
---C++: inline
returns DataMapOfIntegerListOfInteger from TColStd;
--modified by NIZHNY-MKK Tue Sep 7 12:03:34 2004
TreatCompound(myclass; theShape: Shape from TopoDS;
theShapeResult: out Shape from TopoDS)
returns Integer from Standard;
---Purpose: Finds sub-shapes of theShape having equal type
-- and store them in theShapeResult.
-- Returns the following status codes:
-- 0 - OK
-- 1 - Error: theShape is a COMPSOLID
-- 2 - Error: theShape is not a COMPOUND
-- 3 - Error: theShape contains shapes of COMPSOLID type
-- 4 - Error: Subshape of theShape have unkown type
-- 5 - Error: theShape contains shapes of different type
fields
myShape1 : Shape from TopoDS;
myShape2 : Shape from TopoDS;
myDS : PShapesDataStructure from BooleanOperations;
myInterfPool : PInterferencePool from BOPTools;
myPaveFiller : PPaveFiller from BOPTools;
myIsDone : Boolean from Standard;
mySplitFacePool: DataMapOfIntegerListOfInteger from TColStd;
myNewFiller : Boolean from Standard;
end DSFiller;

View File

@@ -1,696 +0,0 @@
// Created on: 2001-02-20
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_DSFiller.ixx>
#include <BOPTools_PaveFiller.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BOPTools_Tools3D.hxx>
static
void FillList(const TopoDS_Shape& aS,
Standard_Boolean& bCompSolidFound,
TopTools_ListOfShape& aResultList);
static
void BuildSolid(const TopTools_ListOfShape& aRL, TopoDS_Shape& aS);
static
void BuildShell(const TopTools_ListOfShape& aRL, TopoDS_Shape& aS);
static
void BuildWire (const TopTools_ListOfShape& aRL, TopoDS_Shape& aS);
static
TopAbs_ShapeEnum GetTypeCurrent(const TopAbs_ShapeEnum aTypeX);
// static
// Standard_Integer TreatCompound(const TopoDS_Shape& aS,
// TopoDS_Shape& aShapeResult);
// Peter KURNEV
// p-kurnev@opencascade.com
//=======================================================================
// function: BOPTools_PoolsFiller
// purpose:
//=======================================================================
BOPTools_DSFiller::BOPTools_DSFiller()
{
myPaveFiller=NULL;
myInterfPool=NULL;
myDS=NULL;
myNewFiller=Standard_True;
myIsDone=Standard_False;
}
//=======================================================================
// function: Clear
// purpose:
//=======================================================================
void BOPTools_DSFiller::Clear()
{
if (myPaveFiller!=NULL) {
delete myPaveFiller;
}
if (myInterfPool!=NULL) {
delete myInterfPool;
}
if (myDS!=NULL) {
delete myDS;
}
myPaveFiller=NULL;
myInterfPool=NULL;
myDS=NULL;
}
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void BOPTools_DSFiller::Perform()
{
myIsDone=Standard_False;
if (myShape1.IsNull() || myShape2.IsNull()) {
return;
}
//
// Clear contents of the DS if it was before
Clear();
//
myNewFiller=Standard_True;
//
myDS = new BooleanOperations_ShapesDataStructure (myShape1, myShape2);
myInterfPool= new BOPTools_InterferencePool (*myDS);
//
// Build Vertices, Paves, splits,
myPaveFiller = new BOPTools_PaveFiller(*myInterfPool);
myPaveFiller->Perform();
myIsDone=myPaveFiller->IsDone();
}
//=======================================================================
// function: InitFillersAndPools
// purpose:
//=======================================================================
void BOPTools_DSFiller::InitFillersAndPools()
{
myIsDone=Standard_False;
if (myShape1.IsNull() || myShape2.IsNull()) {
return;
}
//
// Clear contents of the DS if it was before
Clear();
//
myNewFiller=Standard_True;
//
myDS = new BooleanOperations_ShapesDataStructure (myShape1, myShape2);
myInterfPool= new BOPTools_InterferencePool (*myDS);
//
myPaveFiller = new BOPTools_PaveFiller(*myInterfPool);
}
//=======================================================================
// function: PartialPerform
// purpose:
//=======================================================================
void BOPTools_DSFiller::PartialPerform(const TColStd_SetOfInteger& anObjSubSet,
const TColStd_SetOfInteger& aToolSubSet)
{
myIsDone=Standard_False;
//
// Build Vertices, Paves, splits,
myPaveFiller->PartialPerform(anObjSubSet, aToolSubSet);
myIsDone=myPaveFiller->IsDone();
}
//=======================================================================
// function: ToCompletePerform
// purpose:
//=======================================================================
void BOPTools_DSFiller::ToCompletePerform()
{
if(myIsDone) {
myIsDone=Standard_False;
//
myPaveFiller->ToCompletePerform();
myIsDone=myPaveFiller->IsDone();
if(myIsDone) {
// Check if any interference exists
myIsDone=Standard_False;
Standard_Integer nbs = myDS->NumberOfNewShapes();
if(nbs > 0) {
myIsDone=Standard_True;
return;
}
}
}
}
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void BOPTools_DSFiller::Perform(const BOPTools_SSIntersectionAttribute& theSectionAttribute)
{
myIsDone=Standard_False;
if (myShape1.IsNull() || myShape2.IsNull()) {
return;
}
//
// Clear contents of the DS if it was before
Clear();
//
myNewFiller=Standard_True;
//
myDS = new BooleanOperations_ShapesDataStructure (myShape1, myShape2);
myInterfPool= new BOPTools_InterferencePool (*myDS);
//
// Build Vertices, Paves, splits,
myPaveFiller = new BOPTools_PaveFiller(*myInterfPool, theSectionAttribute);
myPaveFiller->Perform();
myIsDone=myPaveFiller->IsDone();
}
//=======================================================================
// function:Destroy
// purpose:
//=======================================================================
void BOPTools_DSFiller::Destroy()
{
Clear();
}
//=======================================================================
// function: SetShapes
// purpose:
//=======================================================================
void BOPTools_DSFiller::SetShapes (const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2)
{
myShape1=aS1;
myShape2=aS2;
//
Standard_Integer aNbShapes;
TopAbs_ShapeEnum aT1, aT2;
aT1=aS1.ShapeType();
aT2=aS2.ShapeType();
//
if (aT1==TopAbs_COMPOUND || aT2==TopAbs_COMPOUND) {
Standard_Boolean bIsEmptyShape1, bIsEmptyShape2;
bIsEmptyShape1=BOPTools_Tools3D::IsEmptyShape(myShape1);
bIsEmptyShape2=BOPTools_Tools3D::IsEmptyShape(myShape2);
if (bIsEmptyShape1 || bIsEmptyShape2) {
myIsDone=Standard_True;
return;
}
}
//
// 1.1
TopoDS_Iterator anIt;
TopoDS_Shape aSTmp;
if (aT1==TopAbs_COMPOUND || aT1==TopAbs_COMPSOLID) {
aNbShapes=0;
anIt.Initialize(aS1);
for (; anIt.More(); anIt.Next()) {
if (!aNbShapes) {
aSTmp=anIt.Value();
}
aNbShapes++;
if (aNbShapes>1) {
break;
}
}
//
if (aT1==TopAbs_COMPOUND) {
if (aNbShapes==1) {
TreatCompound(aS1, aSTmp);
myShape1=aSTmp;
aT1=myShape1.ShapeType();
}
else if (aNbShapes>1) {
TreatCompound(aS1, aSTmp);
myShape1=aSTmp;
aT1=myShape1.ShapeType();
}
}
}
//
if (aT1==TopAbs_COMPOUND || aT1==TopAbs_COMPSOLID) {
myIsDone=Standard_False;
return;
}
//
// 1.2 aS2
if (aT2==TopAbs_COMPOUND || aT2==TopAbs_COMPSOLID) {
aNbShapes=0;
anIt.Initialize(aS2);
for (; anIt.More(); anIt.Next()) {
if (!aNbShapes) {
aSTmp=anIt.Value();
}
aNbShapes++;
if (aNbShapes>1) {
break;
}
}
//
if (aT2==TopAbs_COMPOUND) {
if (aNbShapes==1) {
TreatCompound(aS2, aSTmp);
myShape2=aSTmp;
aT2=myShape2.ShapeType();
}
else if (aNbShapes>1) {
TreatCompound(aS2, aSTmp);
myShape2=aSTmp;
aT2=myShape2.ShapeType();
}
}
}
//
if (aT2==TopAbs_COMPOUND || aT2==TopAbs_COMPSOLID) {
myIsDone=Standard_False;
return;
}
//
// 2.1
BRep_Builder BB;
TopoDS_Shell aSh1, aSh2;
TopoDS_Wire aW1, aW2;
if (aT1==TopAbs_FACE) {
if (aT2==TopAbs_SOLID ||
aT2==TopAbs_SHELL ||
aT2==TopAbs_FACE ||
aT2==TopAbs_WIRE ||
aT2==TopAbs_EDGE) {
BB.MakeShell(aSh1);
BB.Add(aSh1, myShape1);
myShape1=aSh1;
aT1=TopAbs_SHELL;
}
}
//
// 2.2
if (aT2==TopAbs_FACE) {
if (aT1==TopAbs_SOLID ||
aT1==TopAbs_SHELL ||
aT1==TopAbs_WIRE ||
aT1==TopAbs_EDGE) {
BB.MakeShell(aSh2);
BB.Add(aSh2, myShape2);
myShape2=aSh2;
aT2=TopAbs_SHELL;
}
}
// 3.1
if (aT1==TopAbs_EDGE) {
if (aT2==TopAbs_SOLID ||
aT2==TopAbs_SHELL ||
aT2==TopAbs_WIRE ||
aT2==TopAbs_EDGE) {
BB.MakeWire (aW1);
BB.Add(aW1, myShape1);
myShape1=aW1;
aT1=TopAbs_WIRE;
}
}
// 3.2
if (aT2==TopAbs_EDGE) {
if (aT1==TopAbs_SOLID ||
aT1==TopAbs_SHELL ||
aT1==TopAbs_WIRE) {
BB.MakeWire (aW2);
BB.Add(aW2, myShape2);
myShape2=aW2;
aT2=TopAbs_WIRE;
}
}
myIsDone=Standard_True;
}
//=======================================================================
// function: Shape1
// purpose:
//=======================================================================
const TopoDS_Shape& BOPTools_DSFiller::Shape1 () const
{
return myShape1;
}
//=======================================================================
// function: Shape2
// purpose:
//=======================================================================
const TopoDS_Shape& BOPTools_DSFiller::Shape2 () const
{
return myShape2;
}
//=======================================================================
// function: DS
// purpose:
//=======================================================================
const BooleanOperations_ShapesDataStructure& BOPTools_DSFiller::DS () const
{
return *myDS;
}
//=======================================================================
// function: InterfPool
// purpose:
//=======================================================================
const BOPTools_InterferencePool& BOPTools_DSFiller::InterfPool () const
{
return *myInterfPool;
}
//=======================================================================
// function: PavePool
// purpose:
//=======================================================================
const BOPTools_PavePool& BOPTools_DSFiller::PavePool () const
{
return myPaveFiller->PavePool();
}
//=======================================================================
// function: CommonBlockPool
// purpose:
//=======================================================================
const BOPTools_CommonBlockPool& BOPTools_DSFiller::CommonBlockPool () const
{
return myPaveFiller->CommonBlockPool();
}
//=======================================================================
// function: SplitShapesPool
// purpose:
//=======================================================================
const BOPTools_SplitShapesPool& BOPTools_DSFiller::SplitShapesPool() const
{
return myPaveFiller->SplitShapesPool();
}
//=======================================================================
// function: PaveFiller
// purpose:
//=======================================================================
const BOPTools_PaveFiller& BOPTools_DSFiller::PaveFiller() const
{
return *myPaveFiller;
}
//=======================================================================
// function: IsNewFiller
// purpose:
//=======================================================================
Standard_Boolean BOPTools_DSFiller::IsNewFiller() const
{
return myNewFiller;
}
//=======================================================================
// function: SetNewFiller
// purpose:
//=======================================================================
void BOPTools_DSFiller::SetNewFiller(const Standard_Boolean aFlag) const
{
BOPTools_DSFiller* pDSFiller=(BOPTools_DSFiller*)this;
pDSFiller->myNewFiller=aFlag;
}
//=======================================================================
// function: IsDone
// purpose:
//=======================================================================
Standard_Boolean BOPTools_DSFiller::IsDone()const
{
return myIsDone;
}
//
//=======================================================================
//function :TreatCompound
//purpose :
//=======================================================================
// Standard_Integer TreatCompound(const TopoDS_Shape& aS,
// TopoDS_Shape& aShapeResult)
Standard_Integer BOPTools_DSFiller::TreatCompound(const TopoDS_Shape& aS,
TopoDS_Shape& aShapeResult)
{
//
TopAbs_ShapeEnum aType, aTypeX;
//
aType=aS.ShapeType();
//
if (aType==TopAbs_COMPSOLID) {
aShapeResult=aS;
return 1;
}
//
if (aType!=TopAbs_COMPOUND) {
// Nothing to do
aShapeResult=aS;
return 2;
}
//
// 1 Fill the list by real shapes (solids, shells, wires, edges)
Standard_Boolean bCompSolidFound=Standard_False;
TopTools_ListOfShape aRL1, aRL;
FillList (aS, bCompSolidFound, aRL1);
if (bCompSolidFound) {
aShapeResult=aS;
return 3;
}
// 2
// Analyse the list and find the type
Standard_Integer i=0;
TopExp_Explorer anExp;
TopAbs_ShapeEnum aTypeCurrent=TopAbs_SHAPE,
aType0=TopAbs_SHAPE;
//aTypeCurrent=TopAbs_SHAPE;
TopTools_ListIteratorOfListOfShape anItL(aRL1);
for (; anItL.More(); anItL.Next(), i++) {
const TopoDS_Shape& aSX=anItL.Value();
aTypeX=aSX.ShapeType();
aTypeCurrent=GetTypeCurrent(aTypeX);
if (i==0) {
aType0=aTypeCurrent;
if (aType0==TopAbs_SHAPE) {
// Unknown shape type;
aShapeResult=aS;
return 4;
}
}
else {
if (aTypeCurrent!=aType0) {
// Heterogenous types occured;
aShapeResult=aS;
return 5;
}
}
//
// Fill the RL
if (aTypeCurrent==TopAbs_SOLID) {
anExp.Init(aSX, TopAbs_SHELL);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aSY=anExp.Current();
aRL.Append(aSY);
}
}
//
else if (aTypeCurrent==TopAbs_SHELL) {
if (aTypeX==TopAbs_FACE) {
aRL.Append(aSX);
}
else {
anExp.Init(aSX, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aSY=anExp.Current();
aRL.Append(aSY);
}
}
}
//
else if (aTypeCurrent==TopAbs_WIRE) {
if (aTypeX==TopAbs_EDGE) {
aRL.Append(aSX);
}
else {
anExp.Init(aSX, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aSY=anExp.Current();
aRL.Append(aSY);
}
}
}
}
//
// Make Composite shape
//BRep_Builder aBB;
if (aType0==TopAbs_SOLID) {
BuildSolid(aRL, aShapeResult);
}
if (aType0==TopAbs_SHELL) {
BuildShell(aRL, aShapeResult);
}
if (aType0==TopAbs_WIRE) {
BuildWire(aRL, aShapeResult);
}
//OK
return 0;
}
//=======================================================================
//function : BuildSolid
//purpose :
//=======================================================================
void BuildSolid(const TopTools_ListOfShape& aRL,
TopoDS_Shape& aS)
{
BRep_Builder aBB;
TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid);
TopTools_ListIteratorOfListOfShape anItL;
anItL.Initialize(aRL);
for (; anItL.More(); anItL.Next()) {
const TopoDS_Shape& aSX=anItL.Value();
aBB.Add(aSolid, TopoDS::Shell(aSX));
}
aS=aSolid;
}
//=======================================================================
//function : BuildShell
//purpose :
//=======================================================================
void BuildShell(const TopTools_ListOfShape& aRL,
TopoDS_Shape& aS)
{
BRep_Builder aBB;
TopoDS_Shell aShell;
aBB.MakeShell(aShell);
TopTools_ListIteratorOfListOfShape anItL;
anItL.Initialize(aRL);
for (; anItL.More(); anItL.Next()) {
const TopoDS_Shape& aSX=anItL.Value();
aBB.Add(aShell, aSX);
}
aS=aShell;
}
//=======================================================================
//function : BuildWire
//purpose :
//=======================================================================
void BuildWire(const TopTools_ListOfShape& aRL,
TopoDS_Shape& aS)
{
BRep_Builder aBB;
TopoDS_Wire aWire;
aBB.MakeWire(aWire);
TopTools_ListIteratorOfListOfShape anItL;
anItL.Initialize(aRL);
for (; anItL.More(); anItL.Next()) {
const TopoDS_Shape& aSX=anItL.Value();
aBB.Add(aWire, aSX);
}
aS=aWire;
}
//=======================================================================
//function :FillList
//purpose :
//=======================================================================
void FillList(const TopoDS_Shape& aS,
Standard_Boolean& bCompSolidFound,
TopTools_ListOfShape& aResultList)
{
if (bCompSolidFound) {
return;
}
TopAbs_ShapeEnum aTypeX;
TopoDS_Iterator anIt;
anIt.Initialize(aS);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aSX=anIt.Value();
aTypeX=aSX.ShapeType();
//
if (aTypeX==TopAbs_COMPSOLID) {
bCompSolidFound=Standard_True;
return;
}
//
if (aTypeX==TopAbs_COMPOUND) {
FillList(aSX, bCompSolidFound, aResultList);
if (bCompSolidFound) {
return;
}
}
if (aTypeX!=TopAbs_COMPOUND) {
aResultList.Append(aSX);
}
}
}
//=======================================================================
//function :GetTypeCurrent
//purpose :
//=======================================================================
TopAbs_ShapeEnum GetTypeCurrent(const TopAbs_ShapeEnum aTypeX)
{
TopAbs_ShapeEnum aTypeCurrent=TopAbs_SHAPE;
if (aTypeX==TopAbs_SOLID) {
aTypeCurrent=TopAbs_SOLID;
}
if (aTypeX==TopAbs_SHELL || aTypeX==TopAbs_FACE ) {
aTypeCurrent=TopAbs_SHELL;
}
if (aTypeX==TopAbs_WIRE || aTypeX==TopAbs_EDGE ) {
aTypeCurrent=TopAbs_WIRE;
}
return aTypeCurrent;
}
//

View File

@@ -0,0 +1,35 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_DataMapOfShapeSet_HeaderFile
#define BOPTools_DataMapOfShapeSet_HeaderFile
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#define _NCollection_MapHasher
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, BOPTools_Set, TopTools_ShapeMapHasher> BOPTools_DataMapOfShapeSet;
typedef BOPTools_DataMapOfShapeSet::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeSet;
#undef _NCollection_MapHasher
#endif

View File

@@ -1,58 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class EEInterference from BOPTools
inherits ShapeShapeInterference from BOPTools
---Purpose:
-- class for storing an Edge/Edge
--- interference
---
uses
CommonPrt from IntTools
is
Create
returns EEInterference from BOPTools;
---Purpose:
--- Empty constructor
---
Create (anIndex1, anIndex2: Integer from Standard;
aCPart:CommonPrt from IntTools)
returns EEInterference from BOPTools;
---Purpose:
--- Constructor
--- anIndex1,
--- anIndex2 see BOPTools_ShapeShapeInterference for details
--- aCPart see IntTools_CommonPrt for details
---
CommonPrt(me)
returns CommonPrt from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
fields
myCommonPart: CommonPrt from IntTools;
end EEInterference;

View File

@@ -1,53 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_EEInterference.ixx>
//=======================================================================
//function : BOPTools_EEInterference
//purpose :
//=======================================================================
BOPTools_EEInterference::BOPTools_EEInterference()
:
BOPTools_ShapeShapeInterference(0,0)
{}
//=======================================================================
//function : BOPTools_ESInterference
//purpose :
//=======================================================================
BOPTools_EEInterference::BOPTools_EEInterference
(const Standard_Integer anIndex1,
const Standard_Integer anIndex2,
const IntTools_CommonPrt& aCPart)
:
BOPTools_ShapeShapeInterference(anIndex1,anIndex2)
{
myCommonPart=aCPart;
}
//=======================================================================
//function : CommonPrt
//purpose :
//=======================================================================
const IntTools_CommonPrt& BOPTools_EEInterference::CommonPrt() const
{
return myCommonPart;
}

View File

@@ -1,56 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ESInterference from BOPTools
inherits ShapeShapeInterference from BOPTools
---Purpose: class for storing an Edge/Face
--- interference
---
uses
CommonPrt from IntTools
is
Create
returns ESInterference from BOPTools;
---Purpose:
--- Empty constructor
---
Create (anIndex1: Integer from Standard;
anIndex2: Integer from Standard;
aCPart:CommonPrt from IntTools)
returns ESInterference from BOPTools;
---Purpose:
--- Constructor
--- anIndex1,
--- anIndex2 see BOPTools_ShapeShapeInterference for details
--- aCPart see IntTools_CommonPrt for details
---
CommonPrt(me)
returns CommonPrt from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
fields
myCommonPart: CommonPrt from IntTools;
end ESInterference;

View File

@@ -1,54 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_ESInterference.ixx>
//=======================================================================
//function : BOPTools_ESInterference
//purpose :
//=======================================================================
BOPTools_ESInterference::BOPTools_ESInterference()
:
BOPTools_ShapeShapeInterference(0,0)
{}
//=======================================================================
//function : BOPTools_ESInterference
//purpose :
//=======================================================================
BOPTools_ESInterference::BOPTools_ESInterference
(const Standard_Integer anIndex1,
const Standard_Integer anIndex2,
const IntTools_CommonPrt& aCPart)
:
BOPTools_ShapeShapeInterference(anIndex1,anIndex2)
{
myCommonPart=aCPart;
}
//=======================================================================
//function : CommonPrt
//purpose :
//=======================================================================
const IntTools_CommonPrt& BOPTools_ESInterference::CommonPrt() const
{
return myCommonPart;
}

View File

@@ -0,0 +1,80 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class EdgeSet from BOPTools
uses
Shape from TopoDS,
Edge from TopoDS,
ShapeEnum from TopAbs,
BaseAllocator from BOPCol,
MapOfShape from BOPCol,
ListOfShape from BOPCol
--raises
is
Create
returns EdgeSet from BOPTools;
---C++: alias "virtual ~BOPTools_EdgeSet();"
---C++: inline
Create (theAllocator: BaseAllocator from BOPCol)
returns EdgeSet from BOPTools;
---C++: inline
SetShape(me:out;
theS:Shape from TopoDS);
---C++: inline
Shape(me)
returns Shape from TopoDS;
---C++: return const &
---C++: inline
AddEdge(me:out;
theEdge:Edge from TopoDS);
---C++: inline
AddEdges(me:out;
theLS:ListOfShape from BOPCol);
AddEdges(me:out;
theFace:Shape from TopoDS);
---C++: inline
Clear(me:out);
---C++: inline
Get(me;
theLS:out ListOfShape from BOPCol);
---C++: inline
Contains(me;
theSet:EdgeSet from BOPTools)
returns Boolean from Standard;
---C++: inline
fields
myShape : Shape from TopoDS is protected;
myMap : MapOfShape from BOPCol is protected;
myEdges : ListOfShape from BOPCol is protected;
end EdgeSet;

View File

@@ -1,6 +1,5 @@
// Created on: 2004-06-11
// Created by: Mikhail KLOKOV
// Copyright (c) 2004-2012 OPEN CASCADE SAS
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,14 +17,4 @@
// and conditions governing the rights and limitations under the License.
inline const TColStd_DataMapOfIntegerListOfInteger& BOPTools_DSFiller::SplitFacePool() const
{
return mySplitFacePool;
}
inline TColStd_DataMapOfIntegerListOfInteger& BOPTools_DSFiller::ChangeSplitFacePool()
{
return mySplitFacePool;
}
#include <BOPTools_EdgeSet.ixx>

View File

@@ -1,6 +1,5 @@
// Created on: 2001-02-15
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -17,114 +16,132 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_CommonBlock.ixx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
// function: BOPTools_CommonBlock::BOPTools_CommonBlock
// purpose:
//function :
//purpose :
//=======================================================================
BOPTools_CommonBlock::BOPTools_CommonBlock()
:
myFace(0)
{}
//=======================================================================
// function: BOPTools_CommonBlock::BOPTools_CommonBlock
// purpose:
//=======================================================================
BOPTools_CommonBlock::BOPTools_CommonBlock(const BOPTools_PaveBlock& thePB1,
const BOPTools_PaveBlock& thePB2)
inline BOPTools_EdgeSet::BOPTools_EdgeSet()
{
myPB1=thePB1;
myPB2=thePB2;
myFace=0;
}
//=======================================================================
// function: BOPTools_CommonBlock::BOPTools_CommonBlock
// purpose:
//function :
//purpose :
//=======================================================================
BOPTools_CommonBlock::BOPTools_CommonBlock(const BOPTools_PaveBlock& thePB1,
const Standard_Integer aF)
inline BOPTools_EdgeSet::BOPTools_EdgeSet(const Handle(NCollection_BaseAllocator)& theObj)
:
myMap(100, theObj),
myEdges(theObj)
{
myPB1=thePB1;
myFace=aF;
}
//=======================================================================
// function: SetFace
// purpose:
//function : ~
//purpose :
//=======================================================================
void BOPTools_CommonBlock::SetFace(const Standard_Integer aF)
inline BOPTools_EdgeSet::~BOPTools_EdgeSet()
{
myFace=aF;
}
//=======================================================================
// function: SetPaveBlock1
// purpose:
//function : Clear
//purpose :
//=======================================================================
void BOPTools_CommonBlock::SetPaveBlock1(const BOPTools_PaveBlock& thePB1)
inline void BOPTools_EdgeSet::Clear()
{
myPB1=thePB1;
myMap.Clear();
myEdges.Clear();
}
//=======================================================================
// function: SetPaveBlock2
// purpose:
//function : SetShape
//purpose :
//=======================================================================
void BOPTools_CommonBlock::SetPaveBlock2(const BOPTools_PaveBlock& thePB2)
inline void BOPTools_EdgeSet::SetShape(const TopoDS_Shape& theShape)
{
myPB2=thePB2;
myShape=theShape;
}
//=======================================================================
// function: PaveBlock1
// purpose:
//function : Shape
//purpose :
//=======================================================================
const BOPTools_PaveBlock& BOPTools_CommonBlock::PaveBlock1() const
inline const TopoDS_Shape& BOPTools_EdgeSet::Shape()const
{
return myPB1;
return myShape;
}
//=======================================================================
// function: Face
// purpose:
//function : AddEdge
//purpose :
//=======================================================================
Standard_Integer BOPTools_CommonBlock::Face() const
inline void BOPTools_EdgeSet::AddEdge(const TopoDS_Edge& theEdge)
{
return myFace;
}
//=======================================================================
// function: PaveBlock1
// purpose:
//=======================================================================
BOPTools_PaveBlock& BOPTools_CommonBlock::PaveBlock1(const Standard_Integer anIndex)
{
Standard_Integer anOriginalEdge;
anOriginalEdge=myPB1.OriginalEdge();
if (anIndex==anOriginalEdge) {
return myPB1;
if (!BRep_Tool::Degenerated(theEdge)){
myEdges.Append(theEdge);
myMap.Add(theEdge);
}
return myPB2;
}
//=======================================================================
// function: PaveBlock2
// purpose:
//function : AddEdges
//purpose :
//=======================================================================
const BOPTools_PaveBlock& BOPTools_CommonBlock::PaveBlock2() const
inline void BOPTools_EdgeSet::AddEdges(const BOPCol_ListOfShape& theLS)
{
return myPB2;
}
//=======================================================================
// function: PaveBlock2
// purpose:
//=======================================================================
BOPTools_PaveBlock& BOPTools_CommonBlock::PaveBlock2(const Standard_Integer anIndex)
{
Standard_Integer anOriginalEdge;
anOriginalEdge=myPB1.OriginalEdge();
if (anIndex==anOriginalEdge) {
return myPB2;
BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(theLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aIt.Value());
AddEdge(aE);
}
return myPB1;
}
//=======================================================================
//function : AddEdges
//purpose :
//=======================================================================
inline void BOPTools_EdgeSet::AddEdges(const TopoDS_Shape& theFace)
{
TopExp_Explorer aExp(theFace, TopAbs_EDGE);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aExp.Current());
AddEdge(aE);
}
}
//=======================================================================
//function : Get
//purpose :
//=======================================================================
inline void BOPTools_EdgeSet::Get(BOPCol_ListOfShape& theLS)const
{
BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myEdges);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
theLS.Append(aS);
}
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
inline Standard_Boolean BOPTools_EdgeSet::Contains(const BOPTools_EdgeSet& theOther)const
{
Standard_Integer aNbEOther, aNbE;
Standard_Boolean bRet;
BOPCol_ListIteratorOfListOfShape aIt;
//
aNbE=0;
aNbEOther=theOther.myEdges.Extent();
aIt.Initialize(theOther.myEdges);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
bRet=myMap.Contains(aS);
if (!bRet) {
return bRet;
}
++aNbE;
}
bRet=(aNbE==aNbEOther);
//
return bRet;
}

View File

@@ -1,83 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Interference from BOPTools
---Purpose: class for storing information about an interference
--- that takes place between given shape and shape
--- with DS-index =aWith
uses
KindOfInterference from BooleanOperations
is
Create
returns Interference from BOPTools;
---Purpose:
--- Empty constructor
---
Create (aWith :Integer from Standard;
aType :KindOfInterference from BooleanOperations;
anIndex :Integer from Standard)
returns Interference from BOPTools;
---Purpose: constructor
--- aWith - DS-index for the opposite shape
--- aType - the type of the interference
--- anIndex- the index of the result in corresponding
--- interference table (if the result is computed
--- but there is no result -> anIndex=0)
---
SetWith (me:out; aWith :Integer from Standard);
---Purpose:
--- Modifier
---
SetType (me:out; aType : KindOfInterference from BooleanOperations);
---Purpose:
--- Modifier
---
SetIndex (me:out; anIndex :Integer from Standard);
---Purpose:
--- Modifier
---
With (me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Type (me)
returns KindOfInterference from BooleanOperations;
---Purpose:
--- Selector
---
Index (me)
returns Integer from Standard;
---Purpose:
--- Selector
---
fields
myWith : Integer from Standard;
myType : KindOfInterference from BooleanOperations;
myIndex : Integer from Standard; --< index in corresp.interference table
end Interference;

View File

@@ -1,100 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Interference.ixx>
//=======================================================================
//function : BOPTools_Interference::BOPTools_Interference
//purpose :
//=======================================================================
BOPTools_Interference::BOPTools_Interference()
:
myWith(0),
myType(BooleanOperations_UnknownInterference),
myIndex(0)
{
}
//=======================================================================
//function : BOPTools_Interference::BOPTools_Interference
//purpose :
//=======================================================================
BOPTools_Interference::BOPTools_Interference(const Standard_Integer aWith,
const BooleanOperations_KindOfInterference aType,
const Standard_Integer anIndex)
:
myWith(aWith),
myType(aType),
myIndex(anIndex)
{
}
//=======================================================================
//function : SetWith
//purpose :
//=======================================================================
void BOPTools_Interference::SetWith(const Standard_Integer aWith)
{
myWith=aWith;
}
//=======================================================================
//function : SetType
//purpose :
//=======================================================================
void BOPTools_Interference::SetType(const BooleanOperations_KindOfInterference aType)
{
myType=aType;
}
//=======================================================================
//function : SetIndex
//purpose :
//=======================================================================
void BOPTools_Interference::SetIndex(const Standard_Integer anIndex)
{
myIndex=anIndex;
}
//=======================================================================
//function : With
//purpose :
//=======================================================================
Standard_Integer BOPTools_Interference::With() const
{
return myWith;
}
//=======================================================================
//function : Type
//purpose :
//=======================================================================
BooleanOperations_KindOfInterference BOPTools_Interference::Type() const
{
return myType;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer BOPTools_Interference::Index() const
{
return myIndex;
}

View File

@@ -1,103 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class InterferenceLine from BOPTools
---Purpose: class for storing information about all
--- interferences for given shape.
--- So, for each shape in the DS, we will have
--- the following interference list
--- (i1, t1, r1), (i2, t2, r2),...(iN, tN, rN),
--- where
--- (iN, tN, rN) - object of type BOPTools_Interference
--- The class BOPTools_InterferenceLine is dedicated
--- to provide convinient tools to manage this info.
---
uses
KindOfInterference from BooleanOperations,
ListOfInterference from BOPTools,
Interference from BOPTools
is
Create
returns InterferenceLine from BOPTools;
---Purpose:
--- Empty constructor
---
GetOnType(me;
aType :KindOfInterference from BooleanOperations)
returns ListOfInterference from BOPTools;
---C++: return const &
---Purpose:
--- Returns info. list for interferences of given type
---
IsComputed(me;
aWith :Integer from Standard;
aType :KindOfInterference from BooleanOperations)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the interference of type <aType>
--- with the shape <aWith> has already been computed.
---
AddInterference (me:out;
anInterference :Interference from BOPTools);
---Purpose:
--- Adds info. about the Interference to the list
---
AddInterference (me:out;
aWith :Integer from Standard;
aType :KindOfInterference from BooleanOperations;
anIndex:Integer from Standard);
---Purpose:
--- Adds info. about the Interference to the list
---
List(me)
returns ListOfInterference from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
RealList(me)
returns ListOfInterference from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
HasInterference(me)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the list contains at least one interference
--- with non-empty result
---
fields
myList : ListOfInterference from BOPTools;
mySSList : ListOfInterference from BOPTools;
myESList : ListOfInterference from BOPTools;
myVSList : ListOfInterference from BOPTools;
myEEList : ListOfInterference from BOPTools;
myVEList : ListOfInterference from BOPTools;
myVVList : ListOfInterference from BOPTools;
myEmptyList : ListOfInterference from BOPTools;
end InterferenceLine;

View File

@@ -1,222 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_InterferenceLine.ixx>
#include <BOPTools_ListIteratorOfListOfInterference.hxx>
//=======================================================================
//function : BOPTools_InterferenceLine::BOPTools_InterferenceLine
//purpose :
//=======================================================================
BOPTools_InterferenceLine::BOPTools_InterferenceLine() {}
//=======================================================================
//function : RealList
//purpose :
//=======================================================================
const BOPTools_ListOfInterference& BOPTools_InterferenceLine::RealList() const
{
Standard_Integer anInd;
List();
BOPTools_ListOfInterference aTmpList;
BOPTools_ListIteratorOfListOfInterference anIt;
anIt.Initialize(myList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
aTmpList.Append(anInterference);
}
//
BOPTools_ListOfInterference* pList=(BOPTools_ListOfInterference*)&myList;
pList->Clear();
//
anIt.Initialize(aTmpList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
anInd=anInterference.Index();
if (anInd) {
pList->Append(anInterference);
}
}
return myList;
}
//=======================================================================
//function : List
//purpose :
//=======================================================================
const BOPTools_ListOfInterference& BOPTools_InterferenceLine::List () const
{
BOPTools_ListOfInterference* pList=(BOPTools_ListOfInterference*)&myList;
pList->Clear();
BOPTools_ListIteratorOfListOfInterference anIt;
anIt.Initialize(mySSList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
anIt.Initialize(myESList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
anIt.Initialize(myVSList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
anIt.Initialize(myEEList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
anIt.Initialize(myVEList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
anIt.Initialize(myVVList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
pList->Append(anInterference);
}
return myList;
}
//=======================================================================
//function : GetOnType
//purpose :
//=======================================================================
const BOPTools_ListOfInterference& BOPTools_InterferenceLine::GetOnType
(const BooleanOperations_KindOfInterference theType) const
{
switch (theType) {
case BooleanOperations_SurfaceSurface:
return mySSList;
case BooleanOperations_EdgeSurface:
return myESList;
case BooleanOperations_VertexSurface:
return myVSList;
case BooleanOperations_EdgeEdge:
return myEEList;
case BooleanOperations_VertexEdge:
return myVEList;
case BooleanOperations_VertexVertex:
return myVVList;
default:
return myEmptyList;
}
}
//=======================================================================
//function : HasInterference
//purpose :
//=======================================================================
Standard_Boolean BOPTools_InterferenceLine::HasInterference () const
{
Standard_Integer anInd;
Standard_Boolean bFlag=Standard_False;
BOPTools_ListIteratorOfListOfInterference anIt;
//
List();
//
anIt.Initialize(myList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
anInd=anInterference.Index();
if (anInd) {
return !bFlag;
}
}
return bFlag;
}
//=======================================================================
//function : IsComputed
//purpose :
//=======================================================================
Standard_Boolean BOPTools_InterferenceLine::IsComputed
(const Standard_Integer theWith,
const BooleanOperations_KindOfInterference theType)const
{
BooleanOperations_KindOfInterference aType;
Standard_Integer aWith, anInd;
const BOPTools_ListOfInterference& aList=GetOnType(theType);
BOPTools_ListIteratorOfListOfInterference anIt(aList);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
aType=anInterference.Type();
aWith=anInterference.With();
//
anInd=anInterference.Index();
//
if ((aType==theType && aWith==theWith) && anInd) {
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : AddInterference
//purpose :
//=======================================================================
void BOPTools_InterferenceLine::AddInterference(const BOPTools_Interference& anInterference)
{
Standard_Integer aWith, anInd;
BooleanOperations_KindOfInterference aType;
aWith=anInterference.With();
aType=anInterference.Type();
anInd=anInterference.Index();
AddInterference(aWith, aType, anInd);
}
//=======================================================================
//function : AddInterference
//purpose :
//=======================================================================
void BOPTools_InterferenceLine::AddInterference(const Standard_Integer aWith,
const BooleanOperations_KindOfInterference aType,
const Standard_Integer anIndex)
{
BOPTools_Interference anInterference(aWith, aType, anIndex);
const BOPTools_ListOfInterference& aList=GetOnType(aType);
BOPTools_ListOfInterference* pList=(BOPTools_ListOfInterference*) &aList;
pList->Append(anInterference);
}

View File

@@ -1,186 +0,0 @@
-- Created on: 2001-01-26
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class InterferencePool from BOPTools
---Purpose:
-- Class for storing information about
--- results of all interferences for all shapes
uses
ShapesDataStructure from BooleanOperations,
PShapesDataStructure from BooleanOperations,
KindOfInterference from BooleanOperations,
CArray1OfInterferenceLine from BOPTools,
CArray1OfSSInterference from BOPTools,
CArray1OfESInterference from BOPTools,
CArray1OfVSInterference from BOPTools,
CArray1OfEEInterference from BOPTools,
CArray1OfVEInterference from BOPTools,
CArray1OfVVInterference from BOPTools,
PShapeShapeInterference from BOPTools
is
Create
returns InterferencePool from BOPTools ;
---Purpose:
--- Empty constructor
---
Create (aDS:ShapesDataStructure from BooleanOperations)
returns InterferencePool from BOPTools ;
---Purpose:
--- Constructor
---
SetDS (me:out;aDS:ShapesDataStructure from BooleanOperations);
---Purpose:
--- Modifier
---
DS(me)
returns PShapesDataStructure from BooleanOperations;
---Purpose:
--- Selector
---
HasInterference (me;
anInd :Integer from Standard)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the shape with DS_index <anInd>
--- has at least one interference with non-empty result
---
IsComputed (me;
anInd1 : Integer from Standard;
anInd2 : Integer from Standard)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the interference between shapes
--- <anInd1> and <anInd2> has already been computed.
---
SortTypes (me;
anInd1:in out Integer from Standard;
anInd2:in out Integer from Standard);
---Purpose:
--- Sorts types of shapes <anInd1> and <anInd2> in increasing order
---
InterferenceType (me;
anInd1: Integer from Standard;
anInd2: Integer from Standard)
returns KindOfInterference from BooleanOperations;
---Purpose:
--- Gets the type of interference in accordance with the types of
--- shapes <anInd1> and <anInd2>
---
AddInterference (me:out;
anInd1: Integer from Standard;
anInd2: Integer from Standard;
aType: KindOfInterference from BooleanOperations;
anIndex: Integer from Standard);
---Purpose:
--- Adds the info about interference in InterferenceLine-s for
--- shapes <anInd1> and <anInd2>
---
InterferenceTable (me)
returns CArray1OfInterferenceLine from BOPTools;
---C++: return const&
---Purpose:
--- Returns the reference to complete array of interference line-s
---
SSInterferences (me:out)
returns CArray1OfSSInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to array Of F/F interferences
---
ESInterferences (me:out)
returns CArray1OfESInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to array Of E/F interferences
---
VSInterferences (me:out)
returns CArray1OfVSInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to array Of V/F interferences
---
EEInterferences (me:out)
returns CArray1OfEEInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to arrray Of E/E interferences
---
VEInterferences (me:out)
returns CArray1OfVEInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to arrray Of V/E interferences
---
VVInterferences (me:out)
returns CArray1OfVVInterference from BOPTools;
---C++: return &
---Purpose:
--- Returns the reference to arrray Of V/V interferences
---
--------------
SSInterfs (me)
returns CArray1OfSSInterference from BOPTools;
---C++: return const &
ESInterfs (me)
returns CArray1OfESInterference from BOPTools;
---C++: return const &
VSInterfs (me)
returns CArray1OfVSInterference from BOPTools;
---C++: return const &
EEInterfs (me)
returns CArray1OfEEInterference from BOPTools;
---C++: return const &
VEInterfs (me)
returns CArray1OfVEInterference from BOPTools;
---C++: return const &
VVInterfs (me)
returns CArray1OfVVInterference from BOPTools;
---C++: return const &
GetInterference (me;
anIndex: Integer from Standard;
aType : KindOfInterference from BooleanOperations)
returns PShapeShapeInterference from BOPTools;
fields
myDS : PShapesDataStructure from BooleanOperations;
myNbSourceShapes : Integer from Standard;
myInterferenceTable: CArray1OfInterferenceLine from BOPTools;
mySSInterferences : CArray1OfSSInterference from BOPTools;
myESInterferences : CArray1OfESInterference from BOPTools;
myVSInterferences : CArray1OfVSInterference from BOPTools;
myEEInterferences : CArray1OfEEInterference from BOPTools;
myVEInterferences : CArray1OfVEInterference from BOPTools;
myVVInterferences : CArray1OfVVInterference from BOPTools;
end InterferencePool;

View File

@@ -1,377 +0,0 @@
// Created on: 2001-01-26
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_InterferencePool.ixx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_CommonPrt.hxx>
#include <BOPTools_VEInterference.hxx>
#include <BOPTools_VVInterference.hxx>
#include <BOPTools_VSInterference.hxx>
#include <BOPTools_EEInterference.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_InterferenceLine.hxx>
#include <IntTools_EdgeFace.hxx>
#include <BOPTools_ESInterference.hxx>
//=======================================================================
//function : BOPTools_InterferencePool
//purpose :
//=======================================================================
BOPTools_InterferencePool::BOPTools_InterferencePool()
{
myDS=NULL;
myNbSourceShapes=0;
}
//=======================================================================
//function : BOPTools_InterferencePool
//purpose :
//=======================================================================
BOPTools_InterferencePool::BOPTools_InterferencePool (const BooleanOperations_ShapesDataStructure& aDS)
{
SetDS(aDS);
}
//=======================================================================
//function : SetDS
//purpose :
//=======================================================================
void BOPTools_InterferencePool::SetDS(const BooleanOperations_ShapesDataStructure& aDS)
{
void* p=(void*) &aDS;
myDS=(BooleanOperations_ShapesDataStructure*) p;
myNbSourceShapes= myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool();
myInterferenceTable.Resize (myNbSourceShapes);
}
//=======================================================================
//function : DS
//purpose :
//=======================================================================
BooleanOperations_PShapesDataStructure BOPTools_InterferencePool::DS() const
{
return myDS;
}
//=======================================================================
//function : HasInterference
//purpose :
//=======================================================================
Standard_Boolean BOPTools_InterferencePool::HasInterference(const Standard_Integer anInd1)const
{
const BOPTools_InterferenceLine& aWhatLine=myInterferenceTable(anInd1);
Standard_Boolean bFlag=aWhatLine.HasInterference();
return bFlag;
}
//=======================================================================
//function : IsComputed
//purpose :
//=======================================================================
Standard_Boolean BOPTools_InterferencePool::IsComputed(const Standard_Integer anInd1,
const Standard_Integer anInd2) const
{
BooleanOperations_KindOfInterference theType;
theType=InterferenceType(anInd1, anInd2);
if (theType==BooleanOperations_UnknownInterference) {
return Standard_False;
}
const BOPTools_InterferenceLine& aWhatLine=myInterferenceTable(anInd1);
Standard_Boolean aFlag=aWhatLine.IsComputed(anInd2, theType);
return aFlag;
}
//===========================================================================
//function : AddInterference
//purpose :
//===========================================================================
void BOPTools_InterferencePool::AddInterference (const Standard_Integer theWhat,
const Standard_Integer theWith,
const BooleanOperations_KindOfInterference theType,
const Standard_Integer theIndexOfInterference)
{
BOPTools_InterferenceLine& aWhatLine=myInterferenceTable(theWhat);
aWhatLine.AddInterference(theWith, theType, theIndexOfInterference);
BOPTools_InterferenceLine& aWithLine=myInterferenceTable(theWith);
aWithLine.AddInterference(theWhat, theType, theIndexOfInterference);
}
//=======================================================================
//function : InterferenceType
//purpose :
//=======================================================================
BooleanOperations_KindOfInterference
BOPTools_InterferencePool::InterferenceType(const Standard_Integer theWhat,
const Standard_Integer theWith) const
{
BooleanOperations_KindOfInterference theType;
Standard_Integer aWhat, aWith;
TopAbs_ShapeEnum aType1, aType2;
aWhat=theWhat;
aWith=theWith;
SortTypes(aWhat, aWith);
aType1= myDS->GetShapeType(aWhat),
aType2= myDS->GetShapeType(aWith);
if (aType1==TopAbs_VERTEX && aType2==TopAbs_VERTEX) {
theType=BooleanOperations_VertexVertex;
}
else if (aType1==TopAbs_VERTEX && aType2==TopAbs_EDGE) {
theType=BooleanOperations_VertexEdge;
}
else if (aType1==TopAbs_VERTEX && aType2==TopAbs_FACE) {
theType=BooleanOperations_VertexSurface;
}
else if (aType1==TopAbs_EDGE && aType2==TopAbs_EDGE) {
theType=BooleanOperations_EdgeEdge;
}
else if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) {
theType=BooleanOperations_EdgeSurface;
}
else if (aType1==TopAbs_FACE && aType2==TopAbs_FACE) {
theType=BooleanOperations_SurfaceSurface;
}
else {
theType=BooleanOperations_UnknownInterference;
}
return theType;
}
//=======================================================================
//function : SortTypes
//purpose :
//=======================================================================
void BOPTools_InterferencePool::SortTypes(Standard_Integer& theWhat,
Standard_Integer& theWith) const
{
Standard_Boolean aReverseFlag=Standard_True;
TopAbs_ShapeEnum aType1= myDS->GetShapeType(theWhat),
aType2= myDS->GetShapeType(theWith);
if (aType1==aType2)
return;
if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE){
aReverseFlag=Standard_False;
}
if (aType1==TopAbs_VERTEX &&
(aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) {
aReverseFlag=Standard_False;
}
Standard_Integer aWhat, aWith;
aWhat=(aReverseFlag) ? theWith : theWhat;
aWith=(aReverseFlag) ? theWhat : theWith;
theWhat=aWhat;
theWith=aWith;
}
//===========================================================================
//function : InterferenceTable
//purpose :
//===========================================================================
const BOPTools_CArray1OfInterferenceLine&
BOPTools_InterferencePool::InterferenceTable()const
{
return myInterferenceTable;
}
//===========================================================================
//function : SSInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfSSInterference& BOPTools_InterferencePool::SSInterferences()
{
return mySSInterferences;
}
//===========================================================================
//function : ESInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfESInterference& BOPTools_InterferencePool::ESInterferences()
{
return myESInterferences;
}
//===========================================================================
//function : VSInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfVSInterference& BOPTools_InterferencePool::VSInterferences()
{
return myVSInterferences;
}
//===========================================================================
//function : EEInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfEEInterference& BOPTools_InterferencePool::EEInterferences()
{
return myEEInterferences;
}
//===========================================================================
//function : VEInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfVEInterference& BOPTools_InterferencePool::VEInterferences()
{
return myVEInterferences;
}
//===========================================================================
//function : VVInterferences
//purpose :
//===========================================================================
BOPTools_CArray1OfVVInterference& BOPTools_InterferencePool::VVInterferences()
{
return myVVInterferences;
}
////////////////////////
//===========================================================================
//function : SSInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfSSInterference& BOPTools_InterferencePool::SSInterfs()const
{
return mySSInterferences;
}
//===========================================================================
//function : ESInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfESInterference& BOPTools_InterferencePool::ESInterfs()const
{
return myESInterferences;
}
//===========================================================================
//function : VSInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfVSInterference& BOPTools_InterferencePool::VSInterfs()const
{
return myVSInterferences;
}
//===========================================================================
//function : EEInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfEEInterference& BOPTools_InterferencePool::EEInterfs()const
{
return myEEInterferences;
}
//===========================================================================
//function : VEInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfVEInterference& BOPTools_InterferencePool::VEInterfs()const
{
return myVEInterferences;
}
//===========================================================================
//function : VVInterfs
//purpose :
//===========================================================================
const BOPTools_CArray1OfVVInterference& BOPTools_InterferencePool::VVInterfs()const
{
return myVVInterferences;
}
//===========================================================================
//function : GetInterference
//purpose :
//===========================================================================
BOPTools_PShapeShapeInterference
BOPTools_InterferencePool::GetInterference(const Standard_Integer anIndex,
const BooleanOperations_KindOfInterference aType)const
{
Standard_Integer aNb;
BOPTools_PShapeShapeInterference pI=NULL;
switch (aType) {
//
case BooleanOperations_SurfaceSurface:
aNb=mySSInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&mySSInterferences(anIndex);
}
break;
//
case BooleanOperations_EdgeSurface:
aNb=myESInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&myESInterferences(anIndex);
}
break;
//
case BooleanOperations_VertexSurface:
aNb=myVSInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&myVSInterferences(anIndex);
}
break;
//
case BooleanOperations_EdgeEdge:
aNb=myEEInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&myEEInterferences(anIndex);
}
break;
//
case BooleanOperations_VertexEdge:
aNb=myVEInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&myVEInterferences(anIndex);
}
break;
//
case BooleanOperations_VertexVertex:
aNb=myVVInterferences.Extent();
if (anIndex > 0 && anIndex <= aNb) {
pI=(BOPTools_PShapeShapeInterference)&myVVInterferences(anIndex);
}
break;
//
case BooleanOperations_UnknownInterference:
default:
break;
}
return pI;
}

View File

@@ -1,160 +0,0 @@
-- Created on: 2000-11-27
-- Created by: Michael KLOKOV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class IteratorOfCoupleOfShape from BOPTools
---Purpose: The class IteratorOfCoupleOfShape provides the iteration
--- on the couples of shapes stored in ShapesDataStructure
--- according to the given types of shapes and
--- status of their intersection.
--- The statuses are stored in 2 dimension array.
uses
ShapeEnum from TopAbs,
HArray2OfIntersectionStatus from BOPTools,
PShapesDataStructure from BooleanOperations,
IntersectionStatus from BOPTools,
ListOfCoupleOfInteger from BOPTools,
ListIteratorOfListOfCoupleOfInteger from BOPTools,
NoSuchObject from Standard
raises NoSuchObject from Standard
is
Create
returns IteratorOfCoupleOfShape from BOPTools;
---Purpose:
--- Empty Constructor
---
Create(PDS: PShapesDataStructure from BooleanOperations;
Type1: ShapeEnum from TopAbs;
Type2: ShapeEnum from TopAbs)
returns IteratorOfCoupleOfShape from BOPTools;
---Purpose:
--- Initializes iterator by ShapesDataStructure and
--- shape types
---
Destroy(me: in out) is virtual;
---C++: alias "Standard_EXPORT virtual ~BOPTools_IteratorOfCoupleOfShape(){Destroy();}"
Initialize(me: in out; Type1: ShapeEnum from TopAbs;
Type2: ShapeEnum from TopAbs)
raises NoSuchObject from Standard
is virtual;
---Purpose:
--- Initializes iterator with shape types.
--- The iterator uses PDS assigned in constructor or in SetDataStructure().
--- Raises the exception if myPDS is null.
---
SetDataStructure(me: in out; PDS: PShapesDataStructure from BooleanOperations)
raises
NoSuchObject from Standard;
---Purpose:
--- Initialize iterator with ShapeDataStructure.
---
More(me)
returns Boolean from Standard
is virtual;
---Purpose:
--- Returns True if there are still not
--- treated couples of shapes
---
Next(me: in out)
is virtual;
---Purpose:
--- Moves to the next couple of iteration
---
Current(me; Index1: in out Integer from Standard;
Index2: in out Integer from Standard;
WithSubShape: out Boolean from Standard)
is virtual;
---Purpose:
--- Returns current couple of indices and
--- flag WithSubShape which is true
--- if bounding boxes of subshapes
--- are intersected
---
ListOfCouple(me)
returns ListOfCoupleOfInteger from BOPTools;
---C++: return const &
---Purpose:
--- Returns a list of couples of shape indices
--- according to shape types by which
--- the iterator was initialized
---
MoreP(me)
returns Boolean from Standard
is protected;
NextP(me: in out)
is protected;
CurrentP(me;Index1: in out Integer from Standard;
Index2: in out Integer from Standard)
raises NoSuchObject from Standard
is protected;
SetIntersectionStatus(me: in out; Index1: Integer from Standard;
Index2: Integer from Standard;
theStatus: IntersectionStatus from BOPTools);
---Purpose:
--- Sets status to array according to Index1 and Index2
---
GetTableOfIntersectionStatus(me)
returns HArray2OfIntersectionStatus from BOPTools;
---C++: return const &
---Purpose:
--- Returns 2 dimension array of intersection statuses
---
DumpTableOfIntersectionStatus(me);
---Purpose:
--- For internal use
---
fields
myPDS: PShapesDataStructure from BooleanOperations is protected;
myTableOfStatus: HArray2OfIntersectionStatus from BOPTools is protected;
myCurrentIndex1: Integer from Standard is protected;
myCurrentIndex2: Integer from Standard is protected;
myType1: ShapeEnum from TopAbs is protected;
myType2: ShapeEnum from TopAbs is protected;
--
myFirstLowerIndex :Integer from Standard is protected;
myFirstUpperIndex :Integer from Standard is protected;
mySecondLowerIndex:Integer from Standard is protected;
mySecondUpperIndex:Integer from Standard is protected;
myListOfCouple :ListOfCoupleOfInteger from BOPTools is protected;
myIterator :ListIteratorOfListOfCoupleOfInteger from BOPTools is protected;
--
end IteratorOfCoupleOfShape from BOPTools;

View File

@@ -1,296 +0,0 @@
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_IteratorOfCoupleOfShape.ixx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_RoughShapeIntersector.hxx>
#include <BOPTools_CoupleOfInteger.hxx>
// ================================================================================================
// function: Constructor
// ================================================================================================
BOPTools_IteratorOfCoupleOfShape::BOPTools_IteratorOfCoupleOfShape()
:
myCurrentIndex1(-1),
myCurrentIndex2(-1),
myType1(TopAbs_SHAPE),
myType2(TopAbs_SHAPE),
myFirstLowerIndex(1),
myFirstUpperIndex(0),
mySecondLowerIndex(1),
mySecondUpperIndex(0)
{
myPDS = NULL;
}
// ================================================================================================
// function: Constructor
// ================================================================================================
BOPTools_IteratorOfCoupleOfShape::BOPTools_IteratorOfCoupleOfShape(const BooleanOperations_PShapesDataStructure& PDS,
const TopAbs_ShapeEnum Type1,
const TopAbs_ShapeEnum Type2)
:
myCurrentIndex1(-1),
myCurrentIndex2(-1),
myType1(TopAbs_SHAPE),
myType2(TopAbs_SHAPE)
{
SetDataStructure(PDS);
Initialize(Type1, Type2);
}
// ================================================================================================
// function: virtual destructor
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::Destroy()
{
}
// ================================================================================================
// function: SetDataStructure
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::SetDataStructure(const BooleanOperations_PShapesDataStructure& PDS)
{
if(PDS==NULL) {
Standard_NoSuchObject::Raise("BOPTools_IteratorOfCoupleOfShape::SetDataStructure: PDS==NULL");
}
myListOfCouple.Clear();
myPDS = PDS;
BOPTools_RoughShapeIntersector aRoughIntersector(myPDS);
aRoughIntersector.Perform();
if(aRoughIntersector.IsDone()) {
myTableOfStatus = aRoughIntersector.TableOfStatus();
} else {
Handle(BOPTools_HArray2OfIntersectionStatus) anemptyhandle;
myTableOfStatus = anemptyhandle;
}
}
// ================================================================================================
// function: Initialize
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::Initialize(const TopAbs_ShapeEnum Type1,
const TopAbs_ShapeEnum Type2)
{
if(myPDS==NULL) {
Standard_NoSuchObject::Raise("BOPTools_IteratorOfCoupleOfShape::Initialize: myPDS==NULL");
}
myType1 = Type1;
myType2 = Type2;
myCurrentIndex1 = -1;
myCurrentIndex2 = -1;
//
myFirstLowerIndex=1;
myFirstUpperIndex=myPDS->NumberOfShapesOfTheObject();
mySecondLowerIndex=myFirstUpperIndex+1;
mySecondUpperIndex=myFirstUpperIndex+myPDS->NumberOfShapesOfTheTool();
NextP();
Standard_Integer n1, n2;
myListOfCouple.Clear();
for (; MoreP(); NextP()) {
CurrentP(n1, n2);
BOPTools_CoupleOfInteger aCouple(n1, n2);
myListOfCouple.Append(aCouple);
}
myIterator.Initialize(myListOfCouple);
}
//=======================================================================
// function: More
// purpose:
//=======================================================================
Standard_Boolean BOPTools_IteratorOfCoupleOfShape::More()const
{
return myIterator.More();
}
//=======================================================================
// function: Next
// purpose:
//=======================================================================
void BOPTools_IteratorOfCoupleOfShape::Next()
{
myIterator.Next();
}
//=======================================================================
// function: Current
// purpose:
//=======================================================================
void BOPTools_IteratorOfCoupleOfShape::Current(Standard_Integer& Index1,
Standard_Integer& Index2,
Standard_Boolean& WithSubShape) const
{
WithSubShape = Standard_False;
const BOPTools_CoupleOfInteger& aCouple=myIterator.Value();
aCouple.Couple(Index1, Index2);
BOPTools_IntersectionStatus aStatus = myTableOfStatus->Value(Index1, Index2);
if(aStatus == BOPTools_BOUNDINGBOXOFSUBSHAPESINTERSECTED) {
WithSubShape = Standard_True;
}
}
//=======================================================================
// function: ListOfCouple
// purpose:
//=======================================================================
const BOPTools_ListOfCoupleOfInteger& BOPTools_IteratorOfCoupleOfShape::ListOfCouple() const
{
return myListOfCouple;
}
// ================================================================================================
// function: NextP
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::NextP()
{
if(myPDS==NULL) {
myCurrentIndex1 = -1;
myCurrentIndex2 = -1;
return;
}
Standard_Boolean couplefound, IsValidTableOfStatus = Standard_False;
Standard_Integer stopedindex1, stopedindex2, starti, i, startj, j;
TopAbs_ShapeEnum aTypei, aTypej;
stopedindex1 = myCurrentIndex1;
stopedindex2 = myCurrentIndex2;
if(!myTableOfStatus.IsNull()) {
IsValidTableOfStatus = Standard_True;
}
myCurrentIndex1 = -1;
myCurrentIndex2 = -1;
couplefound = Standard_False;
starti = stopedindex1;
if(starti < 0){
starti = myFirstLowerIndex;
}
for(i = starti; !couplefound && i<=myFirstUpperIndex; i++) {
startj = mySecondLowerIndex;
if(i==stopedindex1 && (stopedindex2 >= 0)) {
startj = stopedindex2 + 1;
}
for(j = startj; !couplefound && j<=mySecondUpperIndex; j++) {
aTypei=myPDS->GetShapeType(i);
aTypej=myPDS->GetShapeType(j);
if(((aTypei == myType1) && (aTypej == myType2)) ||
((aTypei == myType2) && (aTypej == myType1))) {
myCurrentIndex1 = i;
myCurrentIndex2 = j;
//
couplefound = Standard_True;
if(IsValidTableOfStatus) {
BOPTools_IntersectionStatus aStatus = myTableOfStatus->Value(i, j);
if(aStatus==BOPTools_INTERSECTED || aStatus==BOPTools_NONINTERSECTED) {
myCurrentIndex1 = -1;
myCurrentIndex2 = -1;
couplefound = Standard_False;
}
}
}
}
}
//}
}
// ================================================================================================
// function: More
// ================================================================================================
Standard_Boolean BOPTools_IteratorOfCoupleOfShape::MoreP() const
{
if((myCurrentIndex1 < 0) || (myCurrentIndex2 < 0))
return Standard_False;
return Standard_True;
}
// ================================================================================================
// function: Current
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::CurrentP(Standard_Integer& Index1,
Standard_Integer& Index2) const
{
if((myCurrentIndex1 < 0) || (myCurrentIndex2 < 0)) {
Standard_NoSuchObject::Raise("BOPTools_IteratorOfCoupleOfShape::Current");
}
Index1 = myCurrentIndex1;
Index2 = myCurrentIndex2;
}
// ================================================================================================
// function: SetIntersectionStatus
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::SetIntersectionStatus(const Standard_Integer Index1,
const Standard_Integer Index2,
const BOPTools_IntersectionStatus theStatus)
{
if((Index1 >= myTableOfStatus->LowerRow()) &&
(Index1 <= myTableOfStatus->UpperRow()) &&
(Index2 >= myTableOfStatus->LowerCol()) &&
(Index2 <= myTableOfStatus->UpperCol())) {
myTableOfStatus->ChangeValue(Index1, Index2) = theStatus;
}
}
// ================================================================================================
// function: GetTableOfIntersectionStatus
// ================================================================================================
const Handle(BOPTools_HArray2OfIntersectionStatus)&
BOPTools_IteratorOfCoupleOfShape::GetTableOfIntersectionStatus() const
{
return myTableOfStatus;
}
// ================================================================================================
// function: DumpTableOfIntersectionStatus
// ================================================================================================
void BOPTools_IteratorOfCoupleOfShape::DumpTableOfIntersectionStatus() const
{
cout << "*BOPTools_IteratorOfCoupleOfShape::DumpTableOfIntersectionStatus.BEGIN*" << endl;
cout << "myTableOfStatus.LowerRow="<< myTableOfStatus->LowerRow() << endl;
cout << "myTableOfStatus.UpperRow="<< myTableOfStatus->UpperRow() << endl;
cout << "myTableOfStatus.LowerCol()="<< myTableOfStatus->LowerCol() << endl;
cout << "myTableOfStatus.UpperCol()="<< myTableOfStatus->UpperCol() << endl;
for(Standard_Integer k=myTableOfStatus->LowerCol(); k<=myTableOfStatus->UpperCol(); k++) {
cout << k << " ";
}
cout << endl;
for(Standard_Integer i=myTableOfStatus->LowerRow(); i<=myTableOfStatus->UpperRow(); i++) {
for(Standard_Integer j=myTableOfStatus->LowerCol(); j<=myTableOfStatus->UpperCol(); j++) {
cout << myTableOfStatus->Value(i, j) << " ";
}
cout << endl;
}
cout << "*BOPTools_IteratorOfCoupleOfShape::DumpTableOfIntersectionStatus.END*" << endl;
}

View File

@@ -0,0 +1,30 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_ListOfConnexityBlock_HeaderFile
#define BOPTools_ListOfConnexityBlock_HeaderFile
#include <NCollection_List.hxx>
#include <BOPTools_ConnexityBlock.hxx>
typedef NCollection_List<BOPTools_ConnexityBlock> BOPTools_ListOfConnexityBlock;
typedef BOPTools_ListOfConnexityBlock::Iterator BOPTools_ListIteratorOfListOfConnexityBlock;
#endif

View File

@@ -0,0 +1,29 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_ListOfCoupleOfShape_HeaderFile
#define BOPTools_ListOfCoupleOfShape_HeaderFile
#include <NCollection_List.hxx>
#include <BOPTools_CoupleOfShape.hxx>
typedef NCollection_List<BOPTools_CoupleOfShape> BOPTools_ListOfCoupleOfShape;
typedef BOPTools_ListOfCoupleOfShape::Iterator BOPTools_ListIteratorOfListOfCoupleOfShape;
#endif

View File

@@ -0,0 +1,30 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_ListOfEdgeSet_HeaderFile
#define BOPTools_ListOfEdgeSet_HeaderFile
#include <NCollection_List.hxx>
#include <BOPTools_EdgeSet.hxx>
typedef NCollection_List<BOPTools_EdgeSet> BOPTools_ListOfEdgeSet;
typedef BOPTools_ListOfEdgeSet::Iterator BOPTools_ListIteratorOfListOfEdgeSet;
#endif

View File

@@ -0,0 +1,31 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTools_ListOfShapeSet_HeaderFile
#define BOPTools_ListOfShapeSet_HeaderFile
#include <NCollection_List.hxx>
#include <BOPTools_ShapeSet.hxx>
typedef NCollection_List<BOPTools_ShapeSet> BOPTools_ListOfShapeSet;
typedef BOPTools_ListOfShapeSet::Iterator BOPTools_ListIteratorOfListOfShapeSet;
#endif

View File

@@ -0,0 +1,34 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef BOPTest_MapOfShapeSet_HeaderFile
#define BOPTest_MapOfShapeSet_HeaderFile
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#define _NCollection_MapHasher
#include <NCollection_Map.hxx>
typedef NCollection_Map<BOPTools_Set, BOPTools_SetMapHasher> BOPTools_MapOfSet;
typedef BOPTools_MapOfSet::Iterator BOPTools_MapIteratorOfMapOfSet;
#undef _NCollection_MapHasher
#endif

View File

@@ -1,55 +0,0 @@
-- Created on: 2001-05-30
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PCurveMaker from BOPTools
---Purpose:
-- Class provides computation p-curves for the edges and theirs
--- split parts
uses
PPaveFiller from BOPTools,
PaveFiller from BOPTools,
PInterferencePool from BOPTools,
PShapesDataStructure from BooleanOperations
is
Create (aFiller: PaveFiller from BOPTools)
returns PCurveMaker from BOPTools;
---Purpose:
--- Constructor
---
Do(me:out);
---Purpose:
--- Launch the processor
---
IsDone(me)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if Ok
---
fields
myFiller : PPaveFiller from BOPTools;
myDS : PShapesDataStructure from BooleanOperations;
myIsDone : Boolean from Standard;
end PCurveMaker;

View File

@@ -1,262 +0,0 @@
// Created on: 2001-05-30
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PCurveMaker.ixx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepTools.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <IntTools_Curve.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_Tools2D.hxx>
//modified by NIZNHY-PKV Tue Jun 28 13:24:42 2011f
static
void UpdateVertices(const TopoDS_Edge& aE, const TopoDS_Face& aF);
//modified by NIZNHY-PKV Tue Jun 28 13:24:46 2011t
//=======================================================================
// function: BOPTools_PCurveMaker
// purpose:
//=======================================================================
BOPTools_PCurveMaker::BOPTools_PCurveMaker(const BOPTools_PaveFiller& aFiller)
:
myIsDone(Standard_False)
{
myFiller=(BOPTools_PaveFiller*) &aFiller;
myDS=myFiller->DS();
}
//=======================================================================
// function: IsDone
// purpose:
//=======================================================================
Standard_Boolean BOPTools_PCurveMaker::IsDone() const
{
return myIsDone;
}
//=======================================================================
// function: Do
// purpose:
//=======================================================================
void BOPTools_PCurveMaker::Do()
{
BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences();
Standard_Integer i, aNb, nF1, nF2, nE;
BOPTools_ListIteratorOfListOfPaveBlock anIt;
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
BOPTools_SSInterference& aFF=aFFs(i);
// Faces
nF1=aFF.Index1();
const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1));
nF2=aFF.Index2();
const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2));
//
// 1.Forwarding the Faces
TopoDS_Face aF1FWD=aF1;
aF1FWD.Orientation(TopAbs_FORWARD);
TopoDS_Face aF2FWD=aF2;
aF2FWD.Orientation(TopAbs_FORWARD);
//
// 2. In, On parts processing
const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
anIt.Initialize(aLPBInOn);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPBInOn=anIt.Value();
nE=aPBInOn.Edge();
const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
}
//
// 3. Section Edges processing
Standard_Integer j, aNbCurves, k, aNbV;
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
aNbCurves=aSC.Length();
for (j=1; j<=aNbCurves; j++) {
const BOPTools_Curve& aBC=aSC(j);
const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks();
anIt.Initialize(aLPB);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB=anIt.Value();
nE=aPB.Edge();
const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE));
//
Standard_Real aTolEdge, aTolR2D, aTolFact, aTolV, aTolVmax;
//
aTolEdge=BRep_Tool::Tolerance(aE);
aTolR2D=aFF.TolR2D();
aTolFact=Max(aTolEdge, aTolR2D);
//
// Check vertices tolerances and correct them if necessary
// to prevent situation when TolE > TolV
//
TopTools_IndexedMapOfShape aVMap;
TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
aTolVmax=-1.;
aNbV=aVMap.Extent();
for (k=1; k<=aNbV; ++k) {
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
aTolV=BRep_Tool::Tolerance(aV);
if (aTolV>aTolVmax) {
aTolVmax=aTolV;
}
}
//
if (aTolFact>aTolVmax) {
aTolFact=aTolVmax;
}
//
BRep_Builder aBB;
const IntTools_Curve& aIC=aBC.Curve();
//ZZ const Handle(Geom_Curve)& aC3D=aIC.Curve();
//
Standard_Real aTFirst, aTLast, aOutFirst, aOutLast, aOutTol;
const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aTFirst, aTLast);
Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aTFirst, aTLast);
//
Handle(Geom2d_Curve) aC2D1, aC2D1A, aC2D2, aC2D2A;
//
aC2D1=aIC.FirstCurve2d();
if (aC2D1.IsNull()) {
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
BOPTools_Tools2D::CurveOnSurface(aE, aF1FWD, aC2D1, aOutFirst, aOutLast, aOutTol, Standard_True);
}
//
if (aC3DE->IsPeriodic()) {
BOPTools_Tools2D::AdjustPCurveOnFace(aF1FWD, aTFirst, aTLast, aC2D1, aC2D1A);
}
else {
BOPTools_Tools2D::AdjustPCurveOnFace(aF1FWD, aC3DETrim, aC2D1, aC2D1A);
}
//
aBB.UpdateEdge(aE, aC2D1A, aF1FWD, aTolFact);
//modified by NIZNHY-PKV Tue Jun 28 07:52:55 2011f
UpdateVertices(aE, aF1FWD);
//modified by NIZNHY-PKV Tue Jun 28 07:52:57 2011t
aC2D2=aIC.SecondCurve2d();
if (aC2D2.IsNull()) {
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
BOPTools_Tools2D::CurveOnSurface(aE, aF2FWD, aC2D2, aOutFirst, aOutLast, aOutTol, Standard_True);
}
//
if (aC3DE->IsPeriodic()) {
BOPTools_Tools2D::AdjustPCurveOnFace(aF2FWD, aTFirst, aTLast, aC2D2, aC2D2A);
}
else {
BOPTools_Tools2D::AdjustPCurveOnFace(aF2FWD, aC3DETrim, aC2D2, aC2D2A);
}
//
aBB.UpdateEdge(aE, aC2D2A, aF2FWD, aTolFact);
//modified by NIZNHY-PKV Tue Jun 28 07:52:55 2011f
UpdateVertices(aE, aF2FWD);
//modified by NIZNHY-PKV Tue Jun 28 07:52:57 2011t
}
}// for (j=1; j<=aNbCurves; j++)
} // for (i=1; i<=aNb; i++)
myIsDone=Standard_True;
}
//modified by NIZNHY-PKV Tue Jun 28 07:37:47 2011f
//=======================================================================
//function : UpdateVertices
//purpose : update tolerances of vertices comparing extremities of
// 3d and 2d curves
//=======================================================================
void UpdateVertices(const TopoDS_Edge& aE, const TopoDS_Face& aF)
{
Standard_Integer j;
Standard_Real aT[2], aUx, aVx, aTolV2, aD2, aD;
gp_Pnt aP3D, aP3Dx;
gp_Pnt2d aP2Dx;
Handle(Geom_Surface) aS;
Handle(Geom_Curve) aC3D;
Handle(Geom2d_Curve) aC2D;
TopoDS_Edge aEf;
TopoDS_Vertex aV[2];
BRep_Builder aBB;
//
aEf=aE;
aEf.Orientation(TopAbs_FORWARD);
//
TopExp::Vertices(aEf, aV[0], aV[1]);
//
aS=BRep_Tool::Surface(aF);
aC3D=BRep_Tool::Curve(aEf, aT[0], aT[1]);
aC2D=BRep_Tool::CurveOnSurface(aEf, aF, aT[0], aT[1]);
//
for (j=0; j<2; ++j) {
aTolV2=BRep_Tool::Tolerance(aV[j]);
aTolV2=aTolV2*aTolV2;
//
aC3D->D0(aT[j], aP3D);
aC2D->D0(aT[j], aP2Dx);
aP2Dx.Coord(aUx, aVx);
aS->D0(aUx, aVx, aP3Dx);
aD2=aP3D.SquareDistance(aP3Dx);
if (aD2>aTolV2) {
aD=sqrt(aD2);
aBB.UpdateVertex(aV[j], aD);
}
}
}
//modified by NIZNHY-PKV Tue Jun 28 07:37:50 2011t

View File

@@ -1,96 +0,0 @@
-- Created on: 2001-02-08
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Pave from BOPTools
---Purpose:
-- Class for storing info about a vertex on an edge
uses
KindOfInterference from BooleanOperations
is
Create
returns Pave from BOPTools;
---Purpose:
--- Empty constructor
---
Create (Index: Integer from Standard;
aParam:Real from Standard;
aType: KindOfInterference from BooleanOperations
=BooleanOperations_UnknownInterference)
returns Pave from BOPTools;
---Purpose:
--- Constructor
--- Index - DS-index of the vertex
--- aParam - value of the parameter of the vertex on an edge
--- aType - the type of interference from which the pave comes from
---
SetParam (me:out; aParam:Real from Standard);
---Purpose:
--- Modifier
---
SetIndex (me:out; Index: Integer from Standard);
---Purpose:
--- Modifier
---
SetType (me:out; aType:KindOfInterference from BooleanOperations);
---Purpose:
--- Modifier
---
SetInterference (me:out; Index: Integer from Standard);
---Purpose:
--- Modifier
--- Sets the index of the interference in corresponding table
---
Param (me)
returns Real from Standard;
---Purpose:
--- Selector
---
Index (me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Type (me)
returns KindOfInterference from BooleanOperations;
---Purpose:
--- Selector
---
Interference(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
IsEqual(me; Other:Pave from BOPTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if <Other>==me
---
fields
myParam: Real from Standard;
myIndex: Integer from Standard;
myType : KindOfInterference from BooleanOperations;
myInterf: Integer from Standard;
end Pave;

View File

@@ -1,130 +0,0 @@
// Created on: 2001-02-08
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Pave.ixx>
//=======================================================================
// function: BOPTools_Pave::BOPTools_Pave
// purpose:
//=======================================================================
BOPTools_Pave::BOPTools_Pave()
:
myParam(0.),
myIndex(0),
myType(BooleanOperations_UnknownInterference),
myInterf(0)
{}
//=======================================================================
// function: BOPTools_Pave::BOPTools_Pave
// purpose:
//=======================================================================
BOPTools_Pave::BOPTools_Pave(const Standard_Integer anIndex,
const Standard_Real aParam,
const BooleanOperations_KindOfInterference aType)
:
myParam(aParam),
myIndex(anIndex),
myType(aType),
myInterf(0)
{}
//=======================================================================
// function: SetParam
// purpose:
//=======================================================================
void BOPTools_Pave::SetParam(const Standard_Real aParam)
{
myParam=aParam;
}
//=======================================================================
// function: SetIndex
// purpose:
//=======================================================================
void BOPTools_Pave::SetIndex(const Standard_Integer anIndex)
{
myIndex=anIndex;
}
//=======================================================================
// function: SetType
// purpose:
//=======================================================================
void BOPTools_Pave::SetType(const BooleanOperations_KindOfInterference aType)
{
myType=aType;
}
//=======================================================================
// function: SetInterference
// purpose:
//=======================================================================
void BOPTools_Pave::SetInterference(const Standard_Integer anIndex)
{
myInterf=anIndex;
}
//=======================================================================
// function: Param
// purpose:
//=======================================================================
Standard_Real BOPTools_Pave::Param() const
{
return myParam;
}
//=======================================================================
// function: Index
// purpose:
//=======================================================================
Standard_Integer BOPTools_Pave::Index() const
{
return myIndex;
}
//=======================================================================
// function: Type
// purpose:
//=======================================================================
BooleanOperations_KindOfInterference BOPTools_Pave::Type() const
{
return myType;
}
//=======================================================================
// function: Interference
// purpose:
//=======================================================================
Standard_Integer BOPTools_Pave::Interference() const
{
return myInterf;
}
//=======================================================================
// function: IsEqual
// purpose:
//=======================================================================
Standard_Boolean BOPTools_Pave::IsEqual(const BOPTools_Pave& Other) const
{
Standard_Integer anIndOther;
Standard_Real aParamOther, dt=1.e-14;
anIndOther=Other.Index();
if (anIndOther!=myIndex) {
return Standard_False;
}
aParamOther=Other.Param();
if (fabs (aParamOther-myParam) > dt){
return Standard_False;
}
return Standard_True;
}

View File

@@ -1,197 +0,0 @@
-- Created on: 2001-02-15
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PaveBlock from BOPTools
---Purpose:
-- Class for storing info about a couple
--- of neighbouring paves on an edge
uses
Pave from BOPTools,
PointBetween from BOPTools,
Range from IntTools,
ShrunkRange from IntTools,
Curve from IntTools
is
Create
returns PaveBlock from BOPTools;
---Purpose:
--- Empty constructor
---
Create (anEdge: Integer from Standard;
aPave1: Pave from BOPTools;
aPave2: Pave from BOPTools);
---Purpose:
--- Constructor
--- Index - DS-index of the edge
--- aPave1 - one pave
--- aPave2 - other pave
---
SetEdge (me:out;
anEdge:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the edge that is between aPave1 and aPave2
---
SetOriginalEdge (me:out;
anEdge:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the edge from which this pave block comes from
---
SetPave1(me:out;
aPave: Pave from BOPTools);
---Purpose:
--- Modifier
---
SetPave2(me:out;
aPave: Pave from BOPTools);
---Purpose:
--- Modifier
---
SetShrunkRange (me:out;
aSR:ShrunkRange from IntTools);
---Purpose:
--- Modifier
--- Sets the Shrunk Range for the pave block
---
SetPointBetween (me:out;
aP: PointBetween from BOPTools);
---Purpose:
--- Modifier
--- Sets the point between the paves for the pave block
---
--- Case of Face/Face Pave Block
---
SetCurve (me:out;
aC:Curve from IntTools);
---Purpose:
--- Modifier
--- Sets the intersection curve to which the pave block belongs to
---
SetFace1 (me:out;
nF1:Integer from Standard);
---Purpose:
--- Modifier
--- Sets the DS-index of the first face
---
SetFace2 (me:out;
nF2:Integer from Standard);
---Purpose:
--- Modifier
--- Sets the DS-index of the second face
---
Edge (me)
returns Integer from Standard;
---Purpose:
--- Selector
---
OriginalEdge(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Pave1(me)
returns Pave from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
Pave2(me)
returns Pave from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
IsValid(me)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if both paves have vertex index !=0
---
IsEqual(me;
Other:PaveBlock from BOPTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if <Other> is equal to me
---
Parameters (me;
aT1:out Real from Standard;
aT2:out Real from Standard);
---Purpose:
--- Returns values for paves' parameters
---
Range (me)
returns Range from IntTools;
---C++: return const &
---Purpose:
--- Returns parmetric range for paves' parameters
---
ShrunkRange(me)
returns ShrunkRange from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
PointBetween (me)
returns PointBetween from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
Curve(me)
returns Curve from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
Face1(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Face2(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
IsInBlock(me;
aPaveX: Pave from BOPTools)
returns Boolean from Standard;
fields
myEdge : Integer from Standard;
myOriginalEdge : Integer from Standard;
myPave1 : Pave from BOPTools;
myPave2 : Pave from BOPTools;
myRange : Range from IntTools;
myShrunkRange : ShrunkRange from IntTools;
myCurve : Curve from IntTools;
myFace1 : Integer from Standard;
myFace2 : Integer from Standard;
myPointBetween : PointBetween from BOPTools;
end PaveBlock;

View File

@@ -1,303 +0,0 @@
// Created on: 2001-02-15
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveBlock.ixx>
//=======================================================================
// function: BOPTools_PaveBlock::BOPTools_PaveBlock
// purpose:
//=======================================================================
BOPTools_PaveBlock::BOPTools_PaveBlock()
:
myEdge(0),
myOriginalEdge(0),
myFace1(0),
myFace2(0)
{}
//=======================================================================
// function: BOPTools_PaveBlock::BOPTools_PaveBlock
// purpose:
//=======================================================================
BOPTools_PaveBlock::BOPTools_PaveBlock(const Standard_Integer theEdge,
const BOPTools_Pave& thePave1,
const BOPTools_Pave& thePave2)
{
myOriginalEdge=theEdge;
myPave1=thePave1;
myPave2=thePave2;
myFace1=0;
myFace2=0;
}
//=======================================================================
// function: SetCurve
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetCurve(const IntTools_Curve& aC)
{
myCurve=aC;
}
//=======================================================================
// function: SetFace1
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetFace1(const Standard_Integer theFace1)
{
myFace1=theFace1;
}
//=======================================================================
// function: SetFace2
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetFace2(const Standard_Integer theFace2)
{
myFace2=theFace2;
}
//=======================================================================
// function: Face1
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveBlock::Face1() const
{
return myFace1;
}
//=======================================================================
// function: Face2
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveBlock::Face2() const
{
return myFace2;
}
//=======================================================================
// function: Curve
// purpose:
//=======================================================================
const IntTools_Curve& BOPTools_PaveBlock::Curve() const
{
return myCurve;
}
//=======================================================================
// function: SetEdge
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetEdge(const Standard_Integer theEdge)
{
myEdge=theEdge;
}
//=======================================================================
// function: SetOriginalEdge
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetOriginalEdge(const Standard_Integer theEdge)
{
myOriginalEdge=theEdge;
}
//=======================================================================
// function: SetPave1
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetPave1(const BOPTools_Pave& thePave1)
{
myPave1=thePave1;
}
//=======================================================================
// function: SetPave2
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetPave2(const BOPTools_Pave& thePave2)
{
myPave2=thePave2;
}
//=======================================================================
// function: SetShrunkRange
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetShrunkRange(const IntTools_ShrunkRange& theSR)
{
myShrunkRange=theSR;
}
//=======================================================================
// function: SetPointBetween
// purpose:
//=======================================================================
void BOPTools_PaveBlock::SetPointBetween (const BOPTools_PointBetween& thePB)
{
myPointBetween=thePB;
}
//=======================================================================
// function: PointBetween
// purpose:
//=======================================================================
const BOPTools_PointBetween& BOPTools_PaveBlock::PointBetween ()const
{
return myPointBetween;
}
//=======================================================================
// function: Pave1
// purpose:
//=======================================================================
const BOPTools_Pave& BOPTools_PaveBlock::Pave1() const
{
Standard_Real t1, t2;
t1=myPave1.Param();
t2=myPave2.Param();
if (t1<t2) {
return myPave1;
}
return myPave2;
}
//=======================================================================
// function: Pave2
// purpose:
//=======================================================================
const BOPTools_Pave& BOPTools_PaveBlock::Pave2() const
{
Standard_Real t1, t2;
t1=myPave1.Param();
t2=myPave2.Param();
if (t1>t2) {
return myPave1;
}
return myPave2;
}
//=======================================================================
// function: Edge
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveBlock::Edge() const
{
return myEdge;
}
//=======================================================================
// function: OriginalEdge
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveBlock::OriginalEdge() const
{
return myOriginalEdge;
}
//=======================================================================
// function: IsValid
// purpose:
//=======================================================================
Standard_Boolean BOPTools_PaveBlock::IsValid() const
{
Standard_Integer anInd1, anInd2;
anInd1=myPave1.Index();
anInd2=myPave2.Index();
return (anInd1 && anInd2);
}
//=======================================================================
// function: IsEqual
// purpose:
//=======================================================================
Standard_Boolean BOPTools_PaveBlock::IsEqual(const BOPTools_PaveBlock& Other) const
{
if (myOriginalEdge==Other.myOriginalEdge) {
const BOPTools_Pave& aP11=Pave1();
const BOPTools_Pave& aP12=Pave2();
const BOPTools_Pave& aP21=Other.Pave1();
const BOPTools_Pave& aP22=Other.Pave2();
if (aP11.IsEqual(aP21)) {
if (aP12.IsEqual(aP22)) {
return Standard_True;
}
}
}
return Standard_False;
}
//=======================================================================
// function: Parameters
// purpose:
//=======================================================================
void BOPTools_PaveBlock::Parameters(Standard_Real& aT1,
Standard_Real& aT2) const
{
Standard_Real t1, t2;
t1=myPave1.Param();
t2=myPave2.Param();
aT1= (t1<t2) ? t1 : t2;
aT2= (t1>t2) ? t1 : t2;
}
//=======================================================================
// function: Range
// purpose:
//=======================================================================
const IntTools_Range& BOPTools_PaveBlock::Range() const
{
Standard_Real t1, t2;
t1=myPave1.Param();
t2=myPave2.Param();
IntTools_Range* pRange=(IntTools_Range*) &myRange;
if (t1<t2) {
pRange->SetFirst (t1);
pRange->SetLast (t2);
}
else {
pRange->SetFirst (t2);
pRange->SetLast (t1);
}
return myRange;
}
//=======================================================================
// function: ShrunkRange
// purpose:
//=======================================================================
const IntTools_ShrunkRange& BOPTools_PaveBlock::ShrunkRange()const
{
return myShrunkRange;
}
//=======================================================================
// function: IsInBlock
// purpose:
//=======================================================================
Standard_Boolean BOPTools_PaveBlock::IsInBlock(const BOPTools_Pave& thePaveX) const
{
Standard_Boolean bIsInBlock;
Standard_Real aT1, aT2, aTx;
//
aTx=thePaveX.Param();
Parameters(aT1, aT2);
bIsInBlock=(aTx > aT1 && aTx < aT2);
return bIsInBlock;
}

View File

@@ -1,75 +0,0 @@
-- Created on: 2001-03-07
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PaveBlockIterator from BOPTools
---Purpose:
--- class providing iterations for PaveSet to
--- have the right order of paves along the edge
---
uses
PaveSet from BOPTools,
CArray1OfPave from BOPTools,
PaveBlock from BOPTools
is
Create
returns PaveBlockIterator from BOPTools;
---Purpose:
--- Empty constructor
---
Create (aEdge : Integer from Standard;
aPaveSet: PaveSet from BOPTools)
returns PaveBlockIterator from BOPTools;
---Purpose:
--- Constructor
--- aEdge - DS-index of the edge
--- aPaveSet - a set of paves for the edge
---
Initialize(me:out;aEdge : Integer from Standard;
aPaveSet: PaveSet from BOPTools);
---Purpose:
--- Resets the iterator on the PaveSet <aPaveSet>
---
More(me)
returns Boolean from Standard;
---Purpose:
--- Returns True if there is a current Pave in
--- the iteration.
---
Next(me:out);
---Purpose:
--- Moves to the next Pave in the PaveSet
---
Value(me:out)
returns PaveBlock from BOPTools;
---C++: return &
---Purpose:
--- Returns the current Pave
---
fields
myEdge : Integer from Standard;
myIndex : Integer from Standard;
myPaveSet : PaveSet from BOPTools;
myPaves : CArray1OfPave from BOPTools;
myPaveBlock: PaveBlock from BOPTools;
end PaveBlockIterator;

View File

@@ -1,117 +0,0 @@
// Created on: 2001-03-07
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveBlockIterator.ixx>
#include <BOPTools_ListOfPave.hxx>
#include <BOPTools_ListIteratorOfListOfPave.hxx>
#include <BOPTools_Pave.hxx>
//=======================================================================
// function:BOPTools_PaveBlockIterator
// purpose:
//=======================================================================
BOPTools_PaveBlockIterator::BOPTools_PaveBlockIterator()
:
myEdge(0),
myIndex(1)
{
}
//=======================================================================
// function:BOPTools_PaveBlockIterator
// purpose:
//=======================================================================
BOPTools_PaveBlockIterator::BOPTools_PaveBlockIterator (const Standard_Integer anEdge,
const BOPTools_PaveSet& aPaveSet)
{
Initialize (anEdge, aPaveSet);
}
//=======================================================================
// function:Initialize
// purpose:
//=======================================================================
void BOPTools_PaveBlockIterator::Initialize(const Standard_Integer anEdge,
const BOPTools_PaveSet& aPaveSet)
{
Standard_Integer i, aNb;
myPaveSet=aPaveSet;
myIndex=1;
myEdge=anEdge;
myPaveBlock.SetOriginalEdge(myEdge);
myPaveSet.SortSet();
BOPTools_ListOfPave& aLP=myPaveSet.ChangeSet();
aNb=aLP.Extent();
myPaves.Resize(aNb);
BOPTools_ListIteratorOfListOfPave anIt(aLP);
for (i=1; anIt.More(); anIt.Next(), i++) {
const BOPTools_Pave& aPave=anIt.Value();
myPaves(i)=aPave;
}
}
//=======================================================================
// function:More
// purpose:
//=======================================================================
Standard_Boolean BOPTools_PaveBlockIterator::More() const
{
Standard_Integer aNb;
aNb=myPaves.Extent();
return (myIndex < aNb);
}
//=======================================================================
// function:Next
// purpose:
//=======================================================================
void BOPTools_PaveBlockIterator::Next()
{
myIndex++;
}
//=======================================================================
// function:Value
// purpose:
//=======================================================================
BOPTools_PaveBlock& BOPTools_PaveBlockIterator::Value()
{
Standard_Integer i1, i2;
Standard_Real aT1, aT2;
BOPTools_PaveBlock* pPB= (BOPTools_PaveBlock*) &myPaveBlock;
i1=myIndex;
i2=i1+1;
const BOPTools_Pave& aPave1=myPaves(i1);
const BOPTools_Pave& aPave2=myPaves(i2);
aT1=aPave1.Param();
aT2=aPave2.Param();
if (aT1 > aT2) {
pPB->SetPave1(aPave1);
pPB->SetPave2(aPave2);
}
else {
pPB->SetPave1(aPave2);
pPB->SetPave2(aPave1);
}
return myPaveBlock;
}

View File

@@ -1,51 +0,0 @@
// Created on: 2003-12-11
// Created by: Peter KURNEV
// Copyright (c) 2003-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveBlockMapHasher.ixx>
#include <BOPTools_Pave.hxx>
#include <BOPTools_PaveBlock.hxx>
//=======================================================================
//function : HashCode
//purpose :
//=======================================================================
Standard_Integer BOPTools_PaveBlockMapHasher::HashCode(const BOPTools_PaveBlock& aPB,
const Standard_Integer aUpper)
{
Standard_Integer aS, nV1, nV2, nE;
//
nV1=aPB.Pave1().Index();
nV2=aPB.Pave2().Index();
nE=aPB.OriginalEdge();
aS=nV1+nV2+nE;
return aS%aUpper;
}
//=======================================================================
//function :IsEqual
//purpose :
//=======================================================================
Standard_Boolean BOPTools_PaveBlockMapHasher::IsEqual(const BOPTools_PaveBlock& aPB1,
const BOPTools_PaveBlock& aPB2)
{
return aPB1.IsEqual(aPB2);
}

View File

@@ -1,627 +0,0 @@
-- Created on: 2001-02-08
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PaveFiller from BOPTools
---Purpose: The algorithm that provides
--- 1. creation of the data structure (DS)
--- 2. creation of the interferences' pool
--- 3. invocation of Perform() to fill the DS
---
---
uses
PShapesDataStructure from BooleanOperations,
InterferencePool from BOPTools,
PInterferencePool from BOPTools,
PavePool from BOPTools,
CommonBlockPool from BOPTools,
SplitShapesPool from BOPTools,
Pave from BOPTools,
PaveBlock from BOPTools,
PaveSet from BOPTools,
Curve from BOPTools,
SSInterference from BOPTools,
ListOfPaveBlock from BOPTools,
IteratorOfCoupleOfShape from BOPTools,
SSInterference from BOPTools,
SSIntersectionAttribute from BOPTools,
ShrunkRange from IntTools,
Context from IntTools,
ShapeEnum from TopAbs,
ListOfInteger from TColStd,
IndexedMapOfInteger from TColStd,
Pnt from gp,
Vertex from TopoDS,
SetOfInteger from TColStd
is
Create
returns PaveFiller from BOPTools;
---Purpose:
--- Empty Contructor
---
Create (aIP: InterferencePool from BOPTools)
returns PaveFiller from BOPTools;
---Purpose:
--- Constructor
---
Create (theIP : InterferencePool from BOPTools;
theSectionAttribute: SSIntersectionAttribute from BOPTools)
returns PaveFiller from BOPTools;
---Purpose:
--- Constructor
---
Destroy (me: in out)
is virtual;
---C++: alias "Standard_EXPORT virtual ~BOPTools_PaveFiller(){Destroy();}"
---Purpose:
--- Destructor
---
Perform (me:out)
is virtual;
---Purpose:
--- Fills the DS
---
PartialPerform(me:out; anObjSubSet, aToolSubSet: SetOfInteger from TColStd)
is virtual;
ToCompletePerform(me:out)
is virtual;
PerformVV (me:out)
is virtual protected;
---Purpose:
--- Computes Vertex/Vertex interferences
---
PerformVE (me:out)
is virtual protected;
---Purpose:
--- Computes Vertex/Edge interferences
---
PerformVF (me:out)
is virtual protected;
---Purpose:
--- Computes Vertex/Face interferences
---
PerformEE (me:out)
is virtual protected;
---Purpose:
--- Computes Edge/Edge interferences
---
PerformEF (me:out)
is virtual protected;
---Purpose:
--- Computes Edge/Face interferences
---
PerformFF (me:out)
is virtual protected;
---Purpose:
--- Computes Face/Face interferences
---
--------------------------------------------------------------
---
--- Selectors
---
---
SetContext(me:out;
aContext: Context from IntTools);
---Purpose:
--- Sets the intersecton context
---
Context(me)
returns Context from IntTools;
---C++:return const &
---Purpose:
--- Selector
---
-- ChangeContext(me:out)
-- returns Context from IntTools;
-- C++:return &
---Purpose:
--- Selector
---
SetInterferencePool(me:out;
aPool:InterferencePool from BOPTools);
---Purpose:
--- Selector
---
IsDone(me)
returns Boolean from Standard;
---Purpose:
--- Selector
---
PavePool(me)
returns PavePool from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
ChangePavePool(me:out)
returns PavePool from BOPTools;
---C++:return &
---Purpose:
--- Selector
---
CommonBlockPool(me)
returns CommonBlockPool from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
ChangeCommonBlockPool(me:out)
returns CommonBlockPool from BOPTools;
---C++:return &
---Purpose:
--- Selector
---
SplitShapesPool(me)
returns SplitShapesPool from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
ChangeSplitShapesPool(me:out)
returns SplitShapesPool from BOPTools;
---C++:return &
---Purpose:
--- Selector
---
DS(me:out)
returns PShapesDataStructure from BooleanOperations;
---Purpose:
--- Selector
---
InterfPool(me:out)
returns PInterferencePool from BOPTools;
---Purpose:
--- Selector
---
IteratorOfCoupleOfShape(me)
returns IteratorOfCoupleOfShape from BOPTools;
---C++:return const &
---Purpose:
--- Selector
---
SectionAttribute(me)
returns SSIntersectionAttribute from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
SetSectionAttribute(me:out;
anAtt : SSIntersectionAttribute from BOPTools);
---Purpose:
--- Selector
---
--------------------------------------------------------------
---
--- PaveBlocks for Split Parts of Edges.
---
---
SortTypes (me;
anInd1:in out Integer from Standard;
anInd2:in out Integer from Standard)
is protected;
---Purpose:
--- Sorts the types of shapes with DS-indices
--- <anInd1> and <anInd2> in increasing order of
--- types of the shapes
---
PerformNewVertices (me:out)
is protected;
IsSuccesstorsComputed (me;
iF1:Integer from Standard;
iF2:Integer from Standard)
returns Boolean from Standard
is protected;
PrepareEdges (me:out)
is virtual protected;
---Purpose:
--- Prepare end paves for each edge
---
PreparePaveBlocks (me:out;
aType1: ShapeEnum from TopAbs;
aType2: ShapeEnum from TopAbs)
is virtual protected;
---Purpose:
--- Prepare PaveBlocks for each edge (EE-interferences)
---
PreparePaveBlocks (me:out;
anE:Integer from Standard)
is virtual protected;
---Purpose:
--- Prepare PaveBlocks for given edge (EE-interferences)
---
RefinePavePool(me:out)
is protected;
---Purpose:
--- Refines myPavePool taking into account new Paves obtained from EE algo
---
MakeSplitEdges(me:out)
is protected;
---Purpose:
--- Makes split edges from source edges
---
DoSDEdges(me:out)
is protected;
---Purpose:
--- Update Lists of PaveBlocks with info about
--- indices of split edges that are Same Domain
--- with other splits or faces
---
CorrectShrunkRanges(me:out;
aSide: Integer from Standard;
aPave: Pave from BOPTools;
aSR : out ShrunkRange from IntTools)
is protected;
---Purpose:
--- Update Shrunk Range <aSR> for Pave <aPave>
---
SplitIndex (me:out; aPB:PaveBlock from BOPTools)
returns Integer from Standard
is protected;
---Purpose:
--- Returns the Index of Split edge for the PaveBlock <aPB>
--- in DS.
--- If the PaveBlock is not found, returns 0;
---
IsBlocksCoinside (me;
aPB1:PaveBlock from BOPTools;
aPB2:PaveBlock from BOPTools)
returns Boolean from Standard
is protected;
---Purpose:
--- Returns TRUE if the two PaveBlocks have vertices
--- that touch each other in terms of Tolerances of
--- the vertices
---
--------------------------------------------------------------
---
--- Some of API FUNCTIONS
---
---
SplitsInFace(me:out;
aBid:Integer from Standard;
nF1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfInteger from TColStd)
returns Integer from Standard;
---Purpose:
--- For the face <nF1> get all splits that are IN-2D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsInFace(me:out;
nE1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfInteger from TColStd)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all splits that are IN-2D
--- to the face <nF1>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnEdge(me:out;
nE1 :Integer from Standard;
nE2 :Integer from Standard;
aLs :out ListOfInteger from TColStd)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all splits that are ON-3D
--- to the edge <nE2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnFace(me:out;
nE1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfInteger from TColStd)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all splits that are ON-3D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnFace(me:out;
aBid:Integer from Standard;
nF1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfInteger from TColStd)
returns Integer from Standard;
---Purpose:
--- For the face <nF1> get all splits that are ON-3D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsInFace(me:out;
aBid:Integer from Standard;
nF1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfPaveBlock from BOPTools)
returns Integer from Standard;
---Purpose:
--- For the face <nF1> get all PaveBlocks that are IN-2D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsInFace(me:out;
nE1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfPaveBlock from BOPTools)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all PaveBlocks that are IN-2D
--- to the face <nF1>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnEdge(me:out;
nE1 :Integer from Standard;
nE2 :Integer from Standard;
aLs :out ListOfPaveBlock from BOPTools)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all PaveBlocks that are ON-3D
--- to the edge <nE2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnFace(me:out;
nE1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfPaveBlock from BOPTools)
returns Integer from Standard;
---Purpose:
--- For the edge <nE1> get all PaveBlocks that are ON-3D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
SplitsOnFace(me:out;
aBid:Integer from Standard;
nF1 :Integer from Standard;
nF2 :Integer from Standard;
aLs :out ListOfPaveBlock from BOPTools)
returns Integer from Standard;
---Purpose:
--- For the face <nF1> get all PaveBlocks that are ON-3D
--- to the face <nF2>; The result is in <aLs>
--- Returns 0 if OK;
---
FindSDVertex (me;
nV: Integer from Standard)
returns Integer from Standard;
---Purpose:
--- Find for the vertex <nV> SD-vertex (if possible) and return
--- its DS-index. Otherwise it returns 0.
---
---------------------------------------------------------------
---
--- Section Edges. Protected Block.
---
---
MakeBlocks(me:out)
is protected;
---Purpose:
--- Make Pave Blocks for intersection curves
---
MakeAloneVertices(me:out)
is protected;
---Purpose:
--- Make vertices that are place of intersection
--- between faces
---
PutPaveOnCurve(me:out;
aPaveSet: PaveSet from BOPTools;
aTolR3D : Real from Standard;
aBCurve :out Curve from BOPTools)
is protected;
---Purpose:
--- Among Paves from <aPaveSet> find ones that belong
--- to intersection curve <aBCurve> with 3D-tolerance
--- value <aTolR3D>
---
PutPaveOnCurve(me:out;
aPave : Pave from BOPTools;
aTolR3D : Real from Standard;
aBCurve :out Curve from BOPTools)
is protected;
---Purpose:
--- Try to put Pave <aPave> on intersection curve <aBCurve>
--- with 3D-tolerance value <aTolR3D>
---
PutPavesOnCurves(me:out)
is protected;
PrepareSetForFace(me:out;
nF1 :Integer from Standard;
nF2 :Integer from Standard;
aPaveSet:out PaveSet from BOPTools);
---Purpose:
--- For couple of faces <nF1>, <nF2> prepare set of all paves
--- of all edges <aPaveSet>
---
MakeSectionEdges(me:out)
is protected;
---Purpose:
--- For all inrefered faces make section edges from
--- intersection curves and corresp. Paves on them
---
PutBoundPaveOnCurve (me:out;
aBC :out Curve from BOPTools;
aFF :out SSInterference from BOPTools)
is protected;
---Purpose:
--- Try to put own bounds of the curve on the curve <aBC>
---
PutBoundPaveOnCurve (me:out;
aP : Pnt from gp;
aT : Real from Standard;
aBC :out Curve from BOPTools;
aFF :out SSInterference from BOPTools)
is protected;
---Purpose:
--- Try to put 3D-point <aP> (parameter aT) on the curve <aBC>
---
PutBoundPaveOnCurveSpec (me:out;
aBC :out Curve from BOPTools;
aFF :out SSInterference from BOPTools)
is protected;
---Purpose:
--- Try to put own bounds of the curve on the curve <aBC>
---
PutBoundPaveOnCurveSpec (me:out;
aP : Pnt from gp;
aT : Real from Standard;
aBC :out Curve from BOPTools;
aFF :out SSInterference from BOPTools)
is protected;
---Purpose:
--- Try to put 3D-point <aP> (parameter aT) on the curve <aBC>
---
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011f
PutClosingPaveOnCurve (me:out;
aBC :out Curve from BOPTools;
aFF :out SSInterference from BOPTools)
is protected;
---Purpose:
--- Put paves on the curve <aBC> in case when <aBC>
-- is closed 3D-curve
---
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011t
FindPave (me:out;
aP :Pnt from gp;
aTpV: Real from Standard;
aPS: PaveSet from BOPTools;
aPV:out Pave from BOPTools)
returns Boolean from Standard
is protected;
---Purpose:
--- Returns TRUE if 3D-point <aP> coinsides with some Pave
--- from <aPS> (with 3D-tolerance value <aTpV>);
--- In TRUE case <aPV> will contain the Pave .
---
CheckCoincidence(me:out;
aPB: PaveBlock from BOPTools;
aFF: SSInterference from BOPTools)
returns Boolean from Standard
is protected;
---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the faces
--- from FF-interference <aFF>
---
CheckIntermediatePoint(me:out;
aPB : PaveBlock from BOPTools;
aPBR: PaveBlock from BOPTools;
aTol: Real from Standard)
returns Integer from Standard
is protected;
---Purpose:
--- Returns 0 if some arbitrary intermediate point from
--- PaveBlock <aPB> lays on the PaveBlock <aPBR>
--- (with 3D-tolerance value <aTol>)
---
CheckFacePaves(me:out;
aV : Vertex from TopoDS;
nF: Integer from Standard)
returns Integer from Standard
is protected;
---Purpose:
--- Internal usage
---
StickVertices (me:out;
nF1: Integer from Standard;
nF2: Integer from Standard;
aMV:out IndexedMapOfInteger from TColStd)
is protected;
---Purpose:
--- Internal usage
---
ExpectedPoolLength(me)
returns Integer from Standard
is protected;
---Purpose:
--- Returns the value of expected length of array of interferences
---
RestrictCurveIn2d(me: in out; nE, nF1, nF2 : Integer from Standard;
theTolerance: Real from Standard;
theBC : in out Curve from BOPTools)
is private;
RecomputeCommonBlocks(me: in out; nE: Integer from Standard)
is private;
ExtendedTolerance(me:out;
nV : Integer from Standard;
aTolExt : out Real from Standard)
returns Boolean from Standard
is protected;
fields
myIntrPool : PInterferencePool from BOPTools
is protected;
myDS : PShapesDataStructure from BooleanOperations
is protected;
myPavePool : PavePool from BOPTools
is protected;
myPavePoolNew : PavePool from BOPTools
is protected;
myCommonBlockPool : CommonBlockPool from BOPTools
is protected;
mySplitShapesPool : SplitShapesPool from BOPTools
is protected;
mySectionAttribute : SSIntersectionAttribute from BOPTools
is protected;
myNbSources : Integer from Standard
is protected;
myNbEdges : Integer from Standard
is protected;
myIsDone : Boolean from Standard
is protected;
myDSIt : IteratorOfCoupleOfShape from BOPTools
is protected;
myContext : Context from IntTools
is protected;
end PaveFiller;

File diff suppressed because it is too large Load Diff

View File

@@ -1,620 +0,0 @@
// Created on: 2001-03-13
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveFiller.ixx>
#include <Precision.hxx>
#include <SortTools_QuickSortOfReal.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TCollection_CompareOfReal.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_EdgeFace.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_CommonPrt.hxx>
#include <IntTools_SequenceOfRanges.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
#include <BooleanOperations_OnceExplorer.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_IteratorOfCoupleOfShape.hxx>
#include <BOPTools_VVInterference.hxx>
#include <BOPTools_VEInterference.hxx>
#include <BOPTools_EEInterference.hxx>
#include <BOPTools_CArray1OfVEInterference.hxx>
#include <BOPTools_CArray1OfVVInterference.hxx>
#include <BOPTools_CArray1OfEEInterference.hxx>
#include <BOPTools_Tools.hxx>
#include <BOPTools_Pave.hxx>
#include <BOPTools_PaveSet.hxx>
#include <BOPTools_PaveBlockIterator.hxx>
#include <BOPTools_ListOfPave.hxx>
#include <BOPTools_ListIteratorOfListOfPave.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_CommonBlock.hxx>
#include <BOPTools_ListOfCommonBlock.hxx>
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
#include <BOPTools_ESInterference.hxx>
#include <BOPTools_CommonBlockAPI.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfInterference.hxx>
#include <BOPTools_Interference.hxx>
#include <BOPTools_InterferenceLine.hxx>
#include <BOPTools_CArray1OfInterferenceLine.hxx>
#include <BOPTColStd_Failure.hxx>
#include <stdio.h>
//=======================================================================
// function: PerformEF
// purpose:
//=======================================================================
void BOPTools_PaveFiller::PerformEF()
{
myIsDone=Standard_False;
Standard_Integer n1, n2, anIndexIn=0, nE, nF, aNbEFs, aBlockLength;
BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
//
// E/F Interferences [BooleanOperations_EdgeFace]
myDSIt.Initialize(TopAbs_EDGE, TopAbs_FACE);
//
// BlockLength correction
aNbEFs=ExpectedPoolLength();
aBlockLength=aEFs.BlockLength();
if (aNbEFs > aBlockLength) {
aEFs.SetBlockLength(aNbEFs);
}
//
for (; myDSIt.More(); myDSIt.Next()) {
Standard_Boolean justaddinterference = Standard_True;
myDSIt.Current(n1, n2, justaddinterference);
if(justaddinterference) {
if (!myIntrPool->IsComputed(n1, n2)) {
anIndexIn = 0;
nE=n1;
nF=n2;
SortTypes(nE, nF);
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
}
continue;
}
//
if (myIntrPool->IsComputed(n1, n2)) {
continue;
}
//
nE=n1;
nF=n2;
SortTypes(nE, nF);
//
// ListOfCommonBlock for nE and CommonBlockAPI object to avoid
// CommonBlocks processing
BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
BOPTools_CommonBlockAPI aCBAPI(aLCB);
//
Standard_Real aTolE, aTolF, aDeflection=0.01;
Standard_Integer aDiscretize=35;
// modified by NIZHNY-MKK Thu Oct 27 12:31:45 2005
// const TopoDS_Edge& aE=TopoDS::Edge(myDS->GetShape(nE));
TopoDS_Edge aE=TopoDS::Edge(myDS->GetShape(nE));
//
if (BRep_Tool::Degenerated(aE)){
continue;
}
//
aTolE=BRep_Tool::Tolerance(aE);
// modified by NIZHNY-MKK Thu Oct 27 12:31:52 2005
// const TopoDS_Face& aF=TopoDS::Face(myDS->GetShape(nF));
TopoDS_Face aF=TopoDS::Face(myDS->GetShape(nF));
aTolF=BRep_Tool::Tolerance(aF);
// modified by NIZHNY-MKK Thu Oct 27 12:32:02 2005
// const Bnd_Box& aBBF=myDS->GetBoundingBox(nF);
Bnd_Box aBBF=myDS->GetBoundingBox(nF);
//
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
for (; anIt.More(); anIt.Next()) {
BOPTools_PaveBlock& aPB=anIt.Value();
if (aCBAPI.IsCommonBlock(aPB)) {
// avoid CommonBlocks processing
continue;
}
const IntTools_ShrunkRange& aShrunkRange=aPB.ShrunkRange();
const IntTools_Range& aSR =aShrunkRange.ShrunkRange();
const Bnd_Box& aBBE=aShrunkRange.BndBox();
//////////////////////////////////////////////
if (aBBF.IsOut (aBBE)) {
continue;
}
//
// EF
IntTools_EdgeFace aEF;
aEF.SetEdge (aE);
aEF.SetFace (aF);
aEF.SetTolE (aTolE);
aEF.SetTolF (aTolF);
aEF.SetDiscretize (aDiscretize);
aEF.SetDeflection (aDeflection);
//
aEF.SetContext(myContext);
//
BRepAdaptor_Curve aCurve(aE);
IntTools_Range anewSR = aSR;
//
// Correction of the Shrunk Range
//
BOPTools_Tools::CorrectRange(aE, aF, aSR, anewSR);
//
aEF.SetRange (anewSR);
//
aEF.Perform();
//
anIndexIn=0;
//
if (aEF.IsDone()) {
//
const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts();
Standard_Integer i, aNbCPrts;
aNbCPrts=aCPrts.Length();
// modified by NIZHNY-MKK Thu Aug 26 17:37:07 2004.BEGIN
if(aNbCPrts != 0) {
char buf[512];
if(!aShrunkRange.IsDone()) {
sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE);
throw BOPTColStd_Failure(buf) ;
}
}
// modified by NIZHNY-MKK Thu Aug 26 17:37:09 2004.END
for (i=1; i<=aNbCPrts; i++) {
const IntTools_CommonPrt& aCPart=aCPrts.Value(i);
//
anIndexIn=0;
//
TopAbs_ShapeEnum aType=aCPart.Type();
switch (aType) {
case TopAbs_VERTEX: {
Standard_Real aT;
Standard_Integer aNewShape;
const IntTools_Range& aR=aCPart.Range1();
Standard_Real aRFirst, aRLast;
aR.Range(aRFirst, aRLast);
aT=0.5*(aRFirst+aRLast);
if((aCPart.VertexParameter1() >= aRFirst) &&
(aCPart.VertexParameter1() <= aRLast)) {
aT = aCPart.VertexParameter1();
}
TopoDS_Vertex aNewVertex;
BOPTools_Tools::MakeNewVertex(aE, aT, aF,aNewVertex);
//
Standard_Boolean isonpave1, isonpave2;
Standard_Real aTolToDecide;
aTolToDecide=5.e-8;
// modified by NIZHNY-IFV Feb 15 2007
// for occ11565
//Check that whole edge belongs face
isonpave1 = (Abs(anewSR.First() - aRFirst) < aTolToDecide);
isonpave2 = (Abs(anewSR.Last() - aRLast) < aTolToDecide);
//++
if(isonpave1 && isonpave2) {
//Seems whole edge belongs face
Standard_Boolean aCoinsideFlag =
BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext);
if (aCoinsideFlag) {
//
// Add Interference to the Pool
IntTools_CommonPrt aCP = aCPart;
aCP.SetType(TopAbs_EDGE);
BOPTools_ESInterference anInterf (nE, nF, aCP);
anIndexIn=aEFs.Append(anInterf);
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
//
BOPTools_CommonBlock aCB(aPB, nF);
aLCB.Append(aCB);
break;
}
}
// modified by NIZHNY-IFV Feb 15 2007. end
//
//decide to add pave or not.begin
isonpave1 = (Abs(anewSR.First() - aT) < aTolToDecide);
isonpave2 = (Abs(anewSR.Last() - aT) < aTolToDecide);
// modified by NIZHNY-MKK Wed Nov 6 14:43:07 2002.BEGIN
if(!isonpave1 && !isonpave2) {
isonpave1 = (Abs(anewSR.First() - aR.First()) < aTolToDecide);
isonpave2 = (Abs(anewSR.Last() - aR.Last()) < aTolToDecide);
}
// modified by NIZHNY-MKK Wed Nov 6 14:43:11 2002.END
//++
{
Standard_Integer nVP1, nVP2;
Standard_Boolean bIsComputed;
// Pave 1
const BOPTools_Pave& aPave1=aPB.Pave1();
nVP1=aPave1.Index();
bIsComputed=Standard_True;
if (nVP1 <= myNbSources) {
if(((nVP1 <= myDS->NumberOfShapesOfTheObject()) &&
(nF <= myDS->NumberOfShapesOfTheObject())) ||
((nVP1 > myDS->NumberOfShapesOfTheObject()) &&
(nF > myDS->NumberOfShapesOfTheObject()))) {
bIsComputed=myIntrPool->IsComputed(nVP1, nE);
if (!bIsComputed) {
bIsComputed=IsSuccesstorsComputed(nVP1, nE);
}
}
else {
bIsComputed=myIntrPool->IsComputed(nVP1, nF);
if (!bIsComputed) {
bIsComputed=IsSuccesstorsComputed(nVP1, nF);
}
}
}
if (bIsComputed && isonpave1) {
//
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
const TopoDS_Vertex& aVF = TopoDS::Vertex(myDS->Shape(nVP1));
BOPTools_Tools::UpdateVertex(aE, aT, aVF);
continue;
}
// Pave 2
const BOPTools_Pave& aPave2=aPB.Pave2();
nVP2=aPave2.Index();
bIsComputed=Standard_True;
if (nVP2 <= myNbSources) {
if((nVP2 <= myDS->NumberOfShapesOfTheObject() &&
nF <= myDS->NumberOfShapesOfTheObject()) ||
(nVP2 > myDS->NumberOfShapesOfTheObject() &&
nF > myDS->NumberOfShapesOfTheObject())) {
bIsComputed=myIntrPool->IsComputed(nVP2, nE);
if (!bIsComputed) {
bIsComputed=IsSuccesstorsComputed(nVP2, nE);
}
}
else {
bIsComputed=myIntrPool->IsComputed(nVP2, nF);
if (!bIsComputed) {
bIsComputed=IsSuccesstorsComputed(nVP2, nF);
}
}
}
if (bIsComputed && isonpave2) {
//
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
const TopoDS_Vertex& aVF = TopoDS::Vertex(myDS->Shape(nVP2));
BOPTools_Tools::UpdateVertex(aE, aT, aVF);
continue;
}
}
//decide to add pave or not.end
//
// Insert New Vertex in DS;
// aNewShape is # of DS-line, where aNewVertex is kept
//
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
//
Standard_Integer nVF, iFlag;
nVF=CheckFacePaves(aNewVertex, nF);
if (nVF) {
const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
Standard_Real aTNew;
//
iFlag=myContext->ComputeVE(aVF, aE, aTNew);
//
aT=aTNew;
aNewShape=nVF;
BOPTools_Tools::UpdateVertex(aVF, aNewVertex);
}
//
else {
myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq);
aNewShape=myDS->NumberOfInsertedShapes();
}
//
// Add Interference to the Pool
BOPTools_ESInterference anInterf (nE, nF, aCPart);
anIndexIn=aEFs.Append(anInterf);
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
//
// State of the new Vertex is ON
myDS->SetState (aNewShape, BooleanOperations_ON);
//
// Insert New Vertex in EE Interference
BOPTools_ESInterference& aESInterf= aEFs(anIndexIn);
aESInterf.SetNewShape(aNewShape);
//
// Add Pave to the myPavePoolNew
BOPTools_Pave aPave;
aPave.SetInterference(anIndexIn);
aPave.SetType (BooleanOperations_EdgeSurface);
aPave.SetIndex(aNewShape);
aPave.SetParam(aT);
BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE));
aPaveSet.Append(aPave);
}// case TopAbs_VERTEX:
break;
case TopAbs_EDGE: {
Standard_Boolean aCoinsideFlag;
aCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext);
if (!aCoinsideFlag) {
//
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
break;
}
// Add Interference to the Pool
BOPTools_ESInterference anInterf (nE, nF, aCPart);
anIndexIn=aEFs.Append(anInterf);
myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn);
//
BOPTools_CommonBlock aCB(aPB, nF);
aLCB.Append(aCB);
}// case TopAbs_EDGE:
break;
default:
break;
} // switch (aType)
} // for (i=1; i<=aNbCPrts; i++)
} //if (aEF.IsDone())
} // for (; anIt.More(); anIt.Next())
}// for (; myDSIt.More(); myDSIt.Next())
myIsDone=Standard_True;
}
//=======================================================================
// function: DoSDEdges
// purpose:
//=======================================================================
void BOPTools_PaveFiller::DoSDEdges()
{
myIsDone=Standard_False;
Standard_Integer aNbObj, nEObj, nETool, aSplitIndexObj, aSplitIndexTool;
TopAbs_ShapeEnum aType;
aNbObj=myDS->NumberOfShapesOfTheObject();
for (nEObj=1; nEObj<=aNbObj; nEObj++) {
// modified by NIZHNY-MKK Thu Oct 27 12:32:37 2005
// const TopoDS_Shape& aS=myDS->GetShape(nEObj);
TopoDS_Shape aS=myDS->GetShape(nEObj);
aType=aS.ShapeType();
if (aType==TopAbs_EDGE) {
//ZZ const TopoDS_Edge& aE=TopoDS::Edge(myDS->GetShape(nEObj));
BOPTools_ListOfCommonBlock& aLCBObj=myCommonBlockPool(myDS->RefEdge(nEObj));
BOPTools_ListIteratorOfListOfCommonBlock anItCBObj(aLCBObj);
for (; anItCBObj.More(); anItCBObj.Next()) {
BOPTools_CommonBlock& aCBObj=anItCBObj.Value();
if (aCBObj.Face()) {
continue;
}
BOPTools_PaveBlock& aPBObj1=aCBObj.PaveBlock1(nEObj);
BOPTools_PaveBlock& aPBObj2=aCBObj.PaveBlock2(nEObj);
//
// Tool
nETool=aPBObj2.OriginalEdge();
BOPTools_ListOfCommonBlock& aLCBTool=myCommonBlockPool(myDS->RefEdge(nETool));
BOPTools_ListIteratorOfListOfCommonBlock anItCBTool(aLCBTool);
for (; anItCBTool.More(); anItCBTool.Next()) {
BOPTools_CommonBlock& aCBTool=anItCBTool.Value();
BOPTools_PaveBlock& aPBTool1=aCBTool.PaveBlock1(nETool);
BOPTools_PaveBlock& aPBTool2=aCBTool.PaveBlock2(nETool);
if (aPBTool1.IsEqual(aPBObj2) && aPBTool2.IsEqual(aPBObj1)) {
//
// That is aCBObj==aCBTool
// Find SplitIndices in DS for aPBObj1 and aPBTool1
aSplitIndexObj =SplitIndex(aPBObj1);
aSplitIndexTool=SplitIndex(aPBTool1);
if (aSplitIndexObj && aSplitIndexTool) {
aPBObj1. SetEdge(aSplitIndexObj);
aPBObj2. SetEdge(aSplitIndexTool);
aPBTool1.SetEdge(aSplitIndexTool);
aPBTool2.SetEdge(aSplitIndexObj);
break;
}
else {
//error: can not find SplitIndex
throw
BOPTColStd_Failure(" BOPTools_PaveFiller::DoSDEdges()=> can not find SplitIndex");
myIsDone=Standard_False;
return;
}
} // if (aPBTool1.IsEqual(aPBObj2) && aPBTool2.IsEqual(aPBObj1))
} // for (; anItCBTool.More(); anItCBTool.Next())
} // for (; anItCBObj.More(); anItCBObj.Next())
} // if (aType==TopAbs_EDGE)
} // for (nEObj=1; nEObj<=aNbObj; nEObj++)
//
// 2. EF CommonBlocks
//
Standard_Integer nE, aSplitIndex;
for (nE=1; nE<=myNbSources; nE++) {
// modified by NIZHNY-MKK Thu Oct 27 12:32:57 2005
// const TopoDS_Shape& aS=myDS->GetShape(nE);
TopoDS_Shape aS=myDS->GetShape(nE);
aType=aS.ShapeType();
if (aType==TopAbs_EDGE) {
//ZZ const TopoDS_Edge& aE=TopoDS::Edge(myDS->GetShape(nE));
BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
BOPTools_CommonBlock& aCB=anItCB.Value();
if (aCB.Face()) {
BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
aSplitIndex =SplitIndex(aPB);
if (aSplitIndex) {
aPB.SetEdge(aSplitIndex);
//break;
}
else {
//error: can not find SplitIndex
throw
BOPTColStd_Failure(" BOPTools_PaveFiller::DoSDEdges()=> can not find SplitIndex");
myIsDone=Standard_False;
return;
}
}
}
}
}
myIsDone=Standard_True;
}
//=======================================================================
// function: SplitIndex
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitIndex(const BOPTools_PaveBlock& aPBx)
{
Standard_Integer anOriginalEdge, anEdgeIndex=0;
anOriginalEdge=aPBx.OriginalEdge();
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
for (; anIt.More(); anIt.Next()) {
BOPTools_PaveBlock& aPB=anIt.Value();
if (aPB.IsEqual(aPBx)) {
anEdgeIndex=aPB.Edge();
return anEdgeIndex;
}
}
return anEdgeIndex;
}
//=======================================================================
// function: CheckFacePaves
// purpose:
//=======================================================================
Standard_Integer BOPTools_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aNewVertex,
const Standard_Integer nF)
{
Standard_Integer nEF, nVF, iFlag;
BOPTools_ListIteratorOfListOfPave anIt;
// 1.
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nEF=aExp.Current();
BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nEF));
const BOPTools_ListOfPave& aLP=aPaveSet.Set();
anIt.Initialize(aLP);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Pave& aPave=anIt.Value();
nVF=aPave.Index();
const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF);
if (!iFlag) {
return nVF;
}
}
}
//
// 2.
aExp.Init(nF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nEF=aExp.Current();
BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(nEF));
const BOPTools_ListOfPave& aLP=aPaveSet.Set();
anIt.Initialize(aLP);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Pave& aPave=anIt.Value();
nVF=aPave.Index();
const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF));
iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF);
if (!iFlag) {
return nVF;
}
}
}
return 0;
}
//

View File

@@ -1,339 +0,0 @@
// Created on: 2001-03-27
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveFiller.ixx>
#include <TColStd_ListOfInteger.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_OnceExplorer.hxx>
#include <BOPTools_ListOfCommonBlock.hxx>
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
#include <BOPTools_CommonBlock.hxx>
//=======================================================================
// A P I F U N C T I O N S
//=======================================================================
// function: SplitsInFace
// purpose: splits of edges from nF1 in nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
const Standard_Integer nF1,
const Standard_Integer nF2,
TColStd_ListOfInteger& aSplits)
{
Standard_Integer nE1;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nF1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE1=aExp.Current();
SplitsInFace (nE1, nF2, aSplits);
}
return 0; //Ok
}
//=======================================================================
// function: SplitsInFace
// purpose: splits of edge nE1 in aFace2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
const Standard_Integer nF2,
TColStd_ListOfInteger& aSplits)
{
Standard_Integer nF1, nSp;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
BOPTools_CommonBlock& aCB=anItCB.Value();
BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
nF1=aCB.Face();
if (nF1==nF2) {
nSp=aPB1.Edge();
aSplits.Append(nSp);
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnEdge
// purpose: splits of edge nE1 on nE2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
const Standard_Integer nE2,
TColStd_ListOfInteger& aSplits)
{
Standard_Integer nE, nSp;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nE2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
return 1; // Type mismatch
}
const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
BOPTools_CommonBlock& aCB=anItCB.Value();
BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1);
nE=aPB2.OriginalEdge();
if (nE==nE2) {
nSp=aPB1.Edge();
aSplits.Append(nSp);
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnFace
// purpose: splits of edge nE1 on face nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
const Standard_Integer nF2,
TColStd_ListOfInteger& aSplits)
{
Standard_Integer nE2, ip;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF2, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE2=aExp.Current();
ip=SplitsOnEdge(nE1, nE2, aSplits);
if (ip) {
return ip;
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnFace
// purpose: splits of edges from face nF1 on face nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
const Standard_Integer nF1,
const Standard_Integer nF2,
TColStd_ListOfInteger& aSplits)
{
Standard_Integer nE1, ip;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nF1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE1=aExp.Current();
ip=SplitsOnFace(nE1, nF2, aSplits);
if (ip) {
return ip;
}
}
return 0; //Ok
}
///////////////////////////////////////////////////////////////////////////////////
//=======================================================================
// function: SplitsInFace
// purpose: splits of edges from nF1 in nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
const Standard_Integer nF1,
const Standard_Integer nF2,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Integer nE1;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nF1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE1=aExp.Current();
SplitsInFace (nE1, nF2, aLPB);
}
return 0; //Ok
}
//=======================================================================
// function: SplitsInFace
// purpose: splits of edge nE1 in aFace2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
const Standard_Integer nF2,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Integer nF1;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
BOPTools_CommonBlock& aCB=anItCB.Value();
BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
nF1=aCB.Face();
if (nF1==nF2) {
aLPB.Append(aPB1);
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnEdge
// purpose: splits of edge nE1 on nE2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
const Standard_Integer nE2,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Integer nE;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nE2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
return 1; // Type mismatch
}
const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
BOPTools_CommonBlock& aCB=anItCB.Value();
//BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1);
nE=aPB2.OriginalEdge();
if (nE==nE2) {
//modified by NIZNHY-PKV Tue Apr 4 16:59:24 2006f
//aLPB.Append(aPB1);
const BOPTools_PaveBlock& aPB1R=aCB.PaveBlock1();
aLPB.Append(aPB1R);
//modified by NIZNHY-PKV Tue Apr 4 16:59:28 2006t
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnFace
// purpose: splits of edge nE1 on face nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
const Standard_Integer nF2,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Integer nE2, ip;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nE1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF2, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE2=aExp.Current();
ip=SplitsOnEdge(nE1, nE2, aLPB);
if (ip) {
return ip;
}
}
return 0; //Ok
}
//=======================================================================
// function: SplitsOnFace
// purpose: splits of edges from face nF1 on face nF2
//=======================================================================
Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
const Standard_Integer nF1,
const Standard_Integer nF2,
BOPTools_ListOfPaveBlock& aLPB)
{
Standard_Integer nE1, ip;
TopAbs_ShapeEnum aT1, aT2;
aT1=myDS->GetShapeType(nF1);
aT2=myDS->GetShapeType(nF2);
if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
return 1; // Type mismatch
}
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nE1=aExp.Current();
ip=SplitsOnFace(nE1, nF2, aLPB);
if (ip) {
return ip;
}
}
return 0; //Ok
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +0,0 @@
// Created on: 2002-02-22
// Created by: Peter KURNEV
// Copyright (c) 2002-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveFiller.ixx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopoDS_Shape.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_OnceExplorer.hxx>
#include <BooleanOperations_KindOfInterference.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <BOPTools_ListIteratorOfListOfInterference.hxx>
#include <BOPTools_CArray1OfInterferenceLine.hxx>
#include <BOPTools_InterferenceLine.hxx>
#include <BOPTools_ListOfInterference.hxx>
#include <BOPTools_Interference.hxx>
#include <BOPTools_PShapeShapeInterference.hxx>
static
void GetFullFaceMap(const Standard_Integer nF2,
const BOPTools_InterferencePool& myIntrPool,
TColStd_IndexedMapOfInteger& aMF2);
static
void GetInterferedVertices(const Standard_Integer nF1,
const TColStd_IndexedMapOfInteger& aMF2,
const BOPTools_InterferencePool& myIntrPool,
TColStd_IndexedMapOfInteger& aMV);
//=======================================================================
// function: StickVertices
// purpose:
//=======================================================================
void BOPTools_PaveFiller::StickVertices(const Standard_Integer nF1,
const Standard_Integer nF2,
TColStd_IndexedMapOfInteger& aMV)
{
Standard_Integer i, aNb, iEntity;
TColStd_IndexedMapOfInteger aMF1, aMF2;
//
GetFullFaceMap(nF1, *myIntrPool, aMF1);
GetFullFaceMap(nF2, *myIntrPool, aMF2);
//
aNb=aMF1.Extent();
for (i=1; i<=aNb; ++i) {
iEntity=aMF1(i);
GetInterferedVertices(iEntity, aMF2, *myIntrPool, aMV);
}
//
aNb=aMF2.Extent();
for (i=1; i<=aNb; ++i) {
iEntity=aMF2(i);
GetInterferedVertices(iEntity, aMF1, *myIntrPool, aMV);
}
}
//=======================================================================
// function: GetFullFaceMap
// purpose:
//=======================================================================
void GetFullFaceMap(const Standard_Integer nF2,
const BOPTools_InterferencePool& anIntrPool,
TColStd_IndexedMapOfInteger& aMF2)
{
Standard_Integer nEF2, nVF2;
//
aMF2.Add(nF2);
BooleanOperations_PShapesDataStructure myDS=anIntrPool.DS();
BooleanOperations_OnceExplorer aExp(*myDS);
aExp.Init(nF2, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
nEF2=aExp.Current();
aMF2.Add(nEF2);
}
//
aExp.Init(nF2, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
nVF2=aExp.Current();
aMF2.Add(nVF2);
}
}
//=======================================================================
// function: GetInterferedVertices
// purpose:
//=======================================================================
void GetInterferedVertices(const Standard_Integer nF1,
const TColStd_IndexedMapOfInteger& aMF2,
const BOPTools_InterferencePool& anIntrPool,
TColStd_IndexedMapOfInteger& aMV)
{
Standard_Integer aIndex, aNewShape, aWith;
BooleanOperations_KindOfInterference aType;
TopAbs_ShapeEnum aShapeType;
BOPTools_ListIteratorOfListOfInterference anIt;
BOPTools_PShapeShapeInterference pI;
//
BooleanOperations_PShapesDataStructure myDS=anIntrPool.DS();
const BOPTools_CArray1OfInterferenceLine& aITable= anIntrPool.InterferenceTable();
const BOPTools_InterferenceLine& aILineF1=aITable(nF1);
const BOPTools_ListOfInterference& aLIF1=aILineF1.RealList();
//
anIt.Initialize(aLIF1);
for (; anIt.More(); anIt.Next()) {
const BOPTools_Interference& anInterference=anIt.Value();
aWith=anInterference.With();
if (aMF2.Contains(aWith)) {
aIndex=anInterference.Index();
aType= anInterference.Type();
pI=anIntrPool.GetInterference(aIndex, aType);
if (pI!=NULL) {
//aNewShape=anIntrPool.NewShape(aIndex, aType);
aNewShape=pI->NewShape();
if (aNewShape) {
const TopoDS_Shape& aS=myDS->Shape(aNewShape);
aShapeType=aS.ShapeType();
if (aShapeType==TopAbs_VERTEX) {
aMV.Add(aNewShape);
}
}
}
}
}
}

View File

@@ -1,62 +0,0 @@
-- Created on: 2001-02-08
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PaveSet from BOPTools
---Purpose:
-- class for storing/sorting paves that
-- belong to an edge
uses
ListOfPave from BOPTools,
Pave from BOPTools
is
Create
returns PaveSet from BOPTools;
---Purpose:
--- Empty constructor
---
ChangeSet(me:out)
returns ListOfPave from BOPTools;
---C++: return &
---Purpose:
--- Access to the list
---
Set(me)
returns ListOfPave from BOPTools;
---C++: return const &
---Purpose:
--- Access to the list const
---
Append (me:out; aPave:Pave from BOPTools);
---Purpose:
--- Appends <aPave> to the list
---
SortSet (me:out);
---Purpose:
--- Sorts list in increasing order of paves' parameters
---
fields
myPaveList: ListOfPave from BOPTools;
end PaveSet;

View File

@@ -1,95 +0,0 @@
// Created on: 2001-02-08
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PaveSet.ixx>
#include <BOPTools_Array1OfPave.hxx>
#include <BOPTools_ListIteratorOfListOfPave.hxx>
#include <BOPTools_QuickSortPave.hxx>
#include <BOPTools_ComparePave.hxx>
#ifdef WNT
#pragma warning ( disable : 4101 )
#endif
//=======================================================================
// function: BOPTools_PaveSet::BOPTools_PaveSet
// purpose:
//=======================================================================
BOPTools_PaveSet::BOPTools_PaveSet() {}
//=======================================================================
// function: ChangeSet
// purpose:
//=======================================================================
BOPTools_ListOfPave& BOPTools_PaveSet::ChangeSet()
{
return myPaveList;
}
//=======================================================================
// function: Set
// purpose:
//=======================================================================
const BOPTools_ListOfPave& BOPTools_PaveSet::Set() const
{
return myPaveList;
}
//=======================================================================
// function: Append
// purpose:
//=======================================================================
void BOPTools_PaveSet::Append(const BOPTools_Pave& aPave)
{
myPaveList.Append(aPave);
}
//=======================================================================
// function: SortSet
// purpose:
//=======================================================================
void BOPTools_PaveSet::SortSet()
{
// Not implemented yet
Standard_Integer aNbPaves, i;
aNbPaves=myPaveList.Extent();
if (aNbPaves>1) {
BOPTools_Array1OfPave anArray1OfPave (1, aNbPaves);
BOPTools_ListIteratorOfListOfPave anIt(myPaveList);
for (i=1; anIt.More(); anIt.Next(), i++) {
const BOPTools_Pave& aPave=anIt.Value();
anArray1OfPave(i)=aPave;
}
BOPTools_QuickSortPave aQuickSortPave;
BOPTools_ComparePave aComparePave;
aQuickSortPave.Sort (anArray1OfPave, aComparePave);
myPaveList.Clear();
for (i=1; i<=aNbPaves; i++){
const BOPTools_Pave& aPave=anArray1OfPave(i);
myPaveList.Append (aPave);
}
}
}
#ifdef WNT
#pragma warning ( default : 4101 )
#endif

View File

@@ -1,84 +0,0 @@
-- Created on: 2001-04-19
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class PointBetween from BOPTools
---Purpose:
-- class for storing geometry information about
-- a point between neighbouring paves along
-- an edge
---
uses
Pnt from gp
is
Create
returns PointBetween from BOPTools;
---Purpose:
--- Empty constructor
---
SetParameter (me:out;
T:Real from Standard);
---Purpose:
--- Modifier
--- sets value of the point's parameter on the edge
---
SetUV (me:out;
U:Real from Standard;
V:Real from Standard);
---Purpose:
--- Modifier
--- sets values of the point's parameter on the face
---
SetPnt (me:out;
aP:Pnt from gp);
---Purpose:
--- Modifier
--- sets the 3D-point
---
Parameter (me)
returns Real from Standard ;
---Purpose:
--- Selector
---
UV (me;
U:out Real from Standard;
V:out Real from Standard);
---Purpose:
--- Selector
---
Pnt (me)
returns Pnt from gp;
---C++: return const &
---Purpose:
--- Selector
---
fields
myT : Real from Standard;
myU : Real from Standard;
myV : Real from Standard;
myPnt: Pnt from gp;
end PointBetween;

View File

@@ -1,90 +0,0 @@
// Created on: 2001-04-19
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_PointBetween.ixx>
//=======================================================================
// function: BOPTools_PointBetween:: BOPTools_PointBetween
// purpose:
//=======================================================================
BOPTools_PointBetween::BOPTools_PointBetween()
:
myT(0.),
myU(0.),
myV(0.)
{}
//=======================================================================
// function: SetParameter
// purpose:
//=======================================================================
void BOPTools_PointBetween::SetParameter(const Standard_Real aT)
{
myT=aT;
}
//=======================================================================
// function: Parameter
// purpose:
//=======================================================================
Standard_Real BOPTools_PointBetween::Parameter()const
{
return myT;
}
//=======================================================================
// function: SetUV
// purpose:
//=======================================================================
void BOPTools_PointBetween::SetUV(const Standard_Real aU,
const Standard_Real aV)
{
myU=aU;
myV=aV;
}
//=======================================================================
// function: UV
// purpose:
//=======================================================================
void BOPTools_PointBetween::UV(Standard_Real& aU,
Standard_Real& aV) const
{
aU=myU;
aV=myV;
}
//=======================================================================
// function: SetPnt
// purpose:
//=======================================================================
void BOPTools_PointBetween::SetPnt (const gp_Pnt& aP)
{
myPnt=aP;
}
//=======================================================================
// function: Pnt
// purpose:
//=======================================================================
const gp_Pnt& BOPTools_PointBetween::Pnt () const
{
return myPnt;
}

View File

@@ -1,97 +0,0 @@
-- Created on: 2000-11-24
-- Created by: Michael KLOKOV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class RoughShapeIntersector from BOPTools
---Purpose: The class RoughShapeIntersector describes the algorithm of
-- intersection of bounding boxes of
-- shapes stored in ShapesDataStructure.
-- It stores statuses of intersection in 2 dimension array.
uses
Array1OfListOfInteger from TColStd,
ListOfInteger from TColStd,
HArray2OfIntersectionStatus from BOPTools,
IntersectionStatus from BOPTools,
HArray1OfBox from Bnd,
PShapesDataStructure from BooleanOperations
is
Create(PDS: PShapesDataStructure from BooleanOperations)
returns RoughShapeIntersector from BOPTools;
---Purpose:
-- Initializes algorithm by shapes data structure
--
Perform(me: in out);
---Purpose:
-- Perform computations.
--
-- Warning:
-- Using this function, after the destructor of
-- the object pointed by PDS (see constructor)
-- was invoked, lead to crash.
--
TableOfStatus(me)
returns HArray2OfIntersectionStatus from BOPTools;
---C++: return const &
---Purpose:
-- Returns 2 dimension array of status flags.
-- First indices of the array corresponds to indices of
-- subshapes of Object of myPDS.
-- Second indices of array corresponds to indices of
-- subshapes of Tool of myPDS.
--
IsDone(me) returns Boolean from Standard;
---Purpose:
-- Returns False if some errors occured during
-- computations or method Perform
-- was not invoked before,
-- otherwise returns True.
--
-- private methods
Prepare(me: in out)
is private;
PropagateForSuccessors1(me: in out; AncestorsIndex1: Integer from Standard;
AncestorsIndex2: Integer from Standard;
theStatus : IntersectionStatus from BOPTools)
is private;
PropagateForSuccessors2(me: in out; AncestorsIndex1: Integer from Standard;
AncestorsIndex2: Integer from Standard;
theStatus : IntersectionStatus from BOPTools)
is private;
fields
myPDS: PShapesDataStructure from BooleanOperations;
myBoundingBoxes: HArray1OfBox from Bnd;
myTableOfStatus: HArray2OfIntersectionStatus from BOPTools;
---Purpose: First indices of array corresponds to indices of subshapes of Object of myPDS.
-- Second indices of array corresponds to indices of subshapes of Tool of myPDS.
myIsDone: Boolean from Standard;
end RoughShapeIntersector from BOPTools;

View File

@@ -1,239 +0,0 @@
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_RoughShapeIntersector.ixx>
#include <TopExp_Explorer.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_Array1OfListOfInteger.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <Bnd_Box.hxx>
static Standard_Integer TypeToIndex(const TopAbs_ShapeEnum& theType);
static Bnd_Box GetBoxEnlargedBySubShape(const Standard_Integer theIndex,
const BooleanOperations_PShapesDataStructure& PDS);
// =============================================================================================
// function: Constructor
// =============================================================================================
BOPTools_RoughShapeIntersector::BOPTools_RoughShapeIntersector(const BooleanOperations_PShapesDataStructure& PDS)
:
myIsDone(Standard_False)
{
myPDS = PDS;
}
// =============================================================================================
// function: Perform
// =============================================================================================
void BOPTools_RoughShapeIntersector::Perform()
{
myIsDone = Standard_True;
Prepare();
// check flag myIsDone after Prepare() function
if(!myIsDone)
return;
TColStd_ListOfInteger thelist;
TColStd_Array1OfListOfInteger aSortedByTypeShapes1(TypeToIndex(TopAbs_COMPOUND), TypeToIndex(TopAbs_VERTEX));
aSortedByTypeShapes1.Init(thelist);
TColStd_ListOfInteger thelist1;
TColStd_Array1OfListOfInteger aSortedByTypeShapes2(TypeToIndex(TopAbs_COMPOUND), TypeToIndex(TopAbs_VERTEX));
aSortedByTypeShapes2.Init(thelist1);
Standard_Integer k = 0;
for(k = myTableOfStatus->LowerRow(); k <= myTableOfStatus->UpperRow(); k++) {
aSortedByTypeShapes1(TypeToIndex(myPDS->GetShapeType(k))).Append(k);
}
for(k = myTableOfStatus->LowerCol(); k <= myTableOfStatus->UpperCol(); k++) {
aSortedByTypeShapes2(TypeToIndex(myPDS->GetShapeType(k))).Append(k);
}
//
Standard_Integer aStartIndex = TypeToIndex(TopAbs_COMPOUND);
Standard_Integer anEndIndex = TypeToIndex(TopAbs_VERTEX);
for(Standard_Integer index1 = aStartIndex; index1 <= anEndIndex; index1++) {
//
if(aSortedByTypeShapes1(index1).IsEmpty())
continue;
for(Standard_Integer index2 = aStartIndex; index2 <= anEndIndex; index2++) {
if(aSortedByTypeShapes2(index2).IsEmpty())
continue;
TColStd_ListIteratorOfListOfInteger anIt1;
TColStd_ListIteratorOfListOfInteger anIt2;
for(anIt1.Initialize(aSortedByTypeShapes1.Value(index1)); anIt1.More(); anIt1.Next()) {
for(anIt2.Initialize(aSortedByTypeShapes2.Value(index2)); anIt2.More(); anIt2.Next()) {
//
BOPTools_IntersectionStatus aStatus = myTableOfStatus->Value(anIt1.Value(), anIt2.Value());
if(aStatus != BOPTools_UNKNOWN && aStatus != BOPTools_BOUNDINGBOXOFSUBSHAPESINTERSECTED)
continue;
const Bnd_Box& B1 = myBoundingBoxes->Value(anIt1.Value());
const Bnd_Box& B2 = myBoundingBoxes->Value(anIt2.Value());
//
BOPTools_IntersectionStatus aNewValue = BOPTools_BOUNDINGBOXINTERSECTED;
if(B1.IsOut(B2)) {
aNewValue = BOPTools_NONINTERSECTED;
//
PropagateForSuccessors1(anIt1.Value(), anIt2.Value(), aNewValue);
//
}
else {
aNewValue = BOPTools_BOUNDINGBOXINTERSECTED;
const Bnd_Box& BB1 = myPDS->GetBoundingBox(anIt1.Value());
const Bnd_Box& BB2 = myPDS->GetBoundingBox(anIt2.Value());
if(BB1.IsOut(BB2)) {
aNewValue = BOPTools_BOUNDINGBOXOFSUBSHAPESINTERSECTED;
}
}
// It is important to place this line after Propagation
myTableOfStatus->ChangeValue(anIt1.Value(), anIt2.Value()) = aNewValue;
}
}
}
}
}
// =============================================================================================
// function: TableOfStatus
// =============================================================================================
const Handle(BOPTools_HArray2OfIntersectionStatus)& BOPTools_RoughShapeIntersector::TableOfStatus() const
{
return myTableOfStatus;
}
// =============================================================================================
// function: Prepare
// =============================================================================================
void BOPTools_RoughShapeIntersector::Prepare()
{
myIsDone = Standard_False;
if(!myTableOfStatus.IsNull() &&
(myPDS != NULL) &&
(myTableOfStatus->LowerRow() == 1) &&
(myTableOfStatus->UpperRow() == myPDS->NumberOfShapesOfTheObject()) &&
(myTableOfStatus->LowerCol() == myPDS->NumberOfShapesOfTheObject() + 1) &&
(myTableOfStatus->UpperCol() == myPDS->NumberOfShapesOfTheObject() + myPDS->NumberOfShapesOfTheTool())) {
myIsDone = Standard_True;
}
else {
if(myPDS != NULL) {
Standard_Integer firstlowerindex = 1;
Standard_Integer firstupperindex = myPDS->NumberOfShapesOfTheObject();
Standard_Integer secondlowerindex = myPDS->NumberOfShapesOfTheObject() + 1;
Standard_Integer secondupperindex = myPDS->NumberOfShapesOfTheTool() + myPDS->NumberOfShapesOfTheObject();
myTableOfStatus = new BOPTools_HArray2OfIntersectionStatus(firstlowerindex, firstupperindex,
secondlowerindex, secondupperindex);
myIsDone = Standard_True;
}
}
if(!myIsDone)
return;
myTableOfStatus->Init(BOPTools_UNKNOWN);
//
myBoundingBoxes = new Bnd_HArray1OfBox(1, myPDS->NumberOfSourceShapes());
for(Standard_Integer i = 1; i <= myPDS->NumberOfSourceShapes(); i++) {
const Bnd_Box& aBox = GetBoxEnlargedBySubShape(i, myPDS);
myBoundingBoxes->SetValue(i, aBox);
}
}
// =============================================================================================
// function: IsDone
// =============================================================================================
Standard_Boolean BOPTools_RoughShapeIntersector::IsDone() const
{
return myIsDone;
}
// =============================================================================================
// function: PropagateForSuccessors1
// =============================================================================================
void BOPTools_RoughShapeIntersector::PropagateForSuccessors1(const Standard_Integer AncestorsIndex1,
const Standard_Integer AncestorsIndex2,
const BOPTools_IntersectionStatus theStatus)
{
if(myTableOfStatus->Value(AncestorsIndex1, AncestorsIndex2) != BOPTools_UNKNOWN)
return;
myTableOfStatus->ChangeValue(AncestorsIndex1, AncestorsIndex2) = theStatus;
PropagateForSuccessors2(AncestorsIndex1, AncestorsIndex2, theStatus);
Standard_Integer i = 1;
for(i = 1; i <= myPDS->NumberOfSuccessors(AncestorsIndex1); i++) {
Standard_Integer asuccessor1 = myPDS->GetSuccessor(AncestorsIndex1, i);
PropagateForSuccessors1(asuccessor1, AncestorsIndex2, theStatus);
}
}
// =============================================================================================
// function: PropagateForSuccessors2
// =============================================================================================
void BOPTools_RoughShapeIntersector::PropagateForSuccessors2(const Standard_Integer AncestorsIndex1,
const Standard_Integer AncestorsIndex2,
const BOPTools_IntersectionStatus theStatus)
{
for(Standard_Integer j = 1; j <= myPDS->NumberOfSuccessors(AncestorsIndex2); j++) {
Standard_Integer asuccessor2 = myPDS->GetSuccessor(AncestorsIndex2, j);
if(myTableOfStatus->Value(AncestorsIndex1, asuccessor2) == BOPTools_UNKNOWN) {
myTableOfStatus->ChangeValue(AncestorsIndex1, asuccessor2) = theStatus;
PropagateForSuccessors2(AncestorsIndex1, asuccessor2, theStatus);
}
}
}
// =============================================================================================
// function: TypeToIndex
// =============================================================================================
Standard_Integer TypeToIndex(const TopAbs_ShapeEnum& theType) {
return (Standard_Integer) theType;
}
// =============================================================================================
// function: GetBoxEnlargedBySubShape
// =============================================================================================
Bnd_Box GetBoxEnlargedBySubShape(const Standard_Integer theIndex,
const BooleanOperations_PShapesDataStructure& PDS) {
Bnd_Box aBox = PDS->GetBoundingBox(theIndex);
for(Standard_Integer i=1; i<= PDS->NumberOfSuccessors(theIndex); i++) {
Standard_Integer asuccessorindex = PDS->GetSuccessor(theIndex, i);
aBox.Add(GetBoxEnlargedBySubShape(asuccessorindex, PDS));
}
return aBox;
}

View File

@@ -1,187 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class SSInterference from BOPTools
inherits ShapeShapeInterference from BOPTools
---Purpose: class for storing a Face/Face interference
--- Each F/F interference contains information about
--- 1. myPBs - PaveBlocks (made from edges from the faces
--- that are IN-2D or ON-2D;
--- 2. myCurves- Sequence of curves of intersection;
--- 3. myTangentFacesFlag - The BOOL flag indicates that
--- the faces are SD in terms of the F/F Intersector.
--- 4. mySenseFlag - value that is equal +1 or -1 depending
--- on scalar product between normals to each face. This
--- valie is valid for the SDF only.
--- 5. myAlonePnts - contains 3D-points that are place
--- of intersection between the two faces
--- 6. myAloneVertices - contains indices of vertices
--- that correspond to the points myAlonePnts;
---
uses
PaveBlock from BOPTools,
PaveSet from BOPTools,
ListOfPaveBlock from BOPTools,
SequenceOfCurves from BOPTools,
IndexedDataMapOfIntegerState from BOPTools,
SequenceOfCurves from IntTools,
SequenceOfPntOn2Faces from IntTools,
ListOfInteger from TColStd
--
is
Create
returns SSInterference from BOPTools;
---Purpose:
--- Empty constructor
---
Create (anIndex1: Integer from Standard;
anIndex2: Integer from Standard;
aTolR3D : Real from Standard;
aTolR2D : Real from Standard;
aCurves : SequenceOfCurves from IntTools;
aPnts : SequenceOfPntOn2Faces from IntTools)
returns SSInterference from BOPTools;
---Purpose:
--- Constructor
--- anIndex1,
--- anIndex2 see BOPTools_ShapeShapeInterference for details
--- aTolR3D - value of tolerance to reach in 3D-space
--- aTolR2D - value of tolerance to reach in 2D-space
--- aCurves see IntTools_Curve for details, please
---
AppendBlock(me:out;
aPB:PaveBlock from BOPTools);
---Purpose:
--- Modifier
---
PaveBlocks(me)
returns ListOfPaveBlock from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
NewPaveSet(me:out)
returns PaveSet from BOPTools;
---C++: return &
---Purpose:
--- Selector
---
TolR3D (me)
returns Real from Standard;
---Purpose:
--- Selector
---
TolR2D (me)
returns Real from Standard;
---Purpose:
--- Selector
---
Curves(me:out)
returns SequenceOfCurves from BOPTools;
---C++: return &
---Purpose:
--- Selector
---
SetTangentFacesFlag(me:out;
aFlag:Boolean from Standard);
---Purpose:
--- Modifier
---
IsTangentFaces(me)
returns Boolean from Standard;
---Purpose:
--- Selector
---
SetSenseFlag (me:out;
aFlag:Integer from Standard);
---Purpose:
--- Modifier
---
SenseFlag (me)
returns Integer from Standard;
---Purpose:
--- Selector
---
SetStatesMap(me:out;
aStatesMap: IndexedDataMapOfIntegerState from BOPTools);
---Purpose:
--- Modifier
---
StatesMap(me)
returns IndexedDataMapOfIntegerState from BOPTools;
---C++: return const &
---Purpose:
--- Selector
---
SetAlonePnts(me:out;
aPnts:SequenceOfPntOn2Faces from IntTools);
---Purpose:
--- Modifier
---
AlonePnts(me)
returns SequenceOfPntOn2Faces from IntTools;
---C++: return const &
---Purpose:
--- Selector
---
AloneVertices(me:out)
returns ListOfInteger from TColStd;
---C++: return &
---Purpose:
--- Selector
---
--modified by NIZNHY-PKV Fri Jun 30 10:05:36 2006f
SetSharedEdges(me:out;
aLS:ListOfInteger from TColStd);
---Purpose:
--- Modifier
---
SharedEdges(me)
returns ListOfInteger from TColStd;
---C++: return const &
---Purpose:
--- Selector
---
--modified by NIZNHY-PKV Fri Jun 30 10:05:41 2006t
fields
myPBs : ListOfPaveBlock from BOPTools is protected;
myNewPaveSet : PaveSet from BOPTools is protected;
myTolR3D : Real from Standard is protected;
myTolR2D : Real from Standard is protected;
myCurves : SequenceOfCurves from BOPTools is protected;
myAlonePnts : SequenceOfPntOn2Faces from IntTools is protected;
myAloneVertices : ListOfInteger from TColStd is protected;
myTangentFacesFlag : Boolean from Standard is protected;
mySenseFlag : Integer from Standard is protected;
myStatesMap : IndexedDataMapOfIntegerState from BOPTools is protected;
--modified by NIZNHY-PKV Fri Jun 30 10:02:27 2006f
mySharedEdges : ListOfInteger from TColStd is protected;
--modified by NIZNHY-PKV Fri Jun 30 10:02:34 2006
end SSInterference;

View File

@@ -1,265 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_SSInterference.ixx>
#include <IntTools_Curve.hxx>
#include <IntTools_SequenceOfCurves.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_PntOn2Faces.hxx>
#include <BOPTools_Curve.hxx>
//modified by NIZNHY-PKV Fri Jun 30 10:08:51 2006
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
//=======================================================================
//function : BOPTools_SSInterference
//purpose :
//=======================================================================
BOPTools_SSInterference::BOPTools_SSInterference()
:
BOPTools_ShapeShapeInterference(0, 0),
myTangentFacesFlag(Standard_False),
mySenseFlag(0)
{}
//=======================================================================
//function : BOPTools_SSInterference::BOPTools_SSInterference
//purpose :
//=======================================================================
BOPTools_SSInterference::BOPTools_SSInterference
(const Standard_Integer anIndex1,
const Standard_Integer anIndex2,
const Standard_Real aTolR3D,
const Standard_Real aTolR2D,
const IntTools_SequenceOfCurves& aCvs,
const IntTools_SequenceOfPntOn2Faces& aPnts)
:
BOPTools_ShapeShapeInterference(anIndex1, anIndex2),
myTangentFacesFlag(Standard_False),
mySenseFlag(0)
{
myTolR3D=aTolR3D;
myTolR2D=aTolR2D;
myCurves.Clear();
Standard_Integer i, aNbCurves;
aNbCurves=aCvs.Length();
for (i=1; i<=aNbCurves; i++) {
const IntTools_Curve& aIC=aCvs(i);
BOPTools_Curve aBC(aIC);
myCurves.Append(aBC);
}
//
SetAlonePnts(aPnts);
}
//=======================================================================
//function : AppendBlock
//purpose :
//=======================================================================
void BOPTools_SSInterference::AppendBlock(const BOPTools_PaveBlock& aPB)
{
myPBs.Append(aPB);
}
//=======================================================================
//function : PaveBlocks
//purpose :
//=======================================================================
const BOPTools_ListOfPaveBlock& BOPTools_SSInterference::PaveBlocks() const
{
return myPBs;
}
//=======================================================================
//function : TolR3D
//purpose :
//=======================================================================
Standard_Real BOPTools_SSInterference::TolR3D() const
{
return myTolR3D;
}
//=======================================================================
//function : TolR2D
//purpose :
//=======================================================================
Standard_Real BOPTools_SSInterference::TolR2D() const
{
return myTolR2D;
}
//=======================================================================
//function : Curves
//purpose :
//=======================================================================
BOPTools_SequenceOfCurves& BOPTools_SSInterference::Curves()
{
return myCurves;
}
//=======================================================================
//function : NewPaveSet
//purpose :
//=======================================================================
BOPTools_PaveSet& BOPTools_SSInterference::NewPaveSet()
{
return myNewPaveSet;
}
//=======================================================================
//function : SetTangentFacesFlag
//purpose :
//=======================================================================
void BOPTools_SSInterference::SetTangentFacesFlag(const Standard_Boolean aFlag)
{
myTangentFacesFlag=aFlag;
}
//=======================================================================
//function : IsTangentFaces
//purpose :
//=======================================================================
Standard_Boolean BOPTools_SSInterference::IsTangentFaces()const
{
return myTangentFacesFlag;
}
//=======================================================================
// function: SetSenseFlag
// purpose:
//=======================================================================
void BOPTools_SSInterference::SetSenseFlag (const Standard_Integer iFlag)
{
mySenseFlag=iFlag;
}
//=======================================================================
// function: SenseFlag
// purpose:
//=======================================================================
Standard_Integer BOPTools_SSInterference::SenseFlag () const
{
return mySenseFlag;
}
//=======================================================================
// function: SetStatesMap
// purpose:
//=======================================================================
void BOPTools_SSInterference::SetStatesMap (const BOPTools_IndexedDataMapOfIntegerState& aMap)
{
myStatesMap=aMap;
}
//=======================================================================
// function: StatesMap
// purpose:
//=======================================================================
const BOPTools_IndexedDataMapOfIntegerState& BOPTools_SSInterference::StatesMap () const
{
return myStatesMap;
}
//=======================================================================
// function: SetAlonePnts
// purpose:
//=======================================================================
void BOPTools_SSInterference::SetAlonePnts (const IntTools_SequenceOfPntOn2Faces& aPnts)
{
Standard_Integer i, aNb;
myAlonePnts.Clear();
aNb=aPnts.Length();
for (i=1; i<=aNb; ++i) {
const IntTools_PntOn2Faces& aPntOn2Faces=aPnts(i);
myAlonePnts.Append(aPntOn2Faces);
}
}
//=======================================================================
// function: AlonePnts
// purpose:
//=======================================================================
const IntTools_SequenceOfPntOn2Faces& BOPTools_SSInterference::AlonePnts ()const
{
return myAlonePnts;
}
//=======================================================================
// function: AloneVertices
// purpose:
//=======================================================================
TColStd_ListOfInteger& BOPTools_SSInterference::AloneVertices ()
{
return myAloneVertices;
}
//modified by NIZNHY-PKV Fri Jun 30 10:06:12 2006f
//=======================================================================
// function: SetSharedEdges
// purpose:
//=======================================================================
void BOPTools_SSInterference::SetSharedEdges (const TColStd_ListOfInteger& aLS)
{
Standard_Integer nE;
TColStd_ListIteratorOfListOfInteger aIt;
//
aIt.Initialize(aLS);
for(; aIt.More(); aIt.Next()) {
nE=aIt.Value();
mySharedEdges.Append(nE);
}
}
//=======================================================================
// function: SharedEdges
// purpose:
//=======================================================================
const TColStd_ListOfInteger& BOPTools_SSInterference::SharedEdges()const
{
return mySharedEdges;
}
/*
//=======================================================================
// function: SetSharedEdges
// purpose:
//=======================================================================
void BOPTools_SSInterference::SetSharedEdges (const TopTools_ListOfShape& aLS)
{
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(aLS);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE=aIt.Value();
mySharedEdges.Append(aE);
}
}
//=======================================================================
// function: SharedEdges
// purpose:
//=======================================================================
const TopTools_ListOfShape& BOPTools_SSInterference::SharedEdges()const
{
return mySharedEdges;
}
*/
//modified by NIZNHY-PKV Fri Jun 30 10:06:14 2006t

View File

@@ -1,78 +0,0 @@
-- Created on: 2002-03-04
-- Created by: Michael KLOKOV
-- Copyright (c) 2002-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class SSIntersectionAttribute from BOPTools
---Purpose: Class is a container of three flags used
--- by intersection algorithm
---
is
Create(Aproximation : Boolean from Standard = Standard_True;
PCurveOnS1 : Boolean from Standard = Standard_True;
PCurveOnS2 : Boolean from Standard = Standard_True)
returns SSIntersectionAttribute from BOPTools;
---Purpose:
--- Initializes me by flags
---
Approximation(me: in out; theFlag: Boolean from Standard);
---Purpose:
--- Modifier
---
PCurveOnS1(me: in out; theFlag: Boolean from Standard);
---Purpose:
--- Modifier
---
PCurveOnS2(me: in out; theFlag: Boolean from Standard);
---Purpose:
--- Modifier
---
Approximation(me)
returns Boolean from Standard;
---C++: inline
---Purpose:
--- Selector
---
PCurveOnS1(me)
returns Boolean from Standard;
---C++: inline
---Purpose:
--- Selector
---
PCurveOnS2(me)
returns Boolean from Standard;
---C++: inline
---Purpose:
--- Selector
---
fields
myApproximation : Boolean from Standard;
myPCurve1 : Boolean from Standard;
myPCurve2 : Boolean from Standard;
end SSIntersectionAttribute from BOPTools;

View File

@@ -1,59 +0,0 @@
// Created on: 2002-03-04
// Created by: Michael KLOKOV
// Copyright (c) 2002-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_SSIntersectionAttribute.ixx>
//=======================================================================
// function: BOPTools_SSIntersectionAttribute
// purpose:
//=======================================================================
BOPTools_SSIntersectionAttribute::BOPTools_SSIntersectionAttribute(const Standard_Boolean Aproximation,
const Standard_Boolean PCurveOnS1,
const Standard_Boolean PCurveOnS2)
{
myApproximation = Aproximation;
myPCurve1 = PCurveOnS1;
myPCurve2 = PCurveOnS2;
}
//=======================================================================
// function: Approximation
// purpose:
//=======================================================================
void BOPTools_SSIntersectionAttribute::Approximation(const Standard_Boolean theFlag)
{
myApproximation = theFlag;
}
//=======================================================================
// function: PCurveOnS1
// purpose:
//=======================================================================
void BOPTools_SSIntersectionAttribute::PCurveOnS1(const Standard_Boolean theFlag)
{
myPCurve1 = theFlag;
}
//=======================================================================
// function: PCurveOnS2
// purpose:
//=======================================================================
void BOPTools_SSIntersectionAttribute::PCurveOnS2(const Standard_Boolean theFlag)
{
myPCurve2 = theFlag;
}

View File

@@ -1,45 +0,0 @@
// Created on: 2002-03-04
// Created by: Michael KLOKOV
// Copyright (c) 2002-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//=======================================================================
// function:Approximation
// purpose:
//=======================================================================
inline Standard_Boolean BOPTools_SSIntersectionAttribute::Approximation() const
{
return myApproximation;
}
//=======================================================================
// function:PCurveOnS1
// purpose:
//=======================================================================
inline Standard_Boolean BOPTools_SSIntersectionAttribute::PCurveOnS1() const
{
return myPCurve1;
}
//=======================================================================
// function:PCurveOnS2
// purpose:
//=======================================================================
inline Standard_Boolean BOPTools_SSIntersectionAttribute::PCurveOnS2() const
{
return myPCurve2;
}

View File

@@ -0,0 +1,89 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Set from BOPTools
---Purpose:
uses
ShapeEnum from TopAbs,
Shape from TopoDS,
ListOfShape from BOPCol,
BaseAllocator from BOPCol
--raises
is
Create
returns Set from BOPTools;
---C++: alias "virtual ~BOPTools_Set();"
---C++: inline
Create (theAllocator: BaseAllocator from BOPCol)
returns Set from BOPTools;
---C++: inline
Assign(me:out;
Other : Set from BOPTools)
returns Set from BOPTools;
---C++: alias operator =
---C++: return &
---C++: inline
Clear(me:out)
is protected;
---C++: inline
Shape(me)
returns Shape from TopoDS;
---C++: return const &
---C++: inline
Add(me:out;
theS:Shape from TopoDS;
theType: ShapeEnum from TopAbs);
---C++: inline
AddEdges(me:out;
theS:Shape from TopoDS);
---C++: inline
NbShapes(me)
returns Integer from Standard;
---C++: inline
IsEqual(me;
aOther:Set from BOPTools)
returns Boolean from Standard;
---C++: inline
HashCode(me;
Upper : Integer from Standard)
returns Integer from Standard;
---C++: inline
fields
myAllocator : BaseAllocator from BOPCol is protected;
myShapes : ListOfShape from BOPCol is protected;
myShape : Shape from TopoDS is protected;
myNbShapes : Integer from Standard is protected;
mySum : Integer from Standard is protected;
myUpper : Integer from Standard is protected;
end Set;

View File

@@ -0,0 +1,20 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Set.ixx>

View File

@@ -0,0 +1,330 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//#include <BOPTools_Set.ixx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
static
inline Standard_Boolean operator<(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2);
static
inline void SortShell(const int n, TopoDS_Shape *a);
static
inline Standard_Integer NormalizedIds(const Standard_Integer aId,
const Standard_Integer aDiv);
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_Set::BOPTools_Set()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myShapes(myAllocator)
{
myNbShapes=0;
mySum=0;
myUpper=432123;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_Set::BOPTools_Set(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myShapes(myAllocator)
{
myNbShapes=0;
mySum=0;
myUpper=432123;
}
//=======================================================================
//function :~
//purpose :
//=======================================================================
inline BOPTools_Set::~BOPTools_Set()
{
Clear();
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
inline void BOPTools_Set::Clear()
{
myNbShapes=0;
mySum=0;
myShapes.Clear();
}
//=======================================================================
//function : NbShapes
//purpose :
//=======================================================================
inline Standard_Integer BOPTools_Set::NbShapes()const
{
return myNbShapes;
}
//=======================================================================
//function :Assign
//purpose :
//=======================================================================
inline BOPTools_Set& BOPTools_Set::Assign(const BOPTools_Set& theOther)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myShape=theOther.myShape;
myNbShapes=theOther.myNbShapes;
mySum=theOther.mySum;
myUpper=theOther.myUpper;
myAllocator=theOther.myAllocator;
//
myShapes.Clear();
aIt.Initialize(theOther.myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
myShapes.Append(aSx);
}
return *this;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const TopoDS_Shape& BOPTools_Set::Shape()const
{
return myShape;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_Set::Add(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theType)
{
if (theType==TopAbs_EDGE) {
AddEdges(theS);
return;
}
//
Standard_Integer i, aNb, aId, aIdN;
TopoDS_Shape *pShapes;
TopExp_Explorer aExp;
//
myNbShapes=0;
mySum=0;
myShape=theS;
//
aExp.Init(theS, theType);
for (aNb=0; aExp.More(); aExp.Next(), ++aNb) {
}
//
if (!aNb) {
return;
}
//
myNbShapes=aNb;
pShapes=(TopoDS_Shape *)myAllocator->Allocate(aNb*sizeof(TopoDS_Shape));
//
aExp.ReInit();
for (i=0; aExp.More(); aExp.Next(),++i) {
const TopoDS_Shape& aSx=aExp.Current();
new (pShapes+i) TopoDS_Shape();
pShapes[i]=aSx;
}
//
SortShell(aNb, pShapes);
//
myShapes.Clear();
for (i=0; i<aNb; ++i) {
const TopoDS_Shape& aSx=pShapes[i];
myShapes.Append(aSx);
//
aId=aSx.HashCode(myUpper);
aIdN=NormalizedIds(aId, aNb);
mySum+=aIdN;
}
//
for (i=0; i<aNb; ++i) {
pShapes[i].~TopoDS_Shape();
}
myAllocator->Free((Standard_Address&)pShapes);
}
//=======================================================================
//function : AddEdges
//purpose :
//=======================================================================
inline void BOPTools_Set::AddEdges(const TopoDS_Shape& theS)
{
Standard_Integer i, aNb, aId, aIdN;
TopoDS_Shape *pShapes;
TopExp_Explorer aExp;
//
myNbShapes=0;
mySum=0;
myShape=theS;
//
aExp.Init(theS, TopAbs_EDGE);
for (aNb=0; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aExp.Current()));
if (!BRep_Tool::Degenerated(aE)) {
++aNb;
}
}
//
if (!aNb) {
return;
}
//
myNbShapes=aNb;
pShapes=(TopoDS_Shape *)myAllocator->Allocate(aNb*sizeof(TopoDS_Shape));
//
i=0;
aExp.ReInit();
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aSx=aExp.Current();
const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aSx));
if (!BRep_Tool::Degenerated(aE)) {
new (pShapes+i) TopoDS_Shape();
pShapes[i]=aSx;
++i;
}
}
//
SortShell(aNb, pShapes);
//
myShapes.Clear();
for (i=0; i<aNb; ++i) {
const TopoDS_Shape& aSx=pShapes[i];
myShapes.Append(aSx);
//
aId=aSx.HashCode(myUpper);
aIdN=NormalizedIds(aId, aNb);
mySum+=aIdN;
}
//
for (i=0; i<aNb; ++i) {
pShapes[i].~TopoDS_Shape();
}
myAllocator->Free((Standard_Address&)pShapes);
}
//=======================================================================
//function : IsEqual
//purpose :
//=======================================================================
inline Standard_Boolean BOPTools_Set::IsEqual(const BOPTools_Set& theOther)const
{
Standard_Boolean bRet;
//
bRet=Standard_False;
//
if (theOther.myNbShapes!=myNbShapes) {
return bRet;
}
//
BOPCol_ListIteratorOfListOfShape aIt1, aIt2;
//
aIt1.Initialize(myShapes);
aIt2.Initialize(theOther.myShapes);
for (; aIt1.More()||aIt2.More(); aIt1.Next(), aIt2.Next()) {
const TopoDS_Shape& aSx1=aIt1.Value();
const TopoDS_Shape& aSx2=aIt2.Value();
if (aSx1.TShape().operator->() != aSx2.TShape().operator->()) {
return bRet;
}
}
return !bRet;
}
//=======================================================================
//function : HashCode
//purpose :
//=======================================================================
inline Standard_Integer BOPTools_Set::HashCode(const Standard_Integer theUpper)const
{
return ::HashCode(mySum, theUpper);
}
//=======================================================================
// function: NormalizedIds
// purpose :
//=======================================================================
Standard_Integer NormalizedIds(const Standard_Integer aId,
const Standard_Integer aDiv)
{
Standard_Integer aMax, aTresh, aIdRet;
//
aIdRet=aId;
aMax=::IntegerLast();
aTresh=aMax/aDiv;
if (aId>aTresh) {
aIdRet=aId%aTresh;
}
return aIdRet;
}
//=======================================================================
//function : operator<
//purpose :
//=======================================================================
Standard_Boolean operator<(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2)
{
Standard_Address aAddr1, aAddr2;
//
const Handle(TopoDS_TShape)& aTS1=theS1.TShape();
aAddr1=aTS1.operator->();
//
const Handle(TopoDS_TShape)& aTS2=theS2.TShape();
aAddr2=aTS2.operator->();
//
return (aAddr1<aAddr2);
}
//=======================================================================
// function: SortShell
// purpose :
//=======================================================================
void SortShell(const int n, TopoDS_Shape *a)
{
int nd, i, j, l, d=1;
TopoDS_Shape x;
//
while(d<=n) {
d*=2;
}
//
while (d) {
d=(d-1)/2;
//
nd=n-d;
for (i=0; i<nd; ++i) {
j=i;
m30:;
l=j+d;
if (a[l] < a[j]){
x=a[j];
a[j]=a[l];
a[l]=x;
j-=d;
if (j > -1) goto m30;
}//if (a[l] < a[j]){
}//for (i=0; i<nd; ++i)
}//while (1)
}

View File

@@ -1,6 +1,5 @@
-- Created on: 2003-12-11
-- Created by: Peter KURNEV
-- Copyright (c) 2003-2012 OPEN CASCADE SAS
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,26 +17,28 @@
-- and conditions governing the rights and limitations under the License.
class PaveBlockMapHasher from BOPTools
class SetMapHasher from BOPTools
---Purpose:
uses
PaveBlock from BOPTools
uses
Set from BOPTools
--raises
is
is
HashCode(myclass;
aPB : PaveBlock from BOPTools;
aSet : Set from BOPTools;
Upper : Integer from Standard)
returns Integer from Standard;
---C++: inline
IsEqual(myclass;
aPB1 : PaveBlock from BOPTools;
aPB2 : PaveBlock from BOPTools)
aSet1 : Set from BOPTools;
aSet2 : Set from BOPTools)
returns Boolean from Standard;
---C++: inline
--fields
end PaveBlockMapHasher;
end SetMapHasher;

View File

@@ -0,0 +1,19 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_SetMapHasher.ixx>

View File

@@ -1,6 +1,5 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -18,24 +17,22 @@
// and conditions governing the rights and limitations under the License.
#include <BOPTools_VVInterference.ixx>
//#include <BOPTools_SetMapHasher.ixx>
//=======================================================================
//function : BOPTools_VVInterference
//function : HashCode
//purpose :
//=======================================================================
BOPTools_VVInterference::BOPTools_VVInterference()
:
BOPTools_ShapeShapeInterference(0,0)
{}
inline Standard_Integer BOPTools_SetMapHasher::HashCode(const BOPTools_Set& theSS,
const Standard_Integer Upper)
{
return theSS.HashCode(Upper);
}
//=======================================================================
//function : BOPTools_VVInterference
//function :IsEqual
//purpose :
//=======================================================================
BOPTools_VVInterference::BOPTools_VVInterference
(const Standard_Integer anIndex1,
const Standard_Integer anIndex2)
:
BOPTools_ShapeShapeInterference(anIndex1,anIndex2)
{}
inline Standard_Boolean BOPTools_SetMapHasher::IsEqual(const BOPTools_Set& theSS1,
const BOPTools_Set& theSS2)
{
return theSS1.IsEqual(theSS2);
}

View File

@@ -0,0 +1,98 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ShapeSet from BOPTools
---Purpose: Implementation of some formal
-- opereations with a set of shapes
uses
Shape from TopoDS,
Edge from TopoDS,
ShapeEnum from TopAbs,
BaseAllocator from BOPCol,
MapOfOrientedShape from BOPCol,
ListOfShape from BOPCol
--raises
is
Create
returns ShapeSet from BOPTools;
---C++: alias "virtual ~BOPTools_ShapeSet();"
---C++: inline
Create (theAllocator: BaseAllocator from BOPCol)
returns ShapeSet from BOPTools;
---C++: inline
SetShape(me:out;
theS:Shape from TopoDS);
---C++: inline
Shape(me)
returns Shape from TopoDS;
---C++: return const &
---C++: inline
Add(me:out;
theLS:ListOfShape from BOPCol);
Add(me:out;
theShape:Shape from TopoDS);
---C++: inline
Add(me:out;
theShape:Shape from TopoDS;
theType: ShapeEnum from TopAbs);
AddEdge(me:out;
theEdge:Edge from TopoDS);
---C++: inline
AddEdges(me:out;
theLS:ListOfShape from BOPCol);
AddEdges(me:out;
theFace:Shape from TopoDS);
---C++: inline
Subtract(me:out;
theSet:ShapeSet from BOPTools);
---C++: alias operator -=
---C++: inline
Clear(me:out);
---C++: inline
Get(me;
theLS:out ListOfShape from BOPCol);
---C++: inline
Contains(me;
theSet:ShapeSet from BOPTools)
returns Boolean from Standard;
---C++: inline
fields
myShape: Shape from TopoDS is protected;
myMap : MapOfOrientedShape from BOPCol is protected;
end ShapeSet;

View File

@@ -0,0 +1,19 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_ShapeSet.ixx>

View File

@@ -0,0 +1,190 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <TopExp_Explorer.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::BOPTools_ShapeSet()
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::BOPTools_ShapeSet(const Handle(NCollection_BaseAllocator)& theObj)
:
myMap(100, theObj)
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::~BOPTools_ShapeSet()
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Clear()
{
myMap.Clear();
}
//=======================================================================
//function : SetShape
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::SetShape(const TopoDS_Shape& theShape)
{
myShape=theShape;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const TopoDS_Shape& BOPTools_ShapeSet::Shape()const
{
return myShape;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const TopoDS_Shape& theShape)
{
myMap.Add(theShape);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType)
{
TopExp_Explorer aExp(theShape, theType);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aS=aExp.Current();
myMap.Add(aS);
}
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const BOPCol_ListOfShape& theLS)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Init(theLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
myMap.Add(aS);
}
}
//=======================================================================
//function : AddEdge
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::AddEdge(const TopoDS_Edge& theEdge)
{
if (!BRep_Tool::Degenerated(theEdge)){
myMap.Add(theEdge);
}
}
//=======================================================================
//function : AddEdges
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::AddEdges(const BOPCol_ListOfShape& theLS)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(theLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aIt.Value());
AddEdge(aE);
}
}
//=======================================================================
//function : AddEdges
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::AddEdges(const TopoDS_Shape& theFace)
{
TopExp_Explorer aExp(theFace, TopAbs_EDGE);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aExp.Current());
AddEdge(aE);
}
}
//=======================================================================
//function : Get
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Get(BOPCol_ListOfShape& theLS)const
{
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
theLS.Append(aS);
}
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
inline Standard_Boolean BOPTools_ShapeSet::Contains(const BOPTools_ShapeSet& theOther)const
{
Standard_Boolean bRet;
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(theOther.myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
bRet=myMap.Contains(aS);
if (!bRet) {
break;
}
}
return bRet;
}
//=======================================================================
//function : Subtract
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Subtract(const BOPTools_ShapeSet& theOther)
{
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(theOther.myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
if (myMap.Contains(aS)) {
myMap.Remove(aS);
}
}
}

View File

@@ -1,91 +0,0 @@
-- Created on: 2000-11-21
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ShapeShapeInterference from BOPTools
---Purpose:
-- Root class for storing an Interference
-- between a couple BRep shapes
is
Create
returns ShapeShapeInterference from BOPTools;
---Purpose:
--- Empty constructor
---
Create (anIndex1: Integer from Standard;
anIndex2: Integer from Standard)
returns ShapeShapeInterference from BOPTools;
---Purpose:
--- Constructor
---
SetIndex1(me:out; anIndex1:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the first shape from the couple
---
SetIndex2(me:out; anIndex2:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the second shape from the couple
---
SetNewShape(me:out; anIndex:Integer from Standard);
---Purpose:
--- Modifier
--- Sets DS-index for the new shape
---
Index1(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Index2(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
Indices(me;
anIndex1:out Integer from Standard;
anIndex2:out Integer from Standard);
---Purpose:
--- Selector
---
OppositeIndex(me;
anIndex:Integer from Standard)
returns Integer from Standard;
---Purpose:
--- Selector
--- Gets the value of index
--- if anIndex==myIndex1 it returns myIndex2;
--- if anIndex==myIndex2 it returns myIndex1;
--- otherwise it returns 0;
---
NewShape(me)
returns Integer from Standard;
---Purpose:
--- Selector
---
fields
myIndex1 : Integer from Standard;
myIndex2 : Integer from Standard;
myNewShape: Integer from Standard;
end ShapeShapeInterference;

View File

@@ -1,126 +0,0 @@
// Created on: 2000-11-21
// Created by: Peter KURNEV
// Copyright (c) 2000-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_ShapeShapeInterference.ixx>
//=======================================================================
//function : BOPTools_ShapeShapeInterference::BOPTools_ShapeShapeInterference
//purpose :
//=======================================================================
BOPTools_ShapeShapeInterference::BOPTools_ShapeShapeInterference()
:
myIndex1(0), myIndex2(0), myNewShape(0)
{}
//=======================================================================
//function : BOPTools_ShapeShapeInterference::BOPTools_ShapeShapeInterference
//purpose :
//=======================================================================
BOPTools_ShapeShapeInterference::BOPTools_ShapeShapeInterference
(const Standard_Integer anIndex1,
const Standard_Integer anIndex2)
:
myIndex1(anIndex1),
myIndex2(anIndex2),
myNewShape(0)
{}
//=======================================================================
//function : SetIndex1
//purpose :
//=======================================================================
void BOPTools_ShapeShapeInterference::SetIndex1(const Standard_Integer anIndex1)
{
myIndex1=anIndex1;
}
//=======================================================================
//function : SetIndex2
//purpose :
//=======================================================================
void BOPTools_ShapeShapeInterference::SetIndex2(const Standard_Integer anIndex2)
{
myIndex2=anIndex2;
}
//=======================================================================
//function : SetNewShape
//purpose :
//=======================================================================
void BOPTools_ShapeShapeInterference::SetNewShape(const Standard_Integer anIndex)
{
myNewShape=anIndex;
}
//=======================================================================
//function : Index1
//purpose :
//=======================================================================
Standard_Integer BOPTools_ShapeShapeInterference::Index1() const
{
return myIndex1;
}
//=======================================================================
//function : Index2
//purpose :
//=======================================================================
Standard_Integer BOPTools_ShapeShapeInterference::Index2() const
{
return myIndex2;
}
//=======================================================================
//function : OppositeIndex
//purpose :
//=======================================================================
Standard_Integer BOPTools_ShapeShapeInterference::OppositeIndex
(const Standard_Integer anIndex) const
{
if (anIndex==myIndex1) {
return myIndex2;
}
else if(anIndex==myIndex2) {
return myIndex1;
}
else {
return 0;
}
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
void BOPTools_ShapeShapeInterference::Indices(Standard_Integer& i1,
Standard_Integer& i2) const
{
i1=myIndex1;
i2=myIndex2;
}
//=======================================================================
//function : NewShape
//purpose :
//=======================================================================
Standard_Integer BOPTools_ShapeShapeInterference::NewShape() const
{
return myNewShape;
}

View File

@@ -1,73 +0,0 @@
-- Created on: 2001-05-28
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class SolidStateFiller from BOPTools inherits StateFiller from BOPTools
---Purpose:
-- class to compute states (3D) for the edges (and theirs
--- split parts), vertices, wires, faces, shells
---
uses
PPaveFiller from BOPTools,
PaveFiller from BOPTools,
PShapesDataStructure from BooleanOperations,
StateOfShape from BooleanOperations,
Shape from TopoDS,
Edge from TopoDS,
State from TopAbs,
ShapeEnum from TopAbs
is
Create (aFiller: PaveFiller from BOPTools)
returns SolidStateFiller from BOPTools;
---Purpose:
--- Constructor
---
Do(me:out)
is redefined;
---Purpose:
--- Launch the Filler
---
---
---
--- private block
---
DoNonSections (me:out;
iRankShape: Integer from Standard)
is private;
DoShellNonSections (me:out;
iRankShape: Integer from Standard)
is private;
DoSections (me:out)
is private;
IsFaceIntersected(me:out;
nF: Integer from Standard)
returns Boolean from Standard
is private;
end SolidStateFiller;

View File

@@ -1,932 +0,0 @@
// Created on: 2001-05-28
// Created by: Peter KURNEV
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_SolidStateFiller.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopAbs_State.hxx>
#include <Geom_Curve.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Tools.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_IndexedDataMapOfShapeInteger.hxx>
#include <BOPTools_ListOfShapeEnum.hxx>
#include <BOPTools_ListIteratorOfListOfShapeEnum.hxx>
#include <BOPTools_IndexedDataMapOfShapeWithState.hxx>
#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_CommonBlock.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_CArray1OfESInterference.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfESInterference.hxx>
#include <BOPTools_ESInterference.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_CommonBlockPool.hxx>
#include <BOPTools_ListOfCommonBlock.hxx>
#include <BOPTools_StateFiller.hxx>
static
void IntersectionStates(const TopoDS_Shape& aE,
const TopTools_IndexedDataMapOfShapeListOfShape& aM,
TopTools_IndexedMapOfShape& anIntersectedShapes);
static
void PropagateState(const TopoDS_Shape& aS,
const BooleanOperations_StateOfShape aState,
BooleanOperations_ShapesDataStructure* pDS,
const Standard_Integer iRank,
BOPTools_IndexedDataMapOfShapeWithState& aSWS,
TopTools_IndexedMapOfShape& aProcessedShapes);
static
void PropagateState(const TopoDS_Shape& aF,
const BooleanOperations_StateOfShape aState,
BooleanOperations_ShapesDataStructure* pDS,
const Standard_Integer iRank,
BOPTools_IndexedDataMapOfShapeWithState& aSWS,
const TopTools_IndexedDataMapOfShapeListOfShape& aEFMap,
TopTools_IndexedMapOfShape& aProcessedShapes);
static
Standard_Boolean HasConnexity(const TopoDS_Shape& aS,
const BOPTools_IndexedDataMapOfShapeWithState& aSWS,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
BooleanOperations_StateOfShape& aState);
// Peter KURNEV
// p-kurnev@opencascade.com
//=======================================================================
// function: BOPTools_SolidStateFiller::BOPTools_SolidStateFiller
// purpose:
//=======================================================================
BOPTools_SolidStateFiller::BOPTools_SolidStateFiller(const BOPTools_PaveFiller& aFiller)
:
BOPTools_StateFiller(aFiller)
{
}
//=======================================================================
// function: Do
// purpose:
//=======================================================================
void BOPTools_SolidStateFiller::Do()
{
const TopoDS_Shape& anObj=myDS->Object();
const TopoDS_Shape& aTool=myDS->Tool();
//
myIsDone=Standard_True;
//
TopAbs_ShapeEnum aT1, aT2;
aT1=anObj.ShapeType();
aT2=aTool.ShapeType();
if (aT1==TopAbs_FACE) {
aT1=TopAbs_SHELL;
}
if (aT2==TopAbs_FACE) {
aT2=TopAbs_SHELL;
}
if (aT1==TopAbs_SOLID && aT2==TopAbs_SOLID) {
DoNonSections(1);
DoNonSections(2);
DoSections();
}
else if (aT1==TopAbs_SHELL && aT2==TopAbs_SHELL) {
DoShellNonSections(1);
DoShellNonSections(2);
DoSections();
}
else if (aT1==TopAbs_SHELL && aT2==TopAbs_SOLID) {
DoNonSections(1);
DoShellNonSections(2);
DoSections();
}
else if (aT1==TopAbs_SOLID && aT2==TopAbs_SHELL) {
DoShellNonSections(1);
DoNonSections(2);
DoSections();
}
else {
myIsDone=!myIsDone;
}
}
//=======================================================================
// function: DoNonSections
// purpose:
//=======================================================================
void BOPTools_SolidStateFiller::DoNonSections(const Standard_Integer iRankObj)
{
//
// 0. Restore data and preparing
const TopoDS_Shape& anObj=(iRankObj==1) ? myDS->Object() : myDS->Tool();
const TopoDS_Shape& aTool=(iRankObj==1) ? myDS->Tool() : myDS->Object();
const BooleanOperations_IndexedDataMapOfShapeInteger& aDSMap=myDS->ShapeIndexMap(iRankObj);
const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
const BOPTools_CommonBlockPool& aCommonBlockPool=myFiller->CommonBlockPool();
Standard_Integer i, nE, nF, aNbPaveBlocks, aNb;
BooleanOperations_StateOfShape aState;
TopTools_IndexedMapOfShape aEM, anIntersectedShapes, aNonIntersectedShapes;
TopTools_IndexedDataMapOfShapeListOfShape aM, aMVE, aMEF;
//
// aM Map
TopExp::MapShapesAndAncestors (anObj, TopAbs_EDGE , TopAbs_WIRE , aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_WIRE , TopAbs_FACE , aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_FACE , TopAbs_SHELL, aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_SHELL, TopAbs_SOLID, aM);
//
// VE Map
TopExp::MapShapesAndAncestors (anObj, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
//
// 1. anIntersectedShapes
//
// 1.1. Check EF FF interferences with nF
TopExp::MapShapes(anObj, TopAbs_FACE, aEM);
aNb=aEM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aF=aEM(i);
nF=aDSMap.FindFromKey(aF);
Standard_Boolean bExists=IsFaceIntersected(nF);
if (bExists) {
anIntersectedShapes.Add(aF);
IntersectionStates (aF, aM, anIntersectedShapes);
}
}
//
aEM.Clear();
TopExp::MapShapes(anObj, TopAbs_EDGE, aEM);
//
// 1.2. Edges that have Split parts
aNb=aEM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aE=aEM(i);
nE=aDSMap.FindFromKey(aE);
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nE));
aNbPaveBlocks=aSplitEdges.Extent();
//
if (!aNbPaveBlocks) {
continue;
}
//
if (aNbPaveBlocks==1) {
const BOPTools_ListOfCommonBlock& aCBlocks=aCommonBlockPool(myDS->RefEdge(nE));
if (!aCBlocks.Extent()) {
const BOPTools_PaveBlock& aPB=aSplitEdges.First();
Standard_Integer nEB=aPB.Edge();
if (nEB==aPB.OriginalEdge()) {
Standard_Boolean bHasInterference=//;
Standard_False; //LNX
Standard_Integer j, aNbSuc, nV;
aNbSuc=myDS->NumberOfSuccessors(nEB);
for (j=1; j<=aNbSuc; j++) {
nV=myDS->GetSuccessor(nE, j);
bHasInterference=myIntrPool->HasInterference(nV);
if (bHasInterference) {
break;
}
}
if (!bHasInterference) {
continue;
}
}
}
}
//
anIntersectedShapes.Add(aE);
IntersectionStates (aE, aM, anIntersectedShapes);
} // for (i=1; i<=aNb; i++)
//
// 1.3. Write Intersected state for anIntersectedShapes to the DS
aNb=anIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=anIntersectedShapes(i);
nE=aDSMap.FindFromKey(aS);
myDS->SetState(nE, BooleanOperations_INTERSECTED);
}
//
// 2. aNonIntersectedShapes
//
aNb=aM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aM.FindKey(i);
if (!anIntersectedShapes.Contains(aS)) {
aNonIntersectedShapes.Add(aS);
}
}
//
// 2.1. Processing of Non-intersected shapes
BRep_Builder BB;
TopoDS_Compound aCompound;
BB.MakeCompound(aCompound);
aNb=aNonIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aNonIntersectedShapes(i);
BB.Add(aCompound, aS);
}
TopExp::MapShapesAndAncestors (aCompound, TopAbs_EDGE, TopAbs_FACE, aMEF);
//
TopTools_IndexedMapOfShape aProcessedShapes;
BOPTools_IndexedDataMapOfShapeWithState aSWS;
Standard_Boolean bHasConnexity;
//
BOPTools_ListOfShapeEnum aEnumList;
aEnumList.Append(TopAbs_SHELL);
aEnumList.Append(TopAbs_FACE);
aEnumList.Append(TopAbs_WIRE);
aEnumList.Append(TopAbs_EDGE);
BOPTools_ListIteratorOfListOfShapeEnum anIt(aEnumList);
for (; anIt.More(); anIt.Next()) {
TopAbs_ShapeEnum anEnum=anIt.Value();
aEM.Clear();
TopExp::MapShapes(aCompound, anEnum, aEM);
aNb=aEM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aEM(i);
//
// DEBUG
//nE=aDSMap.FindFromKey(aS);
//
if (!aProcessedShapes.Contains(aS)) {
bHasConnexity=HasConnexity(aS, aSWS, aMVE, aState);
if (!bHasConnexity) {
aState=BOPTools_StateFiller::ClassifyShapeByRef (aS, aTool);
}
aSWS.Add(aS, aState);
aProcessedShapes.Add(aS);
if (anEnum==TopAbs_FACE) {
PropagateState(aS, aState, myDS, iRankObj, aSWS, aMEF, aProcessedShapes);
}
else {
PropagateState(aS, aState, myDS, iRankObj, aSWS, aProcessedShapes);
}
}
}
}
//
// 2.2. Write Stats for Non-intersected Shapes to the DS
aNb=aSWS.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aSWS.FindKey(i);
aState=aSWS.FindFromIndex(i);
nE=aDSMap.FindFromKey(aS);
myDS->SetState(nE, aState);
}
//---------------------------------------------------
//
// 3. Intersected Edges' Processing
//
//---------------------------------------------------
Standard_Integer nSp, aNBVertices, nV1, nV2;
BooleanOperations_StateOfShape aStV1, aStV2;
aNb=anIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=anIntersectedShapes(i);
if (aS.ShapeType()==TopAbs_EDGE) {
nE=aDSMap.FindFromKey(aS);
//
// 3.1. On Parts Processing
const BOPTools_ListOfCommonBlock& aLCB=aCommonBlockPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
const BOPTools_CommonBlock& aCB=anItCB.Value();
BOPTools_CommonBlock* pCB=(BOPTools_CommonBlock*) &aCB;
BOPTools_PaveBlock& aPB=pCB->PaveBlock1(nE);
nSp=aPB.Edge();
myDS->SetState(nSp, BooleanOperations_ON);
}
//
// 3.2. IN, OUT Parts Processing
const BOPTools_ListOfPaveBlock& aSplits=aSplitShapesPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfPaveBlock anItPB(aSplits);
for (; anItPB.More(); anItPB.Next()) {
const BOPTools_PaveBlock& aPB=anItPB.Value();
nSp=aPB.Edge();
const TopoDS_Shape& aSplit=myDS->Shape(nSp);
aState=myDS->GetState(nSp);
if (aState==BooleanOperations_UNKNOWN|| aState==BooleanOperations_INTERSECTED){
aNBVertices=myDS->NumberOfSuccessors(nE);
if (aNBVertices==2) {
nV1=myDS->GetSuccessor(nSp, 1);
aStV1=myDS->GetState(nV1);
nV2=myDS->GetSuccessor(nSp, 2);
aStV2=myDS->GetState(nV2);
if ((aStV1==BooleanOperations_IN || aStV1==BooleanOperations_OUT)
&& (aStV2==BooleanOperations_ON)) {
myDS->SetState(nSp, aStV1);
}
else if ((aStV2==BooleanOperations_IN || aStV2==BooleanOperations_OUT)
&& (aStV1==BooleanOperations_ON)) {
myDS->SetState(nSp, aStV2);
}
else {
aState=BOPTools_StateFiller::ClassifyShapeByRef(aSplit, aTool);
myDS->SetState(nSp, aState);
if (aStV1==BooleanOperations_UNKNOWN) {
myDS->SetState(nV1, aState);
}
if (aStV2==BooleanOperations_UNKNOWN) {
myDS->SetState(nV2, aState);
}
}
}// if (aNBVertices==2)
else {
aState=BOPTools_StateFiller::ClassifyShapeByRef(aSplit, aTool);
myDS->SetState(nSp, aState);
}
}// if (aState==BooleanOperations_UNKNOWN || BooleanOperations_INTERSECTED)
}//for (; anItPB.More(); anItPB.Next())
}// if (aS.ShapeType()==TopAbs_EDGE)
}// next "Intersected" Edge
}
//
//=======================================================================
// function: DoShellNonSections
// purpose:
//=======================================================================
void BOPTools_SolidStateFiller::DoShellNonSections(const Standard_Integer iRankObj)
{
const TopoDS_Shape& anObj=(iRankObj==1) ? myDS->Object() : myDS->Tool();
//
// 0. Restore data and preparing
const BooleanOperations_IndexedDataMapOfShapeInteger& aDSMap=myDS->ShapeIndexMap(iRankObj);
const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool();
const BOPTools_CommonBlockPool& aCommonBlockPool=myFiller->CommonBlockPool();
Standard_Integer i, nE, aNbPaveBlocks, aNb, nF1, nF2, iRank, nFx;
BooleanOperations_StateOfShape aState;
TopTools_IndexedMapOfShape aEM, anIntersectedShapes, aNonIntersectedShapes;
TopTools_IndexedDataMapOfShapeListOfShape aM;
//
// aM Map
TopExp::MapShapesAndAncestors (anObj, TopAbs_EDGE , TopAbs_WIRE , aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_WIRE , TopAbs_FACE , aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_FACE , TopAbs_SHELL, aM);
TopExp::MapShapesAndAncestors (anObj, TopAbs_SHELL, TopAbs_SOLID, aM);
//
// 1. anIntersectedShapes
//
// 1.1. Check EF FF interferences with nF
const BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences();
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
const BOPTools_SSInterference& aFF=aFFs(i);
// nF1
nF1=aFF.Index1();
nF2=aFF.Index2();
iRank=myDS->Rank(nF1);
nFx=(iRank==myDS->Rank(nF1)) ? nF1 : nF2;
const TopoDS_Shape& aFx=myDS->Shape(nFx);
anIntersectedShapes.Add(aFx);
IntersectionStates (aFx, aM, anIntersectedShapes);
}
//
TopExp::MapShapes(anObj, TopAbs_EDGE, aEM);
//
// 1.2. Edges that have Split parts
aNb=aEM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aE=aEM(i);
nE=aDSMap.FindFromKey(aE);
const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nE));
aNbPaveBlocks=aSplitEdges.Extent();
//
if (!aNbPaveBlocks) {
continue;
}
//
if (aNbPaveBlocks==1) {
const BOPTools_ListOfCommonBlock& aCBlocks=aCommonBlockPool(myDS->RefEdge(nE));
if (!aCBlocks.Extent()) {
const BOPTools_PaveBlock& aPB=aSplitEdges.First();
Standard_Integer nEB=aPB.Edge();
if (nEB==aPB.OriginalEdge()) {
Standard_Boolean bHasInterference=//; LNX
Standard_False;//LNX
Standard_Integer j, aNbSuc, nV;
aNbSuc=myDS->NumberOfSuccessors(nEB);
for (j=1; j<=aNbSuc; j++) {
nV=myDS->GetSuccessor(nE, j);
bHasInterference=myIntrPool->HasInterference(nV);
if (bHasInterference) {
break;
}
}
if (!bHasInterference) {
continue;
}
}
}
}
//
anIntersectedShapes.Add(aE);
IntersectionStates (aE, aM, anIntersectedShapes);
} // for (i=1; i<=aNb; i++)
//
// 1.3. Write Intersected state for anIntersectedShapes to the DS
aNb=anIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=anIntersectedShapes(i);
if (aDSMap.Contains(aS)) {
nE=aDSMap.FindFromKey(aS);
myDS->SetState(nE, BooleanOperations_INTERSECTED);
}
}
//
// 2. aNonIntersectedShapes
//
aNb=aM.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aM.FindKey(i);
if (!anIntersectedShapes.Contains(aS)) {
aNonIntersectedShapes.Add(aS);
}
}
//
// 2.1. Write Stats for Non-intersected Shapes to the DS
aNb=aNonIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aNonIntersectedShapes(i);
nE=aDSMap.FindFromKey(aS);
myDS->SetState(nE, BooleanOperations_OUT);
}
//---------------------------------------------------
//
// 3. Intersected Edges' Processing
//
//---------------------------------------------------
Standard_Integer nSp;
aNb=anIntersectedShapes.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=anIntersectedShapes(i);
if (aS.ShapeType()==TopAbs_EDGE) {
nE=aDSMap.FindFromKey(aS);
//
// 3.1. On Parts Processing
const BOPTools_ListOfCommonBlock& aLCB=aCommonBlockPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
for (; anItCB.More(); anItCB.Next()) {
const BOPTools_CommonBlock& aCB=anItCB.Value();
BOPTools_CommonBlock* pCB=(BOPTools_CommonBlock*) &aCB;
BOPTools_PaveBlock& aPB=pCB->PaveBlock1(nE);
nSp=aPB.Edge();
myDS->SetState(nSp, BooleanOperations_ON);
}
//
// 3.2. IN, OUT Parts Processing
const BOPTools_ListOfPaveBlock& aSplits=aSplitShapesPool(myDS->RefEdge(nE));
BOPTools_ListIteratorOfListOfPaveBlock anItPB(aSplits);
for (; anItPB.More(); anItPB.Next()) {
const BOPTools_PaveBlock& aPB=anItPB.Value();
nSp=aPB.Edge();
//const TopoDS_Shape& aSplit=myDS->Shape(nSp);//LNX
aState=myDS->GetState(nSp);
if (aState==BooleanOperations_UNKNOWN|| aState==BooleanOperations_INTERSECTED){
myDS->SetState(nSp, BooleanOperations_OUT);
}// if (aState==BooleanOperations_UNKNOWN || BooleanOperations_INTERSECTED)
}//for (; anItPB.More(); anItPB.Next())
}// if (aS.ShapeType()==TopAbs_EDGE)
}// next "Intersected" Edge
}
//
//=======================================================================
// function: DoSections
// purpose:
//=======================================================================
void BOPTools_SolidStateFiller::DoSections()
{
Standard_Integer i, j, aNb, aNbCurves, n1, n2, nE;
BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences();
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
BOPTools_SSInterference& aFF=aFFs(i);
n1=aFF.Index1();
n2=aFF.Index2();
BOPTools_SequenceOfCurves& aSC=aFF.Curves();
aNbCurves=aSC.Length();
for (j=1; j<=aNbCurves; j++) {
const BOPTools_Curve& aBC=aSC(j);
const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks();
BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
for (; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB=anIt.Value();
nE=aPB.Edge();
myDS->SetState(nE, BooleanOperations_ON);
}
}
}
}
//=======================================================================
// function: IsFaceIntersected
// purpose:
//=======================================================================
Standard_Boolean BOPTools_SolidStateFiller::IsFaceIntersected(const Standard_Integer nF)
{
Standard_Boolean bFlag=Standard_False;
Standard_Integer i, aNb, n1, n2;
const BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences();
aNb=aEFs.Extent();
for (i=1; i<=aNb; i++) {
const BOPTools_ESInterference& aEF=aEFs(i);
n1=aEF.Index1();
n2=aEF.Index2();
if (n1==nF || n2==nF) {
return !bFlag;
}
}
const BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences();
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
const BOPTools_SSInterference& aFF=aFFs(i);
n1=aFF.Index1();
n2=aFF.Index2();
if (n1==nF || n2==nF) {
return !bFlag;
}
}
return bFlag;
}
//=======================================================================
// function: PropagateState [for faces]
// purpose:
//=======================================================================
void PropagateState(const TopoDS_Shape& aF,
const BooleanOperations_StateOfShape aState,
BooleanOperations_ShapesDataStructure* pDS,
const Standard_Integer iRank,
BOPTools_IndexedDataMapOfShapeWithState& aSWS,
const TopTools_IndexedDataMapOfShapeListOfShape& aEFMap,
TopTools_IndexedMapOfShape& aProcessedShapes)
{
// PropagateState for Sub-Shapes
PropagateState (aF, aState, pDS, iRank, aSWS, aProcessedShapes);
// PropagateState for connected Faces;
TopTools_IndexedMapOfShape anEdgeMap;
TopExp::MapShapes(aF, TopAbs_EDGE, anEdgeMap);
Standard_Integer i, aNbE;
aNbE=anEdgeMap.Extent();
for (i=1; i<=aNbE; i++) {
const TopoDS_Shape& aE=anEdgeMap(i);
//
const TopTools_ListOfShape& aFacesList=aEFMap.FindFromKey(aE);
//
TopTools_ListIteratorOfListOfShape anIt(aFacesList);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFi=anIt.Value();
if (!aProcessedShapes.Contains(aFi)) {
if (!aFi.IsSame(aF)) {
aSWS.Add(aFi, aState);
aProcessedShapes.Add(aFi);
PropagateState(aFi, aState, pDS, iRank, aSWS, aEFMap, aProcessedShapes);
}
}
}
}
}
//=======================================================================
// function: PropagateState
// purpose:
//=======================================================================
void PropagateState(const TopoDS_Shape& aSS,
const BooleanOperations_StateOfShape aState,
BooleanOperations_ShapesDataStructure* pDS,
const Standard_Integer iRank,
BOPTools_IndexedDataMapOfShapeWithState& aSWS,
TopTools_IndexedMapOfShape& aProcessedShapes)
{
TopAbs_ShapeEnum aSubType;
aSubType=BOPTools_StateFiller::SubType(aSS);
if (aSubType==TopAbs_SHAPE) {
return;
}
const BooleanOperations_IndexedDataMapOfShapeInteger& aDSMap= pDS->ShapeIndexMap(iRank);
TopTools_IndexedMapOfShape aSubMap;
TopExp::MapShapes(aSS, aSubType, aSubMap);
Standard_Integer i, aNb, nV;
aNb=aSubMap.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aS=aSubMap(i);
if (!aProcessedShapes.Contains(aS)) {
if (aSubType==TopAbs_VERTEX) {
nV=aDSMap.FindFromKey(aS);
BooleanOperations_StateOfShape aSt=pDS->GetState(nV);
if (aSt!=BooleanOperations_UNKNOWN){
aProcessedShapes.Add(aS);
continue;
}
}
aSWS.Add(aS, aState);
aProcessedShapes.Add(aS);
PropagateState (aS, aState, pDS, iRank, aSWS, aProcessedShapes);
}
}
}
//=======================================================================
// function: IntersectionStates
// purpose:
//=======================================================================
void IntersectionStates(const TopoDS_Shape& aE,
const TopTools_IndexedDataMapOfShapeListOfShape& aM,
TopTools_IndexedMapOfShape& anIntersectedShapes)
{
if (aM.Contains(aE)) {
const TopTools_ListOfShape& anAncesstors=aM.FindFromKey(aE);
TopTools_ListIteratorOfListOfShape anIt(anAncesstors);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& anAnc=anIt.Value();
anIntersectedShapes.Add(anAnc);
IntersectionStates(anAnc, aM, anIntersectedShapes);
}
}
}
//=======================================================================
// function: HasConnexity
// purpose:
//=======================================================================
Standard_Boolean HasConnexity(const TopoDS_Shape& aS,
const BOPTools_IndexedDataMapOfShapeWithState& aSWS,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
BooleanOperations_StateOfShape& aState)
{
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aSt;
aType=aS.ShapeType();
if (aType!=TopAbs_EDGE) {
Standard_Integer i, aNb;
TopTools_IndexedMapOfShape aME;
TopExp::MapShapes(aS, TopAbs_EDGE, aME);
aNb=aME.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Shape& aE=aME(i);
if (aSWS.Contains(aE)){
aSt=aSWS.FindFromKey(aE);
aState=aSt;
return Standard_True;
}
}
}
else {
TopExp_Explorer anExp (aS, TopAbs_VERTEX);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape& aV=anExp.Current();
if (aMVE.Contains(aV)) {
const TopTools_ListOfShape& anEdgesList=aMVE.FindFromKey(aV);
TopTools_ListIteratorOfListOfShape anIt(anEdgesList);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aEx=anIt.Value();
if (aSWS.Contains(aEx)) {
aSt=aSWS.FindFromKey(aEx);
aState=aSt;
return Standard_True;
}
}
}
}
}
aState=BooleanOperations_UNKNOWN;
return Standard_False;
}
/*
//=======================================================================
// function: ConvertState
// purpose:
//=======================================================================
BooleanOperations_StateOfShape
BOPTools_SolidStateFiller::ConvertState(const TopAbs_State aSt)
{
BooleanOperations_StateOfShape aState;
switch (aSt) {
case TopAbs_IN:
aState=BooleanOperations_IN;
break;
case TopAbs_OUT:
aState=BooleanOperations_OUT;
break;
case TopAbs_ON:
aState=BooleanOperations_ON;
break;
case TopAbs_UNKNOWN:
aState=BooleanOperations_UNKNOWN;
break;
default:
aState=BooleanOperations_UNKNOWN;
break;
}
return aState;
}
//=======================================================================
// function: ConvertState
// purpose:
//=======================================================================
TopAbs_State
BOPTools_SolidStateFiller::ConvertState(const BooleanOperations_StateOfShape aSt)
{
TopAbs_State aState;
switch (aSt) {
case BooleanOperations_IN:
aState=TopAbs_IN;
break;
case BooleanOperations_OUT:
aState=TopAbs_OUT;
break;
case BooleanOperations_ON:
aState=TopAbs_ON;
break;
case BooleanOperations_UNKNOWN:
aState=TopAbs_UNKNOWN;
break;
default:
aState=TopAbs_UNKNOWN;
break;
}
return aState;
}
//=======================================================================
// function: ClassifyShapeByRef
// purpose:
//=======================================================================
BooleanOperations_StateOfShape
BOPTools_SolidStateFiller::ClassifyShapeByRef (const TopoDS_Shape& aS,
const TopoDS_Shape& aRef)
{
TopAbs_ShapeEnum aType;
aType=aS.ShapeType();
TopoDS_Edge aE;
if (aType!=TopAbs_EDGE) {
TopTools_IndexedMapOfShape aME;
TopExp::MapShapes(aS, TopAbs_EDGE, aME);
aE=TopoDS::Edge(aME(1));
}
else {
aE=TopoDS::Edge(aS);
}
TopAbs_State aSt=BOPTools_SolidStateFiller::ClassifyEdgeToSolidByOnePoint(aE, aRef);
BooleanOperations_StateOfShape aState=BOPTools_SolidStateFiller::ConvertState(aSt) ;
return aState;
}
//=======================================================================
// function: ClassifyEdgeToSolidByOnePoint
// purpose:
//=======================================================================
TopAbs_State
BOPTools_SolidStateFiller::ClassifyEdgeToSolidByOnePoint(const TopoDS_Edge& E,
const TopoDS_Shape& Ref)
{
Standard_Real f2 = 0., l2 = 0., par = 0.;
Handle(Geom_Curve) C3D = BRep_Tool::Curve(E, f2, l2);
gp_Pnt aP3d;
if(C3D.IsNull()) {
//it means that we are in degenerated edge
const TopoDS_Vertex& fv = TopExp::FirstVertex(E);
if(fv.IsNull()){
return TopAbs_UNKNOWN;
}
aP3d = BRep_Tool::Pnt(fv);
}
else {//usual case
par=IntTools_Tools::IntermediatePoint(f2, l2);
C3D -> D0(par, aP3d);
}
BRepClass3d_SolidClassifier SC(Ref);
SC.Perform(aP3d, 1e-7);
TopAbs_State aState=SC.State();
return aState;
}
//=======================================================================
// function: SubType
// purpose:
//=======================================================================
TopAbs_ShapeEnum BOPTools_SolidStateFiller::SubType(const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aSourceType, aReturnType;
aSourceType=aS.ShapeType();
switch (aSourceType) {
case TopAbs_SOLID:
aReturnType=TopAbs_SHELL;
break;
case TopAbs_SHELL:
aReturnType=TopAbs_FACE;
break;
case TopAbs_FACE:
aReturnType=TopAbs_WIRE;
break;
case TopAbs_WIRE:
aReturnType=TopAbs_EDGE;
break;
case TopAbs_EDGE:
aReturnType=TopAbs_VERTEX;
break;
default:
aReturnType=TopAbs_SHAPE;
break;
}
return aReturnType;
}
*/

View File

@@ -1,102 +0,0 @@
-- Created on: 2002-02-04
-- Created by: Peter KURNEV
-- Copyright (c) 2002-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class StateFiller from BOPTools
---Purpose:
--- root class to compute states (3D)
---
uses
PaveFiller from BOPTools,
PPaveFiller from BOPTools,
PInterferencePool from BOPTools,
PShapesDataStructure from BooleanOperations,
Shape from TopoDS,
Edge from TopoDS,
State from TopAbs,
ShapeEnum from TopAbs,
StateOfShape from BooleanOperations
--raises
is
Create (aFiller: PaveFiller from BOPTools)
returns StateFiller from BOPTools;
---Purpose:
--- Constructor
---
Do(me:out)
is virtual;
---Purpose:
--- Launch the Filler
---
IsDone(me)
returns Boolean from Standard;
---Purpose:
--- Returns true if Ok
---
ConvertState (myclass;
aSt: State from TopAbs)
returns StateOfShape from BooleanOperations;
---Purpose:
--- Convert conventional states to VDS-states
---
ConvertState (myclass;
aSt: StateOfShape from BooleanOperations)
returns State from TopAbs;
---Purpose:
--- Convert VDS-states to conventional states
---
ClassifyEdgeToSolidByOnePoint (me:out;
anEdge: Edge from TopoDS;
aRef : Shape from TopoDS)
returns State from TopAbs;
---Purpose:
--- Computation the 3D-state of the edge <anEdge>
--- to solid <aRef>
---
ClassifyShapeByRef (me:out;
aShape: Shape from TopoDS;
aRef : Shape from TopoDS)
returns StateOfShape from BooleanOperations;
---Purpose:
--- Computation the 3D-state of the shape <aShape>
--- to solid <aRef>
---
SubType (myclass;
aShape: Shape from TopoDS)
returns ShapeEnum from TopAbs;
---Purpose:
--- Returns first subtype of <Shape>
---
fields
myFiller : PPaveFiller from BOPTools
is protected;
myDS : PShapesDataStructure from BooleanOperations
is protected;
myIntrPool: PInterferencePool from BOPTools
is protected;
myIsDone : Boolean from Standard
is protected;
end StateFiller;

View File

@@ -1,321 +0,0 @@
// Created on: 2002-02-04
// Created by: Peter KURNEV
// Copyright (c) 2002-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450
#include <BOPTools_StateFiller.ixx>
#include <Precision.hxx>
#include <Geom_Curve.hxx>
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Solid.hxx>
#include <TopAbs_State.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_Context.hxx>
#include <Geom_Surface.hxx>
//=======================================================================
// function: BOPTools_StateFiller::BOPTools_StateFiller
// purpose:
//=======================================================================
BOPTools_StateFiller::BOPTools_StateFiller(const BOPTools_PaveFiller& aFiller)
:
myIsDone(Standard_False)
{
myFiller=(BOPTools_PaveFiller*) &aFiller;
myDS=myFiller->DS();
myIntrPool=myFiller->InterfPool();
}
//=======================================================================
// function: Do
// purpose:
//=======================================================================
void BOPTools_StateFiller::Do()
{
}
//=======================================================================
// function: IsDone
// purpose:
//=======================================================================
Standard_Boolean BOPTools_StateFiller::IsDone() const
{
return myIsDone;
}
//=======================================================================
// function: ConvertState
// purpose:
//=======================================================================
BooleanOperations_StateOfShape BOPTools_StateFiller::ConvertState(const TopAbs_State aSt)
{
BooleanOperations_StateOfShape aState;
switch (aSt) {
case TopAbs_IN:
aState=BooleanOperations_IN;
break;
case TopAbs_OUT:
aState=BooleanOperations_OUT;
break;
case TopAbs_ON:
aState=BooleanOperations_ON;
break;
case TopAbs_UNKNOWN:
aState=BooleanOperations_UNKNOWN;
break;
default:
aState=BooleanOperations_UNKNOWN;
break;
}
return aState;
}
//=======================================================================
// function: ConvertState
// purpose:
//=======================================================================
TopAbs_State BOPTools_StateFiller::ConvertState(const BooleanOperations_StateOfShape aSt)
{
TopAbs_State aState;
switch (aSt) {
case BooleanOperations_IN:
aState=TopAbs_IN;
break;
case BooleanOperations_OUT:
aState=TopAbs_OUT;
break;
case BooleanOperations_ON:
aState=TopAbs_ON;
break;
case BooleanOperations_UNKNOWN:
aState=TopAbs_UNKNOWN;
break;
default:
aState=TopAbs_UNKNOWN;
break;
}
return aState;
}
//=======================================================================
// function: ClassifyShapeByRef
// purpose:
//=======================================================================
BooleanOperations_StateOfShape BOPTools_StateFiller::ClassifyShapeByRef (const TopoDS_Shape& aS,
const TopoDS_Shape& aRef)
{
TopAbs_ShapeEnum aType;
aType=aS.ShapeType();
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 Begin
Standard_Boolean hasEdge = Standard_True;
// Modified by skv - Tue Aug 24 12:31:17 2004 OCC6450 End
TopoDS_Edge aE;
if (aType!=TopAbs_EDGE) {
TopTools_IndexedMapOfShape aME;
TopExp::MapShapes(aS, TopAbs_EDGE, aME);
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 Begin
if (aME.Extent() == 0)
hasEdge = Standard_False;
else
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 End
aE=TopoDS::Edge(aME(1));
}
else {
aE=TopoDS::Edge(aS);
}
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 Begin
// TopAbs_State aSt=ClassifyEdgeToSolidByOnePoint(aE, aRef);
TopAbs_State aSt;
if (hasEdge) {
aSt = ClassifyEdgeToSolidByOnePoint(aE, aRef);
} else {
TopTools_IndexedMapOfShape aMF;
Standard_Boolean hasFace = Standard_True;
TopoDS_Face aF;
TopExp::MapShapes(aS, TopAbs_FACE, aMF);
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 Begin
if (aMF.Extent() == 0) {
hasFace = Standard_False;
} else {
aF = TopoDS::Face(aMF(1));
}
if (!hasFace) {
aSt = TopAbs_UNKNOWN;
} else {
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aF);
Standard_Real aUMin;
Standard_Real aUMax;
Standard_Real aVMin;
Standard_Real aVMax;
aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
Standard_Boolean isMinInf = Precision::IsNegativeInfinite(aUMin);
Standard_Boolean isMaxInf = Precision::IsPositiveInfinite(aUMax);
Standard_Real dT=10.;
Standard_Real aParU;
Standard_Real aParV;
if (isMinInf && !isMaxInf) {
aParU = aUMax - dT;
} else if (!isMinInf && isMaxInf) {
aParU = aUMin + dT;
} else if (isMinInf && isMaxInf) {
aParU = 0.;
} else {
aParU = IntTools_Tools::IntermediatePoint(aUMin, aUMax);
}
isMinInf = Precision::IsNegativeInfinite(aVMin);
isMaxInf = Precision::IsPositiveInfinite(aVMax);
if (isMinInf && !isMaxInf) {
aParV = aVMax - dT;
} else if (!isMinInf && isMaxInf) {
aParV = aVMin + dT;
} else if (isMinInf && isMaxInf) {
aParV = 0.;
} else {
aParV = IntTools_Tools::IntermediatePoint(aVMin, aVMax);
}
gp_Pnt aP3d = aSurf->Value(aParU, aParV);
const TopoDS_Solid &aRefSolid = TopoDS::Solid(aRef);
const Handle(IntTools_Context)& aContext = myFiller->Context();
BRepClass3d_SolidClassifier &aSC =
aContext->SolidClassifier(aRefSolid);
//
aSC.Perform(aP3d, 1e-7);
//
aSt = aSC.State();
}
}
// Modified by skv - Tue Aug 24 12:31:16 2004 OCC6450 Begin
BooleanOperations_StateOfShape aState=BOPTools_StateFiller::ConvertState(aSt) ;
return aState;
}
//=======================================================================
// function: ClassifyEdgeToSolidByOnePoint
// purpose:
//=======================================================================
TopAbs_State BOPTools_StateFiller::ClassifyEdgeToSolidByOnePoint(const TopoDS_Edge& E,
const TopoDS_Shape& Ref)
{
Standard_Real f2 = 0., l2 = 0., par = 0.;
Handle(Geom_Curve) C3D = BRep_Tool::Curve(E, f2, l2);
gp_Pnt aP3d;
if(C3D.IsNull()) {
//it means that we are in degenerated edge
const TopoDS_Vertex& fv = TopExp::FirstVertex(E);
if(fv.IsNull()){
return TopAbs_UNKNOWN;
}
aP3d = BRep_Tool::Pnt(fv);
}
else {//usual case
Standard_Boolean bF2Inf, bL2Inf;
Standard_Real dT=10.;
//
bF2Inf = Precision::IsNegativeInfinite(f2);
bL2Inf = Precision::IsPositiveInfinite(l2);
//
if (bF2Inf && !bL2Inf) {
par=l2-dT;
}
else if (!bF2Inf && bL2Inf) {
par=f2+dT;
}
else if (bF2Inf && bL2Inf) {
par=0.;
}
else {
par=IntTools_Tools::IntermediatePoint(f2, l2);
}
C3D -> D0(par, aP3d);
}
//
const TopoDS_Solid& aRefSolid=TopoDS::Solid(Ref);
const Handle(IntTools_Context)& aContext=myFiller->Context();
BRepClass3d_SolidClassifier& aSC=aContext->SolidClassifier(aRefSolid);
//
aSC.Perform(aP3d, 1e-7);
//
TopAbs_State aState=aSC.State();
return aState;
}
//=======================================================================
// function: SubType
// purpose:
//=======================================================================
TopAbs_ShapeEnum BOPTools_StateFiller::SubType(const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aSourceType, aReturnType;
aSourceType=aS.ShapeType();
switch (aSourceType) {
case TopAbs_SOLID:
aReturnType=TopAbs_SHELL;
break;
case TopAbs_SHELL:
aReturnType=TopAbs_FACE;
break;
case TopAbs_FACE:
aReturnType=TopAbs_WIRE;
break;
case TopAbs_WIRE:
aReturnType=TopAbs_EDGE;
break;
case TopAbs_EDGE:
aReturnType=TopAbs_VERTEX;
break;
default:
aReturnType=TopAbs_SHAPE;
break;
}
return aReturnType;
}

View File

@@ -1,184 +0,0 @@
-- Created on: 2000-11-16
-- Created by: Peter KURNEV
-- Copyright (c) 2000-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Tools from BOPTools
---Purpose:
--- The class contains handy static functions
--- dealing with the topology
uses
Pnt from gp ,
Shape from TopoDS,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Range from IntTools,
Context from IntTools,
Curve from IntTools,
PaveBlock from BOPTools,
IndexedMapOfShape from TopTools
is
MakeNewVertex (myclass;
aP1 : Pnt from gp;
aTol: Real from Standard;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol>
---
MakeNewVertex (myclass;
aV1,aV2: Vertex from TopoDS;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex using couple of vertices <aV1, aV2>
---
MakeNewVertex (myclass;
aE1: Edge from TopoDS;
aP1: Real from Standard;
aE2: Edge from TopoDS;
aP2: Real from Standard;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex in place of intersection between two edges
--- <aE1, aE2> with parameters <aP1, aP2>
---
MakeNewVertex (myclass;
aE1: Edge from TopoDS;
aP1: Real from Standard;
aF2: Face from TopoDS;
aNewVertex:out Vertex from TopoDS);
---Purpose:
--- Make a vertex in place of intersection between the edge <aE1>
--- with parameter <aP1> and the face <aF2>
---
PointOnEdge (myclass;
aEdge: Edge from TopoDS;
aPrm: Real from Standard;
aP:out Pnt from gp);
---Purpose:
--- Compute a 3D-point on the edge <aEdge> at parameter <aPrm>
---
MakeSplitEdge (myclass;
aE1: Edge from TopoDS;
aV1: Vertex from TopoDS;
aP1: Real from Standard;
aV2: Vertex from TopoDS;
aP2: Real from Standard;
aNewEdge:out Edge from TopoDS);
---Purpose:
--- Make the edge from base edge <aE1> and two vertices <aV1,aV2>
--- at parameters <aP1,aP2>
---
MakeSectEdge (myclass;
aIC: Curve from IntTools;
aV1: Vertex from TopoDS;
aP1: Real from Standard;
aV2: Vertex from TopoDS;
aP2: Real from Standard;
aNewEdge:out Edge from TopoDS);
---Purpose:
--- Make the edge from 3D-Curve <aIC> and two vertices <aV1,aV2>
--- at parameters <aP1,aP2>
---
UpdateVertex (myclass;
aIC: Curve from IntTools;
aT : Real from Standard;
aV : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aV>
--- taking into account the fact that <aV> lays on
--- the curve <aIC>
---
UpdateVertex (myclass;
aE : Edge from TopoDS;
aT : Real from Standard;
aV : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aV>
--- taking into account the fact that <aV> lays on
--- the edge <aE>
---
UpdateVertex (myclass;
aVF : Vertex from TopoDS;
aVN : Vertex from TopoDS);
---Purpose:
--- Update the tolerance value for vertex <aVN>
--- taking into account the fact that <aVN> should
--- cover tolerance zone of <aVF>
---
IsBlocksCoinside(myclass;
aPB1: PaveBlock from BOPTools;
aPB2: PaveBlock from BOPTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if PaveBlocks <aPB1>,<aPB2> coinside in 3D
--- taking into account corresp. tolerances' values of vertices,
--- edges
---
IsBlockInOnFace(myclass;
aPB : PaveBlock from BOPTools;
aF : Face from TopoDS;
aContext: Context from IntTools)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e
--- the <PB> is IN or ON in 2D of <aF>
---
MapShapes (myclass;
aS : Shape from TopoDS;
aM :out IndexedMapOfShape from TopTools);
---Purpose:
--- Get a Map <aM> containing the shape itself and all its subshapes
---
CorrectRange (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
aSR: Range from IntTools;
aNewSR:out Range from IntTools);
---Purpose:
--- Correct shrunk range <aSR> taking into account 3D-curve
--- resolution and corresp. tolerances' values of <aE1>, <aE2>
---
CorrectRange (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aSR: Range from IntTools;
aNewSR:out Range from IntTools);
---Purpose:
--- Correct shrunk range <aSR> taking into account 3D-curve
--- resolution and corresp. tolerances' values of <aE>, <aF>
---
CopySource (myclass;
aSourceShape: Shape from TopoDS;
aDestShape:out Shape from TopoDS);
---Purpose:
--- Make a copy of <aSourceShape>
---
end Tools;

View File

@@ -1,248 +0,0 @@
-- Created on: 2001-04-02
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Tools2D from BOPTools
---Purpose:
--- The class contains handy static functions
--- dealing with the topology
uses
Vec from gp,
Dir from gp,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Curve from Geom2d,
Curve from Geom,
ProjectedCurve from ProjLib
is
RemovePCurveForEdgeOnFace (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS);
---Purpose:
--- Remove P-Curve of the edge <aE> on the face <aF>
---
BuildPCurveForEdgeOnFace (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS);
---Purpose:
--- Compute P-Curve for the edge <aE> on the face <aF>
---
EdgeTangent (myclass;
anE : Edge from TopoDS;
aT : Real from Standard;
Tau : out Vec from gp)
returns Boolean from Standard;
---Purpose:
--- Compute tangent for the edge <aE> [in 3D] at parameter <aT>
---
FaceNormal (myclass;
aF: Face from TopoDS;
U : Real from Standard;
V : Real from Standard;
aN: out Vec from gp);
---Purpose:
--- Compute normal for the face <aF> at parameters <U,V>
--- of the corresp. surface.
---
PointOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
U : out Real from Standard;
V : out Real from Standard);
---Purpose:
--- Compute surface parameters <U,V> of the face <aF>
--- for the point from the edge <aE> at parameter <aT>.
---
CurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aToler: out Real from Standard;
aTrim3d:Boolean from Standard);
---Purpose:
--- Get P-Curve <aC> for the edge <aE> on surface <aF> .
--- If the P-Curve does not exist, build it using Make2D().
--- [aToler] - reached tolerance
--- [aTrim3d] - trimming flag.
---
CurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard;
aTrim3d:Boolean from Standard);
---Purpose:
--- 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
--- [aTrim3d] - trimming flag.
---
HasCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the edge <aE> has P-Curve <aC>
--- on surface <aF> .
--- [aFirst, aLast] - range of the P-Curve
--- [aToler] - reached tolerance
--- If the P-Curve does not exist, aC.IsNull()=TRUE.
---
HasCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the edge <aE> has P-Curve <aC>
--- on surface <aF> .
--- If the P-Curve does not exist, aC.IsNull()=TRUE.
---
MakeCurveOnSurface (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard;
aTrim3d:Boolean from Standard);
---Purpose:
--- Same as Make2D()
---
Make2D (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aC : out Curve from Geom2d;
aFirst: out Real from Standard;
aLast : out Real from Standard;
aToler: out Real from Standard;
aTrim3d:Boolean from Standard);
---Purpose:
--- Make P-Curve <aC> for the edge <aE> on surface <aF> .
--- [aFirst, aLast] - range of the P-Curve
--- [aToler] - reached tolerance
--- [aTrim3d] - trimming flag.
---
MakePCurveOnFace (myclass;
aF: Face from TopoDS;
C3D : Curve from Geom;
aC : out Curve from Geom2d;
aToler: out Real from Standard) ;
---Purpose:
--- Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
--- [aToler] - reached tolerance
---
MakePCurveOnFace (myclass;
aF: Face from TopoDS;
C3D : Curve from Geom;
aT1 : Real from Standard;
aT2 : Real from Standard;
aC : out Curve from Geom2d;
aToler: out Real from Standard) ;
---Purpose:
--- Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
--- [aT1, aT2] - range to build
--- [aToler] - reached tolerance
---
AdjustPCurveOnFace (myclass;
aF : Face from TopoDS;
C3D : Curve from Geom;
aC2D : Curve from Geom2d;
aC2DA : out Curve from Geom2d);
---Purpose:
--- Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
---
AdjustPCurveOnFace (myclass;
aF : Face from TopoDS;
aT1 : Real from Standard;
aT2 : Real from Standard;
aC2D : Curve from Geom2d;
aC2DA : out Curve from Geom2d);
---Purpose:
--- Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
--- [aT1, aT2] - range to adjust
---
MakePCurveOfType (myclass;
PC : ProjectedCurve from ProjLib;
aC : out Curve from Geom2d);
---Purpose:
--- Make empty P-Curve <aC> of relevant to <PC> type
---
TangentOnEdge (myclass;
aParm: Real from Standard;
anE : Edge from TopoDS;
aTang: out Vec from gp)
returns Boolean from Standard;
---Purpose:
--- Compute tangent for the edge <anE> at parameter <aParm>
---
TangentOnEdge (myclass;
anE : Edge from TopoDS;
aDTang: out Dir from gp)
returns Boolean from Standard;
---Purpose:
--- Compute tangent for the edge <anE> at arbitrary intermediate parameter.
---
TangentOnVertex (myclass;
aVF : Vertex from TopoDS;
aVL : Vertex from TopoDS;
anE : Edge from TopoDS;
aTang: out Vec from gp)
returns Boolean from Standard;
---Purpose:
--- Compute tangent for the vertex point <aVF> for the edge <anE>.
--- <aVL> is opposite vertex of the edge
---
EdgeBounds (myclass;
anE : Edge from TopoDS;
aFirst: out Real from Standard;
aLast : out Real from Standard);
---Purpose:
--- Returns parametric range for the edge <anE>.
---
IntermediatePoint (myclass;
aFirst: Real from Standard;
aLast : Real from Standard)
returns Real from Standard;
---Purpose:
--- Compute intermediate value in between [aFirst, aLast] .
---
IntermediatePoint (myclass;
anE : Edge from TopoDS)
returns Real from Standard;
---Purpose:
--- Compute intermediate value of parameter for the edge <anE>.
---
end Tools2D;

View File

@@ -1,472 +0,0 @@
-- Created on: 2001-04-05
-- Created by: Peter KURNEV
-- Copyright (c) 2001-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class Tools3D from BOPTools
---Purpose:
-- The class contains handy static functions
-- dealing with the topology
uses
Pln from gp,
Dir from gp,
Pnt from gp,
Pnt2d from gp,
Surface from Geom,
Shape from TopoDS,
Wire from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Solid from TopoDS,
ShapeEnum from TopAbs,
Orientation from TopAbs,
State from TopAbs,
ListOfShape from TopTools,
Context from IntTools,
IndexedDataMapOfShapeListOfShape from TopTools
is
SubShapesAmount (myclass;
aS: Shape from TopoDS;
aT: ShapeEnum from TopAbs)
returns Integer from Standard ;
---Purpose:
-- Returns amount of sub-shapes of type <aT>
-- for the shape <aS>
--
IsConvexWire (myclass;
aW: Wire from TopoDS)
returns Boolean from Standard ;
---Purpose:
-- Returns TRUE if
-- amount of the vertices <= amount of the edges>
-- for the wire <aW>
--
RemoveSims (myclass;
aF: Face from TopoDS;
aContext: Context from IntTools);
---Purpose:
-- Remove seam edges from face <aF>
--
RemoveSims (myclass;
aS: Shape from TopoDS;
aContext: Context from IntTools);
---Purpose:
-- Remove seam edges from all faces of shape <aS>
--
EdgeOrientation (myclass;
aEx: Edge from TopoDS;
aF1: Face from TopoDS;
aF2: Face from TopoDS)
returns Orientation from TopAbs;
---Purpose:
-- For the draft section edge <aEx> computes orientation
-- in accordance with vector product between normals to
-- the faces <aF1>, <aF2>
--
IsSplitToReverse1 (myclass;
aE1: Edge from TopoDS;
aE2: Edge from TopoDS;
aContext: Context from IntTools)
returns Boolean from Standard;
---Purpose:
-- Returns TRUE if direction of the edge <aE1> is not
-- the same as for the edge <aE2>
-- (using projection)
--
DoSplitSEAMOnFace (myclass;
aSp: Edge from TopoDS;
aF : Face from TopoDS);
---Purpose:
-- Make the edge <aSp> seam edge for the face <aF>
--
--modified by NIZHNY-MKK Mon Feb 17 15:02:01 2003.BEGIN
DoSplitSEAMOnFace (myclass;
theSplit : Edge from TopoDS;
theSeam : Edge from TopoDS;
theFace : Face from TopoDS;
IsReversed: out Boolean from Standard)
returns Boolean from Standard;
---Purpose:
-- Make the edge <theSplit> seam edge for the face <theFace>
-- It uses pcurves of <theSeam> to make <theSplit> seam edge.
-- IsReversed is true if pcurves of <theSplit> and <theSeam> are
-- reversed according to each other.
-- Returns true if <theSplit> was made seam edge for <theFace>
--
--modified by NIZHNY-MKK Mon Feb 17 15:02:04 2003.END
IsTouchCase (myclass;
aEx: Edge from TopoDS;
aF1: Face from TopoDS;
aF2: Face from TopoDS)
returns Boolean from Standard;
---Purpose:
-- Returns TRUE if the edge <aEx> is section edge
-- between touching faces <aF1>, <aF2>
--
GetTangentToEdge (myclass;
aE: Edge from TopoDS;
aT: Real from Standard;
aD:out Dir from gp)
returns Boolean from Standard;
---Purpose:
-- Computes tangent (3D) for the edge <aE>
-- at parameter <aT>
-- Returns TRUE if the edge <aE> is not degenerated.
--
GetTangentToEdge (myclass;
aE: Edge from TopoDS;
aD:out Dir from gp)
returns Boolean from Standard;
---Purpose:
--- Computes tangent (3D) for the edge <aE>
--- at arbitrary intermediate parameter
--- Returns TRUE if the edge <aE> is not degenerated.
---
GetNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aD:out Dir from gp);
---Purpose:
--- Computes normal to the face <aF> for the point on the edge <aE>
--- at parameter <aT>
---
GetNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aD:out Dir from gp);
---Purpose:
--- Computes normal to the face <aF> for the point on the edge <aE>
--- at arbitrary intermediate parameter
---
GetBiNormal (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aD:out Dir from gp);
---Purpose:
--- Computes binormal to the face <aF> for the point on the edge <aE>
--- at parameter <aT>
---
GetBiNormal (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aD:out Dir from gp);
---Purpose:
--- Computes binormal to the face <aF> for the point on the edge <aE>
--- at arbitrary intermediate parameter
---
IsSplitToReverse(myclass;
aE : Edge from TopoDS;
aSp: Edge from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if direction of the edge <aE1> is not
--- the same as for the edge <aE2>
---
GetAdjacentFace (myclass;
aF : Face from TopoDS;
aE : Edge from TopoDS;
aEFMap: IndexedDataMapOfShapeListOfShape from TopTools;
anAdjF:out Face from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Get face <anAdjF> that is adjacent to the face <aF> through
--- the edge <aE> (using map EF <aEFMap>)
--- Returns FALSE if adjacent face is not found
---
IsKeepTwice (myclass;
aF1 : Face from TopoDS;
aF2 : Face from TopoDS;
aF2Adj: Face from TopoDS;
aSpEF2: Edge from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if pair of faces <aF2> and <aF2Adj>
--- that are adjacent faces through the edge <aSpEF2>
--- crosses the face <aF1> by <aSpEF2>
---
SenseFlag (myclass;
aNF1 : Dir from gp;
aNF2 : Dir from gp)
returns Integer from Standard;
---Purpose:
--- Returns 1 if scalar product aNF1* aNF2>0.
--- Returns 0 if directions aNF1 aNF2 coinside
--- Returns -1 if scalar product aNF1* aNF2<0.
---
GetNormalToSurface (myclass;
aS: Surface from Geom;
U : Real from Standard;
V : Real from Standard;
aD:out Dir from gp)
returns Boolean from Standard;
---Purpose:
--- Compute normal <aD> to surface <aS> in point (U,V)
--- Returns TRUE if directions aD1U, aD1V coinside
---
GetPlanes (myclass;
aSp : Edge from TopoDS;
aE2 : Edge from TopoDS;
aEFMap2: IndexedDataMapOfShapeListOfShape from TopTools;
aE1 : Edge from TopoDS;
aF1 : Face from TopoDS;
aST1:out State from TopAbs;
aContext: Context from IntTools);
---Purpose:
--- Internal usage
---
Orientation (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS)
returns Orientation from TopAbs;
---Purpose:
--- Get the orientation for the edge <aE> on the face <aF>
--- Returns TopAbs_INTERNAL if the edge <aE> is not found
--- on the face <aF>
---
SignDistance (myclass;
aP : Pnt from gp;
aPL: Pln from gp)
returns Real from Standard;
---Purpose:
--- Computes signed distance between the 3D-point <aP>
--- and the plane <aPL>.
---
-- Warning:
--- The distance is not divided by sqrt(A*A+B*B+C*C)
---
GetApproxNormalToFaceOnEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aPx:out Pnt from gp;
aD:out Dir from gp);
---Purpose:
--- 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:
--- 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)
---
PointNearEdge (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aT : Real from Standard;
aDt2D: Real from Standard;
aP2D :out Pnt2d from gp;
aPx :out Pnt from gp);
---Purpose:
--- 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>
---
PointNearEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aT: Real from Standard;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp);
---Purpose:
--- 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_Tools3D::MinStepIn2d()
---
PointNearEdge (myclass;
aE: Edge from TopoDS;
aF: Face from TopoDS;
aP2D:out Pnt2d from gp;
aPx:out Pnt from gp);
---Purpose:
--- 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_Tools3D::MinStepIn2d()
---
PointToCompare (myclass;
aP1: Pnt from gp;
aP2: Pnt from gp;
aF: Face from TopoDS;
aPx:out Pnt from gp;
aContext: Context from IntTools);
---Purpose:
--- For 3D-point <aP1> find projection point <aPx> on the face <aF>.
--- If the distance (<aP1>, <aPx>) > TolF =>
--- For 3D-point <aP2> find projection point <aPx> on the face <aF>.
--- If the distance (<aP2>, <aPx>) > TolF => returns <aP1>
---
GetPlane (myclass;
aSp : Edge from TopoDS;
aE1 : Edge from TopoDS;
aF1 : Face from TopoDS;
aF2 : Face from TopoDS;
aST:out State from TopAbs;
aContext: Context from IntTools);
---Purpose:
--- Compute 3D-state for the point on the split edge <aSp>
--- (with base edge <aE1> and the face <aF1>) comparing with
--- the face <aF2>
---
GetPointState (myclass;
aSp : Edge from TopoDS;
aEF2 : Edge from TopoDS;
aF2Adj : Face from TopoDS;
aF1 : Face from TopoDS;
aST:out State from TopAbs);
---Purpose:
--- Compute 3D-state for the point on the split edge <aSp>
--- (with base edge <aEF2> and the adjacent face <aF2Adj>) comparing with
--- the face <aF1>
---
OrientEdgeOnFace (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aER : out Edge from TopoDS);
---Purpose:
--- Get the edge <aER> from the face <aF> that is the same as
--- the edge <aE>
---
OrientTouchEdgeOnF1 (myclass;
aSp: Edge from TopoDS;
aEx: Edge from TopoDS;
aF1: Face from TopoDS;
aF2: Face from TopoDS)
returns Orientation from TopAbs;
---Purpose:
--- Computes orientation for the split edge <aSp>
--- [with base edge <aEx> and face <aF2>] on the
--- face <aF1>
---
GetSeams (myclass;
aF : Face from TopoDS;
aSimm1 : out Edge from TopoDS;
aSimm2 : out Edge from TopoDS);
---Purpose:
--- Get seam edges <aSimm1>, <aSimm2> for the face <aF>
---
GetSeam (myclass;
aF : Face from TopoDS;
aS1: Edge from TopoDS;
aS2: out Edge from TopoDS);
---Purpose:
--- Get opposite seam edge <aS2> for the face <aF> with
--- known seam edge <aS1>
---
IsValidArea (myclass;
aF : Face from TopoDS;
aNegativeFlag : out Boolean from Standard)
returns Boolean from Standard;
---Purpose:
--- Check validity of the area of face <aF>.
--- Returns TRUE if the Abs. value of the area
--- is greater than 1.e-16
---
MinStepIn2d(myclass)
returns Real from Standard;
---Purpose:
--- Returns simple step value that is used in 2D-computations
--- = 1.e-5
---
IsEmptyShape(myclass;
aS: Shape from TopoDS)
returns Boolean from Standard;
---Purpose:
--- Returns TRUE if the shape <aS> does not contain
--- geometry information (e.g. empty compound)
---
InvertShape(myclass;
aS : Shape from TopoDS;
aSInv:out Shape from TopoDS);
---Purpose:
--- Change orientations to opposite for the shape <aS>
--- and all its sub-shapes. Returns <aSInv>
---
GetStatePartIN2D(myclass;
aSp :Edge from TopoDS;
aEF1 :Edge from TopoDS;
aF1 :Face from TopoDS;
aF2 :Face from TopoDS;
aContext: Context from IntTools)
returns State from TopAbs;
---Purpose:
--- Used in touch case
--- Compute the 3D-state for the point on the split
--- edge <aSp> (with base edge <aEF1> on face <aF1>)
--- comparing with <aF2>.
--- Used in touch case <aF1>/<aF2>
---
CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS;
theFace2: Face from TopoDS;
theContext: Context from IntTools)
returns Boolean from Standard;
ComputeFaceState(myclass; theFace: Face from TopoDS;
theRef : Solid from TopoDS;
theContext: Context from IntTools;
theState: out State from TopAbs)
returns Boolean from Standard;
TreatedAsAnalytic(myclass; aTx :Real from Standard;
aPx :Pnt from gp;
aEx :Edge from TopoDS;
aFx :Face from TopoDS;
aE1 :Edge from TopoDS;
aF1 :Face from TopoDS;
aTolTangent:Real from Standard;
aTolRadius :Real from Standard;
aState :out State from TopAbs;
aContext: Context from IntTools)
returns Boolean from Standard;
TreatedAsAnalytic (myclass; aFx :Face from TopoDS;
aSpE1 :Edge from TopoDS;
aF1 :Face from TopoDS;
aTolTangent:Real from Standard;
aTolRadius :Real from Standard;
aState :out State from TopAbs;
aContext: Context from IntTools)
returns Boolean from Standard;
HasAnalyticSurfaceType (myclass; aF: Face from TopoDS)
returns Boolean from Standard;
end Tools3D;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,363 +0,0 @@
// Created on: 2004-06-10
// Created by: Peter KURNEV
// Copyright (c) 2004-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BOPTools_Tools3D.ixx>
#include <math.h>
#include <gp_Dir.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Lin.hxx>
#include <gp_Ax1.hxx>
#include <gp_Cone.hxx>
#include <TopAbs_Orientation.hxx>
#include <Geom_Surface.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <BRep_Tool.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <IntTools_Tools.hxx>
#include <BOPTools_Tools2D.hxx>
#include <Geom_Curve.hxx>
#include <gp_Vec.hxx>
static
Standard_Boolean AnalyticState(const TopoDS_Face& aF1,
const TopoDS_Face& aFx,
const gp_Pnt& aP,
const gp_Dir& aDNSx,
const Standard_Real aTolR,
TopAbs_State& aSt);
static
gp_Pnt ProjectedPoint (const gp_Pnt&,
const gp_Ax1&);
//=======================================================================
//function : TreatedAsAnalytic
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools3D::TreatedAsAnalytic(const TopoDS_Face& aFx,
const TopoDS_Edge& aSpE1,
const TopoDS_Face& aF1,
const Standard_Real aTolTangent,
const Standard_Real aTolR,
TopAbs_State& aSt,
const Handle(IntTools_Context)& )
{
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1, aTb, aTe;
gp_Dir aDNSx, aDNS1;
gp_Pnt aP1;
//
bFlag=Standard_False;
//
bIsAnalytic=BOPTools_Tools3D::HasAnalyticSurfaceType(aFx);
if (!bIsAnalytic) {
return bFlag;
}
bIsAnalytic=BOPTools_Tools3D::HasAnalyticSurfaceType(aF1);
if (!bIsAnalytic) {
return bFlag;
}
//
Handle(Geom_Curve)aC3D =BRep_Tool::Curve(aSpE1, aTb, aTe);
aT1=BOPTools_Tools2D::IntermediatePoint (aTb, aTe);
aC3D->D0(aT1, aP1);
//
BOPTools_Tools3D::GetNormalToFaceOnEdge(aSpE1, aF1, aT1, aDNS1);
BOPTools_Tools3D::GetNormalToFaceOnEdge(aSpE1, aFx, aT1, aDNSx);
//
bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent);
if (!bIsDirsCoinside) {
return bFlag;
}
//
bFlag=AnalyticState(aF1, aFx, aP1, aDNSx, aTolR, aSt);
//
return bFlag;
}
//=======================================================================
//function : TreatedAsAnalytic
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools3D::TreatedAsAnalytic(const Standard_Real aTx,
const gp_Pnt& aPx,
const TopoDS_Edge& anEx,
const TopoDS_Face& aFx,
const TopoDS_Edge& anE1,
const TopoDS_Face& aF1,
const Standard_Real aTolTangent,
const Standard_Real aTolR,
TopAbs_State& aSt,
const Handle(IntTools_Context)& aContext)
{
Standard_Boolean bFlag, bIsAnalytic, bIsDirsCoinside;
Standard_Real aT1;
gp_Dir aDNSx, aDNS1;
//
bFlag=Standard_False;
//
bIsAnalytic=BOPTools_Tools3D::HasAnalyticSurfaceType(aFx);
if (!bIsAnalytic) {
return bFlag;
}
bIsAnalytic=BOPTools_Tools3D::HasAnalyticSurfaceType(aF1);
if (!bIsAnalytic) {
return bFlag;
}
//
BOPTools_Tools3D::GetNormalToFaceOnEdge(anEx, aFx, aTx, aDNSx);
aContext->ProjectPointOnEdge(aPx, anE1, aT1);
BOPTools_Tools3D::GetNormalToFaceOnEdge(anE1, aF1, aT1, aDNS1);
//
bIsDirsCoinside=IntTools_Tools::IsDirsCoinside(aDNSx, aDNS1, aTolTangent);
if (!bIsDirsCoinside) {
return bFlag;
}
//
bFlag=AnalyticState(aF1, aFx, aPx, aDNSx, aTolR, aSt);
//
return bFlag;
}
//=======================================================================
//function : AnalyticState
//purpose :
//=======================================================================
Standard_Boolean AnalyticState(const TopoDS_Face& aF1,
const TopoDS_Face& aFx,
const gp_Pnt& aP,
const gp_Dir& aDNSx,
const Standard_Real aTolR,
TopAbs_State& aSt)
{
Standard_Boolean bFlag;
Standard_Real aScPr;
Handle(Geom_Surface) aSF1, aSFx;
GeomAbs_SurfaceType aTypeF1, aTypeFx;
TopAbs_Orientation anOrFx;
gp_Dir aDNFx;
gp_Pnt aPOnAxis;
//
bFlag=Standard_False;
aSt=TopAbs_OUT;
//
aSF1=BRep_Tool::Surface(aF1);
GeomAdaptor_Surface aGASF1(aSF1);
aTypeF1=aGASF1.GetType();
//
aSFx=BRep_Tool::Surface(aFx);
GeomAdaptor_Surface aGASFx(aSFx);
aTypeFx=aGASFx.GetType();
//
aDNFx=aDNSx;
anOrFx=aFx.Orientation();
if (anOrFx==TopAbs_REVERSED){
aDNFx.Reverse();
}
//
// Plane/Cylinder
if (aTypeF1==GeomAbs_Plane && aTypeFx==GeomAbs_Cylinder) {
gp_Cylinder aCYx;
//
aCYx=aGASFx.Cylinder();
aPOnAxis=ProjectedPoint(aP, aCYx.Axis());
gp_Vec aVTC(aP, aPOnAxis);
gp_Dir aDTC(aVTC);
//
aScPr=aDNFx*aDTC;
if (aScPr>0.) {
aSt=TopAbs_IN;
}
bFlag=!bFlag;
//
}
//
// Cylinder/Plane
else if (aTypeF1==GeomAbs_Cylinder && aTypeFx==GeomAbs_Plane) {
gp_Cylinder aCY1;
//
aCY1=aGASF1.Cylinder();
aPOnAxis=ProjectedPoint(aP, aCY1.Axis());
gp_Vec aVTC(aP, aPOnAxis);
gp_Dir aDTC(aVTC);
//
aScPr=aDNFx*aDTC;
if (aScPr<0.) {
aSt=TopAbs_IN;
}
bFlag=!bFlag;
} //
//
// Plane/Cone
else if ( aTypeF1==GeomAbs_Plane && aTypeFx==GeomAbs_Cone) {
gp_Cone aCNx;
//
aCNx=aGASFx.Cone();
aPOnAxis=ProjectedPoint(aP, aCNx.Axis());
gp_Vec aVTC(aP, aPOnAxis);
gp_Dir aDTC(aVTC);
//
aScPr=aDNFx*aDTC;
if (aScPr>0.) {
aSt=TopAbs_IN;
}
bFlag=!bFlag;
}
// Cone/Plane
else if (aTypeF1==GeomAbs_Cone && aTypeFx==GeomAbs_Plane) {
gp_Cone aCN1;
//
aCN1=aGASF1.Cone();
aPOnAxis=ProjectedPoint(aP, aCN1.Axis());
gp_Vec aVTC(aP, aPOnAxis);
gp_Dir aDTC(aVTC);
//
aScPr=aDNFx*aDTC;
if (aScPr<0.) {
aSt=TopAbs_IN;
}
bFlag=!bFlag;
} //
//
// Cylinder(Cone)/Cylinder(Cone)
else if ((aTypeF1==GeomAbs_Cylinder || aTypeF1==GeomAbs_Cone) &&
(aTypeFx==GeomAbs_Cylinder || aTypeFx==GeomAbs_Cone)) {
//
Standard_Real aPr, aR1, aRx, aSemiAngle, aDist;
gp_Pnt aPOnAxis1, aPOnAxisx;
gp_Cylinder aCY1, aCYx;
gp_Cone aCN1, aCNx;
gp_Ax1 anAx1, anAxx;
//
// surface 1
if (aTypeF1==GeomAbs_Cylinder) {
aCY1=aGASF1.Cylinder();
anAx1=aCY1.Axis();
aR1=aCY1.Radius();
aPOnAxis1=ProjectedPoint(aP, anAx1);
}
else {
aCN1=aGASF1.Cone();
anAx1=aCN1.Axis();
aSemiAngle=aCN1.SemiAngle();
gp_Lin aLin(anAx1);
aDist=aLin.Distance(aP);
aR1=aDist/cos(aSemiAngle);
aPOnAxis1=ProjectedPoint(aP, anAx1);
}
// surface x
if (aTypeFx==GeomAbs_Cylinder) {
aCYx=aGASFx.Cylinder();
anAxx=aCYx.Axis();
aRx=aCYx.Radius();
aPOnAxisx=ProjectedPoint(aP, anAxx);
}
else {
aCNx=aGASFx.Cone();
anAxx=aCNx.Axis();
aSemiAngle=aCNx.SemiAngle();
gp_Lin aLin(anAxx);
aDist=aLin.Distance(aP);
aRx=aDist/cos(aSemiAngle);
aPOnAxisx=ProjectedPoint(aP, anAxx);
}
//
if (fabs(aRx-aR1) < aTolR) {
return bFlag;
}
//
gp_Vec aVTC1(aP, aPOnAxis1);
gp_Vec aVTCx(aP, aPOnAxisx);
gp_Dir aDTC1(aVTC1);
gp_Dir aDTCx(aVTCx);
//
aPr=aDTC1*aDTCx;
if (aPr < 0.) {
// opposite case
aScPr=aDNFx*aDTCx;
if (aScPr>0.) {
aSt=TopAbs_IN;
}
}
else {
// one inside other
aScPr=aDNFx*aDTC1;
if (aRx<aR1) {
if (aScPr>0.) {
aSt=TopAbs_IN;
}
}
else {
if (aScPr<0.) {
aSt=TopAbs_IN;
}
}
}
bFlag=!bFlag;
//
}
//
return bFlag;
}
//=======================================================================
//function : HasAnalyticSurfaceType
//purpose :
//=======================================================================
Standard_Boolean BOPTools_Tools3D::HasAnalyticSurfaceType(const TopoDS_Face& aF)
{
Standard_Boolean bFlag=Standard_False;
GeomAbs_SurfaceType aType;
//
Handle(Geom_Surface) aS;
//
aS=BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aS);
aType=aGAS.GetType();
//
bFlag= (aType==GeomAbs_Plane ||
aType==GeomAbs_Cylinder ||
aType==GeomAbs_Cone ||
aType==GeomAbs_Sphere);
//
return bFlag;
}
//=======================================================================
//function :ProjectedPoint
//purpose :
//=======================================================================
gp_Pnt ProjectedPoint (const gp_Pnt& aP,
const gp_Ax1& anAx1)
{
Standard_Real aDist;
//
gp_Vec aVDirection(anAx1.Direction());
gp_Pnt anOrigin=anAx1.Location();
gp_Vec aV(anOrigin, aP);
aDist = aVDirection.Dot(aV);
//
gp_Pnt aPx= anOrigin.Translated(aDist*aVDirection);
return aPx;
}

Some files were not shown because too many files have changed in this diff Show More