b311480e |
1 | -- Created on: 2000-11-16 |
2 | -- Created by: Peter KURNEV |
973c2be1 |
3 | -- Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
973c2be1 |
7 | -- This library is free software; you can redistribute it and / or modify it |
8 | -- under the terms of the GNU Lesser General Public version 2.1 as published |
9 | -- by the Free Software Foundation, with special exception defined in the file |
10 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | class Tools from IntTools |
17 | |
18 | ---Purpose: |
19 | --- The class contains handy static functions |
20 | --- dealing with the geometry and topology. |
21 | |
22 | uses |
23 | Shape from TopoDS, |
24 | Vertex from TopoDS, |
25 | Edge from TopoDS, |
26 | Wire from TopoDS, |
27 | Face from TopoDS, |
28 | Pnt2d from gp, |
29 | Pnt from gp, |
30 | Dir from gp, |
31 | CommonPrt from IntTools, |
32 | Curve from IntTools, |
33 | SequenceOfCurves from IntTools, |
34 | Curve from Geom, |
35 | State from TopAbs |
36 | |
37 | is |
38 | ComputeVV (myclass;V1,V2:Vertex from TopoDS) |
39 | returns Integer from Standard; |
40 | ---Purpose: |
41 | --- Computes distance between vertex V1 and vertex V2, |
42 | --- if the distance is less than sum of vertex tolerances |
43 | --- returns zero, |
44 | --- otherwise returns negative value |
45 | --- |
46 | |
47 | HasInternalEdge (myclass; |
48 | aW: Wire from TopoDS) |
49 | returns Boolean from Standard; |
50 | ---Purpose: |
51 | --- Returns True if wire aW contains edges |
52 | --- with INTERNAL orientation |
53 | --- |
54 | |
55 | MakeFaceFromWireAndFace (myclass; |
56 | aW: Wire from TopoDS; |
57 | aF: Face from TopoDS; |
58 | aFNew:out Face from TopoDS); |
59 | ---Purpose: |
60 | --- Build a face based on surface of given face aF |
61 | --- and bounded by wire aW |
62 | --- |
63 | |
64 | ClassifyPointByFace (myclass; |
65 | aF: Face from TopoDS; |
66 | P: Pnt2d from gp) |
67 | returns State from TopAbs; |
68 | ---Purpose: |
69 | --- |
70 | --- |
71 | |
72 | IsVertex (myclass; E: Edge from TopoDS; |
73 | t: Real from Standard) |
74 | returns Boolean from Standard; |
75 | ---Purpose: |
76 | --- Computes square distance between a point on the edge E |
77 | --- corresponded to parameter t and vertices of edge E. |
78 | --- Returns True if this distance is less than square |
79 | --- tolerance of vertex, otherwise returns false. |
80 | --- |
81 | |
82 | IsVertex (myclass; E: Edge from TopoDS; |
83 | V: Vertex from TopoDS; |
84 | t: Real from Standard) |
85 | returns Boolean from Standard; |
86 | ---Purpose: |
87 | --- Returns True if square distance between vertex V |
88 | --- and a point on the edge E corresponded to parameter t |
89 | --- is less than square tolerance of V |
90 | --- |
91 | |
92 | IsVertex (myclass; aCmnPrt: CommonPrt from IntTools) |
93 | returns Boolean from Standard; |
94 | ---Purpose: |
95 | --- Returns True if IsVertx for middle parameter of fist range |
96 | --- and first edge returns True |
97 | --- and if IsVertex for middle parameter of second range and |
98 | --- second range returns True, |
99 | --- otherwise returns False |
100 | --- |
101 | |
102 | IsMiddlePointsEqual(myclass; |
103 | E1: Edge from TopoDS; |
104 | E2: Edge from TopoDS) |
105 | returns Boolean from Standard; |
106 | ---Purpose: |
107 | --- Gets boundary of parameters of E1 and E2. |
108 | --- Computes 3d points on each corresponded to average parameters. |
109 | --- Returns True if distance between computed points is less than |
110 | --- sum of edge tolerance, otherwise returns False. |
111 | --- |
112 | |
113 | IsVertex (myclass; |
114 | aP : Pnt from gp; |
115 | aTolPV: Real from Standard; |
116 | aV: Vertex from TopoDS) |
117 | returns Boolean from Standard; |
118 | ---Purpose: |
119 | --- Returns True if the distance between point aP and |
120 | --- vertex aV is less or equal to sum of aTolPV and |
121 | --- vertex tolerance, otherwise returns False |
122 | --- |
123 | |
124 | IntermediatePoint (myclass; |
125 | aFirst: Real from Standard; |
126 | aLast : Real from Standard) |
127 | returns Real from Standard; |
128 | ---Purpose: |
129 | --- Returns some value between aFirst and aLast |
130 | --- |
131 | |
132 | SplitCurve (myclass; |
133 | aC : Curve from IntTools; |
134 | aS :out SequenceOfCurves from IntTools) |
135 | returns Integer from Standard; |
136 | ---Purpose: |
137 | --- Split aC by average parameter if aC is closed in 3D. |
138 | --- Returns positive value if splitting has been done, |
139 | --- otherwise returns zero. |
140 | --- |
141 | |
142 | RejectLines(myclass; |
143 | aSIn: SequenceOfCurves from IntTools; |
144 | aSOut:out SequenceOfCurves from IntTools); |
145 | ---Purpose: |
146 | --- Puts curves from aSIn to aSOut except those curves that |
147 | --- are coincide with first curve from aSIn. |
148 | --- |
149 | |
150 | IsDirsCoinside (myclass; |
151 | D1:Dir from gp; |
152 | D2:Dir from gp) |
153 | returns Boolean from Standard; |
154 | ---Purpose: |
155 | --- Returns True if D1 and D2 coinside |
156 | --- |
157 | |
158 | IsDirsCoinside (myclass; |
159 | D1 :Dir from gp; |
160 | D2 :Dir from gp; |
161 | aTol:Real from Standard) |
162 | returns Boolean from Standard; |
163 | ---Purpose: |
164 | --- Returns True if D1 and D2 coinside with given tolerance |
165 | --- |
166 | |
167 | IsClosed (myclass; |
168 | aC : Curve from Geom) |
169 | returns Boolean from Standard; |
170 | ---Purpose: |
171 | --- Returns True if aC is BoundedCurve from Geom and |
172 | --- the distance between first point |
173 | --- of the curve aC and last point |
174 | --- is less than 1.e-12 |
175 | --- |
176 | |
177 | CurveTolerance(myclass; |
178 | aC : Curve from Geom; |
179 | aTolBase : Real from Standard) |
180 | returns Real from Standard; |
181 | ---Purpose: |
182 | --- Returns adaptive tolerance for given aTolBase |
183 | --- if aC is trimmed curve and basis curve is parabola, |
184 | --- otherwise returns value of aTolBase |
185 | --- |
186 | |
187 | end Tools; |