1 -- Created on: 1995-08-01
2 -- Created by: Stagiaire Alain JOURDAIN
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class ShapeSection from IntPoly
25 ---Purpose: determines the section between 2 triangulated shapes.
26 -- The section is a set of edges.
28 uses Real from Standard,
29 Integer from Standard,
30 Boolean from Standard,
35 SequenceOfPnt from TColgp,
36 SequenceOfSequenceOfPnt from IntPoly,
37 IndexedMapOfPnt from IntPoly,
38 PntHasher from IntPoly
41 returns ShapeSection from IntPoly;
43 Create (S1 : Shape from TopoDS;
44 S2 : Shape from TopoDS)
45 returns ShapeSection from IntPoly;
53 Intersect (me : in out; S1,S2,S3 : Pnt from gp;
54 OS1,VS0,V1,V2 : Vec from gp;
55 h1,h2,ah1,ah2 : in out Real from Standard)
56 ---Purpose: determines if it exists, the intersection point between
57 -- the (S1,S2,S3) triangle and the edge pointed by V1 and V2.
58 -- Returns True if the triangle-triangle section is found.
59 returns Boolean from Standard;
61 IsEqual (me : in out; Pt1,Pt2 : Pnt from gp)
62 returns Boolean from Standard;
64 IsInside (me : in out; P,P1,P2,P3 : Pnt from gp;
66 ---Purpose: returns True if P is inside the (P1,P2,P3) triangle
68 returns Boolean from Standard;
70 InsertInMap (me : in out)
71 ---Purpose: adds if necessary, myBegPoint in myMapBegPoint
72 -- and myEndPoint in myMapEndPoint.
75 Insert (me : in out; OldPnt : Pnt from gp;
78 ---Purpose: sees whether OldPnt and NewPnt begins or ends a section
79 -- created before and adds the 2 others points.
80 -- If not, creates a section
83 Concat (me : in out; BegPnt : Pnt from gp;
85 OutPnt : out Pnt from gp)
86 ---Purpose: sees whether BegPnt or EndPnt begins or ends a section
87 -- created before, and returns the other point to continue
89 -- Returns 2 if the construction is 'Forward'
90 -- Returns 1 if the construction is 'Previous'
91 -- Returns 0 if not and creates a section
92 returns Integer from Standard;
94 ConcatSection (me : in out; Section : in out SequenceOfPnt from TColgp;
95 NbSection : Integer from Standard;
96 Index : Integer from Standard)
97 ---Purpose: sees whether Section begins or ends another one in mySection,
98 -- from the rank 'Index' to the last one 'NbSection'
101 ForwConstruction (me : in out; Point : Pnt from gp)
102 ---Purpose: builds a section from Point in this way
104 -- Point--/__/--/__/--/__/--/__/--->
107 PrevConstruction (me : in out; Point : Pnt from gp)
108 ---Purpose: builds a section from Point in this way
110 -- <---/__/--/__/--/__/--/__/--Point
113 NbEdges (me : in out)
114 returns Integer from Standard;
116 Edge (me : in out; Index : Integer from Standard)
117 ---Purpose: builds an edge from a sequence of Pnt
118 -- this is a part of the whole section
119 returns Edge from TopoDS;
123 myShape1 : Shape from TopoDS;
124 myShape2 : Shape from TopoDS;
125 mySection : SequenceOfSequenceOfPnt from IntPoly;
126 myMapBegPoints : IndexedMapOfPnt from IntPoly;
127 myMapEndPoints : IndexedMapOfPnt from IntPoly;
128 myBegPoint : Pnt from gp;
129 myEndPoint : Pnt from gp;
130 myFirstTime : Boolean from Standard;
131 myCpt : Integer from Standard;
132 myIndex : Integer from Standard;
133 myNbEdges : Integer from Standard;