b311480e |
1 | -- Created on: 2000-11-16 |
2 | -- Created by: Peter KURNEV |
3 | -- Copyright (c) 2000-2012 OPEN CASCADE SAS |
4 | -- |
5 | -- The content of this file is subject to the Open CASCADE Technology Public |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file |
7 | -- except in compliance with the License. Please obtain a copy of the License |
8 | -- at http://www.opencascade.org and read it completely before using this file. |
9 | -- |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | -- |
13 | -- The Original Code and all software distributed under the License is |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | -- Initial Developer hereby disclaims all such warranties, including without |
16 | -- limitation, any warranties of merchantability, fitness for a particular |
17 | -- purpose or non-infringement. Please see the License for the specific terms |
18 | -- and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | |
22 | class Tools from IntTools |
23 | |
24 | ---Purpose: |
25 | --- The class contains handy static functions |
26 | --- dealing with the geometry and topology. |
27 | |
28 | uses |
29 | Shape from TopoDS, |
30 | Vertex from TopoDS, |
31 | Edge from TopoDS, |
32 | Wire from TopoDS, |
33 | Face from TopoDS, |
34 | Pnt2d from gp, |
35 | Pnt from gp, |
36 | Dir from gp, |
37 | CommonPrt from IntTools, |
38 | Curve from IntTools, |
39 | SequenceOfCurves from IntTools, |
40 | Curve from Geom, |
41 | State from TopAbs |
42 | |
43 | is |
44 | ComputeVV (myclass;V1,V2:Vertex from TopoDS) |
45 | returns Integer from Standard; |
46 | ---Purpose: |
47 | --- Computes distance between vertex V1 and vertex V2, |
48 | --- if the distance is less than sum of vertex tolerances |
49 | --- returns zero, |
50 | --- otherwise returns negative value |
51 | --- |
52 | |
53 | HasInternalEdge (myclass; |
54 | aW: Wire from TopoDS) |
55 | returns Boolean from Standard; |
56 | ---Purpose: |
57 | --- Returns True if wire aW contains edges |
58 | --- with INTERNAL orientation |
59 | --- |
60 | |
61 | MakeFaceFromWireAndFace (myclass; |
62 | aW: Wire from TopoDS; |
63 | aF: Face from TopoDS; |
64 | aFNew:out Face from TopoDS); |
65 | ---Purpose: |
66 | --- Build a face based on surface of given face aF |
67 | --- and bounded by wire aW |
68 | --- |
69 | |
70 | ClassifyPointByFace (myclass; |
71 | aF: Face from TopoDS; |
72 | P: Pnt2d from gp) |
73 | returns State from TopAbs; |
74 | ---Purpose: |
75 | --- |
76 | --- |
77 | |
78 | IsVertex (myclass; E: Edge from TopoDS; |
79 | t: Real from Standard) |
80 | returns Boolean from Standard; |
81 | ---Purpose: |
82 | --- Computes square distance between a point on the edge E |
83 | --- corresponded to parameter t and vertices of edge E. |
84 | --- Returns True if this distance is less than square |
85 | --- tolerance of vertex, otherwise returns false. |
86 | --- |
87 | |
88 | IsVertex (myclass; E: Edge from TopoDS; |
89 | V: Vertex from TopoDS; |
90 | t: Real from Standard) |
91 | returns Boolean from Standard; |
92 | ---Purpose: |
93 | --- Returns True if square distance between vertex V |
94 | --- and a point on the edge E corresponded to parameter t |
95 | --- is less than square tolerance of V |
96 | --- |
97 | |
98 | IsVertex (myclass; aCmnPrt: CommonPrt from IntTools) |
99 | returns Boolean from Standard; |
100 | ---Purpose: |
101 | --- Returns True if IsVertx for middle parameter of fist range |
102 | --- and first edge returns True |
103 | --- and if IsVertex for middle parameter of second range and |
104 | --- second range returns True, |
105 | --- otherwise returns False |
106 | --- |
107 | |
108 | IsMiddlePointsEqual(myclass; |
109 | E1: Edge from TopoDS; |
110 | E2: Edge from TopoDS) |
111 | returns Boolean from Standard; |
112 | ---Purpose: |
113 | --- Gets boundary of parameters of E1 and E2. |
114 | --- Computes 3d points on each corresponded to average parameters. |
115 | --- Returns True if distance between computed points is less than |
116 | --- sum of edge tolerance, otherwise returns False. |
117 | --- |
118 | |
119 | IsVertex (myclass; |
120 | aP : Pnt from gp; |
121 | aTolPV: Real from Standard; |
122 | aV: Vertex from TopoDS) |
123 | returns Boolean from Standard; |
124 | ---Purpose: |
125 | --- Returns True if the distance between point aP and |
126 | --- vertex aV is less or equal to sum of aTolPV and |
127 | --- vertex tolerance, otherwise returns False |
128 | --- |
129 | |
130 | IntermediatePoint (myclass; |
131 | aFirst: Real from Standard; |
132 | aLast : Real from Standard) |
133 | returns Real from Standard; |
134 | ---Purpose: |
135 | --- Returns some value between aFirst and aLast |
136 | --- |
137 | |
138 | SplitCurve (myclass; |
139 | aC : Curve from IntTools; |
140 | aS :out SequenceOfCurves from IntTools) |
141 | returns Integer from Standard; |
142 | ---Purpose: |
143 | --- Split aC by average parameter if aC is closed in 3D. |
144 | --- Returns positive value if splitting has been done, |
145 | --- otherwise returns zero. |
146 | --- |
147 | |
148 | RejectLines(myclass; |
149 | aSIn: SequenceOfCurves from IntTools; |
150 | aSOut:out SequenceOfCurves from IntTools); |
151 | ---Purpose: |
152 | --- Puts curves from aSIn to aSOut except those curves that |
153 | --- are coincide with first curve from aSIn. |
154 | --- |
155 | |
156 | IsDirsCoinside (myclass; |
157 | D1:Dir from gp; |
158 | D2:Dir from gp) |
159 | returns Boolean from Standard; |
160 | ---Purpose: |
161 | --- Returns True if D1 and D2 coinside |
162 | --- |
163 | |
164 | IsDirsCoinside (myclass; |
165 | D1 :Dir from gp; |
166 | D2 :Dir from gp; |
167 | aTol:Real from Standard) |
168 | returns Boolean from Standard; |
169 | ---Purpose: |
170 | --- Returns True if D1 and D2 coinside with given tolerance |
171 | --- |
172 | |
173 | IsClosed (myclass; |
174 | aC : Curve from Geom) |
175 | returns Boolean from Standard; |
176 | ---Purpose: |
177 | --- Returns True if aC is BoundedCurve from Geom and |
178 | --- the distance between first point |
179 | --- of the curve aC and last point |
180 | --- is less than 1.e-12 |
181 | --- |
182 | |
183 | CurveTolerance(myclass; |
184 | aC : Curve from Geom; |
185 | aTolBase : Real from Standard) |
186 | returns Real from Standard; |
187 | ---Purpose: |
188 | --- Returns adaptive tolerance for given aTolBase |
189 | --- if aC is trimmed curve and basis curve is parabola, |
190 | --- otherwise returns value of aTolBase |
191 | --- |
192 | |
193 | end Tools; |