b311480e |
1 | -- Created on: 1995-07-17 |
2 | -- Created by: Stagiaire Alain JOURDAIN |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
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. |
10 | -- |
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. |
13 | -- |
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. |
20 | |
7fd59977 |
21 | |
22 | |
23 | class PlaneSection from IntPoly |
24 | |
25 | ---Purpose: determines the section of a triangulated shape by a plane. |
26 | -- The section is a set of edges. |
27 | |
28 | |
29 | uses Real from Standard, |
30 | Integer from Standard, |
31 | Boolean from Standard, |
32 | Shape from TopoDS, |
33 | Edge from TopoDS, |
34 | Trsf from gp, |
35 | Pln from gp, |
36 | Pnt from gp, |
37 | Pnt2d from gp, |
38 | SequenceOfPnt2d from TColgp, |
39 | SequenceOfSequenceOfPnt2d from IntPoly, |
40 | IndexedMapOfPnt2d from IntPoly, |
41 | Pnt2dHasher from IntPoly |
42 | |
43 | is Create |
44 | returns PlaneSection from IntPoly; |
45 | |
46 | Create (S : Shape from TopoDS; |
47 | P : Pln from gp) |
48 | returns PlaneSection from IntPoly; |
49 | |
50 | Section (me : in out) |
51 | is static; |
52 | |
53 | Intersect (me : in out; Point1 : Pnt from gp; |
54 | Point2 : Pnt from gp; |
55 | Point3 : Pnt from gp; |
56 | OutPoint1 : out Pnt2d from gp; |
57 | OutPoint2 : out Pnt2d from gp) |
58 | ---Purpose: determines the 2 2D-points resulting of the intersection |
59 | -- of the triangle (Point1,Point2,Point3) by the plane |
60 | returns Boolean from Standard; |
61 | |
62 | Insert (me : in out; OldPnt : Pnt2d from gp; |
63 | ComPnt : Pnt2d from gp; |
64 | NewPnt : Pnt2d from gp) |
65 | ---Purpose: sees whether OldPnt and NewPnt begins or ends a section |
66 | -- created before and adds the 2 others points. |
67 | -- If not, creates a section |
68 | is static; |
69 | |
70 | Concat (me : in out; BegPnt : Pnt2d from gp; |
71 | EndPnt : Pnt2d from gp; |
72 | OutPnt : out Pnt2d from gp) |
73 | ---Purpose: sees whether BegPnt or EndPnt begins or ends a section |
74 | -- created before, and returns the other point to continue |
75 | -- the construction |
76 | -- Returns 2 if the construction is 'Forward' |
77 | -- Returns 1 if the construction is 'Previous' |
78 | -- Returns 0 if not and creates a section |
79 | returns Integer from Standard; |
80 | |
81 | ConcatSection (me : in out; Section : in out SequenceOfPnt2d from TColgp; |
82 | NbSection : Integer from Standard; |
83 | Index : Integer from Standard) |
84 | ---Purpose: sees whether Section begins or ends another one in mySection, |
85 | -- from the rank 'Index' to the last one 'NbSection' |
86 | is static; |
87 | |
88 | ForwConstruction (me : in out; Point : Pnt2d from gp) |
89 | ---Purpose: builds a section from Point in this way |
90 | -- ___ ___ ___ ___ |
91 | -- Point--/__/--/__/--/__/--/__/---> |
92 | is static; |
93 | |
94 | PrevConstruction (me : in out; Point : Pnt2d from gp) |
95 | ---Purpose: builds a section from Point in this way |
96 | -- ___ ___ ___ ___ |
97 | -- <---/__/--/__/--/__/--/__/--Point |
98 | is static; |
99 | |
100 | NbEdges (me : in out) |
101 | returns Integer from Standard; |
102 | |
103 | Edge (me : in out; Index : Integer from Standard) |
104 | ---Purpose: builds an edge from a sequence of Pnt2d |
105 | -- this is a part of the section |
106 | returns Edge from TopoDS; |
107 | |
108 | |
109 | fields |
110 | myShape : Shape from TopoDS; |
111 | myTransform : Trsf from gp; |
112 | myBackTransform : Trsf from gp; |
113 | mySection : SequenceOfSequenceOfPnt2d from IntPoly; |
114 | myMapBegPoints : IndexedMapOfPnt2d from IntPoly; |
115 | myMapEndPoints : IndexedMapOfPnt2d from IntPoly; |
116 | myCpt : Integer from Standard; |
117 | myIndex : Integer from Standard; |
118 | myNbEdges : Integer from Standard; |
119 | |
120 | end PlaneSection; |