b311480e |
1 | -- Copyright (c) 1991-1999 Matra Datavision |
2 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
3 | -- |
4 | -- The content of this file is subject to the Open CASCADE Technology Public |
5 | -- License Version 6.5 (the "License"). You may not use the content of this file |
6 | -- except in compliance with the License. Please obtain a copy of the License |
7 | -- at http://www.opencascade.org and read it completely before using this file. |
8 | -- |
9 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
10 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
11 | -- |
12 | -- The Original Code and all software distributed under the License is |
13 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
14 | -- Initial Developer hereby disclaims all such warranties, including without |
15 | -- limitation, any warranties of merchantability, fitness for a particular |
16 | -- purpose or non-infringement. Please see the License for the specific terms |
17 | -- and conditions governing the rights and limitations under the License. |
18 | |
19 | |
7fd59977 |
20 | |
21 | |
22 | |
7fd59977 |
23 | class Lin2d from gp inherits Storable |
24 | |
25 | ---Purpose: Describes a line in 2D space. |
26 | -- A line is positioned in the plane with an axis (a gp_Ax2d |
27 | -- object) which gives the line its origin and unit vector. A |
28 | -- line and an axis are similar objects, thus, we can convert |
29 | -- one into the other. |
30 | -- A line provides direct access to the majority of the edit |
31 | -- and query functions available on its positioning axis. In |
32 | -- addition, however, a line has specific functions for |
33 | -- computing distances and positions. |
34 | -- See Also |
35 | -- GccAna and Geom2dGcc packages which provide |
36 | -- functions for constructing lines defined by geometric |
37 | -- constraints |
38 | -- gce_MakeLin2d which provides functions for more |
39 | -- complex line constructions |
40 | -- Geom2d_Line which provides additional functions for |
41 | -- constructing lines and works, in particular, with the |
42 | -- parametric equations of lines |
43 | |
44 | |
45 | uses Ax2d from gp, |
46 | Dir2d from gp, |
47 | Pnt2d from gp, |
48 | Trsf2d from gp, |
49 | Vec2d from gp |
50 | |
51 | raises ConstructionError from Standard |
52 | |
53 | is |
54 | |
55 | Create returns Lin2d; |
56 | ---C++:inline |
57 | --- Purpose : Creates a Line corresponding to X axis of the |
58 | -- reference coordinate system. |
59 | |
60 | Create (A : Ax2d) returns Lin2d; |
61 | ---C++:inline |
62 | --- Purpose : Creates a line located with A. |
63 | |
64 | Create (P : Pnt2d; V : Dir2d) returns Lin2d; |
65 | ---C++:inline |
66 | --- Purpose : |
67 | -- <P> is the location point (origin) of the line and |
68 | -- <V> is the direction of the line. |
69 | |
70 | Create (A, B, C : Real) returns Lin2d |
71 | --- Purpose : |
72 | -- Creates the line from the equation A*X + B*Y + C = 0.0 Raises ConstructionError if Sqrt(A*A + B*B) <= Resolution from gp. |
73 | |
74 | raises ConstructionError; |
75 | --- Purpose : Raised if Sqrt(A*A + B*B) <= Resolution from gp. |
76 | |
77 | |
78 | Reverse (me : in out) |
79 | ---C++:inline |
80 | is static; |
81 | |
82 | Reversed (me) returns Lin2d is static; |
83 | ---C++:inline |
84 | ---Purpose: |
85 | -- Reverses the positioning axis of this line. |
86 | -- Note: |
87 | -- - Reverse assigns the result to this line, while |
88 | -- - Reversed creates a new one. |
89 | |
90 | SetDirection (me : in out; V : Dir2d) |
91 | ---C++:inline |
92 | is static; |
93 | --- Purpose : Changes the direction of the line. |
94 | |
95 | SetLocation(me : in out; P : Pnt2d) |
96 | ---C++:inline |
97 | is static; |
98 | --- Purpose : Changes the origin of the line. |
99 | |
100 | SetPosition (me : in out; A : Ax2d) is static; |
101 | ---C++:inline |
102 | --- Purpose : |
103 | -- Complete redefinition of the line. |
104 | -- The "Location" point of <A> is the origin of the line. |
105 | -- The "Direction" of <A> is the direction of the line. |
106 | |
107 | Coefficients (me; A, B, C : out Real) is static; |
108 | ---C++:inline |
109 | --- Purpose : |
110 | -- Returns the normalized coefficients of the line : |
111 | -- A * X + B * Y + C = 0. |
112 | |
113 | Direction (me) returns Dir2d is static; |
114 | ---C++:inline |
115 | --- Purpose : Returns the direction of the line. |
116 | ---C++: return const& |
117 | |
118 | Location (me) returns Pnt2d is static; |
119 | ---C++:inline |
120 | --- Purpose : Returns the location point (origin) of the line. |
121 | ---C++: return const& |
122 | |
123 | Position (me) returns Ax2d is static; |
124 | --- Purpose : |
125 | -- Returns the axis placement one axis whith the same |
126 | -- location and direction as <me>. |
127 | ---C++: inline |
128 | ---C++: return const& |
129 | |
130 | Angle (me; Other : Lin2d) returns Real is static; |
131 | ---C++: inline |
132 | --- Purpose : Computes the angle between two lines in radians. |
133 | |
134 | Contains (me; P : Pnt2d; LinearTolerance : Real) returns Boolean |
135 | is static; |
136 | ---C++: inline |
137 | --- Purpose : Returns true if this line contains the point P, that is, if the |
138 | -- distance between point P and this line is less than or |
139 | -- equal to LinearTolerance. |
140 | |
141 | |
142 | Distance (me; P : Pnt2d) returns Real is static; |
143 | ---C++: inline |
144 | --- Purpose : |
145 | -- Computes the distance between <me> and the point <P>. |
146 | |
147 | |
148 | Distance (me; Other : Lin2d) returns Real is static; |
149 | ---C++: inline |
150 | --- Purpose : Computes the distance between two lines. |
151 | |
152 | |
153 | SquareDistance (me; P : Pnt2d) returns Real is static; |
154 | ---C++: inline |
155 | --- Purpose : |
156 | -- Computes the square distance between <me> and the point |
157 | -- <P>. |
158 | |
159 | |
160 | SquareDistance (me; Other : Lin2d) returns Real is static; |
161 | ---C++: inline |
162 | --- Purpose : Computes the square distance between two lines. |
163 | |
164 | |
165 | |
166 | Normal (me; P : Pnt2d) returns Lin2d is static; |
167 | ---C++: inline |
168 | --- Purpose : |
169 | -- Computes the line normal to the direction of <me>, |
170 | -- passing through the point <P>. |
171 | |
172 | |
173 | |
174 | |
175 | Mirror (me : in out; P : Pnt2d) |
176 | is static; |
177 | |
178 | Mirrored (me; P : Pnt2d) returns Lin2d is static; |
179 | |
180 | --- Purpose : |
181 | -- Performs the symmetrical transformation of a line |
182 | -- with respect to the point <P> which is the center |
183 | -- of the symmetry |
184 | |
185 | |
186 | Mirror (me : in out; A : Ax2d) |
187 | is static; |
188 | |
189 | Mirrored (me; A : Ax2d) returns Lin2d is static; |
190 | |
191 | |
192 | --- Purpose : |
193 | -- Performs the symmetrical transformation of a line |
194 | -- with respect to an axis placement which is the axis |
195 | -- of the symmetry. |
196 | |
197 | |
198 | Rotate(me : in out; P : Pnt2d; Ang : Real) |
199 | ---C++:inline |
200 | is static; |
201 | |
202 | Rotated (me; P : Pnt2d; Ang : Real) returns Lin2d is static; |
203 | ---C++:inline |
204 | |
205 | --- Purpose : |
206 | -- Rotates a line. P is the center of the rotation. |
207 | -- Ang is the angular value of the rotation in radians. |
208 | |
209 | Scale (me : in out; P : Pnt2d; S : Real) |
210 | is static; |
211 | |
212 | Scaled (me; P : Pnt2d; S : Real) returns Lin2d is static; |
213 | ---C++:inline |
214 | --- Purpose : |
215 | -- Scales a line. S is the scaling value. Only the |
216 | -- origin of the line is modified. |
217 | |
218 | |
219 | |
220 | Transform (me : in out; T : Trsf2d) |
221 | ---C++:inline |
222 | is static; |
223 | |
224 | Transformed (me; T : Trsf2d) returns Lin2d is static; |
225 | ---C++:inline |
226 | |
227 | |
228 | --- Purpose : |
229 | -- Transforms a line with the transformation T from class Trsf2d. |
230 | |
231 | Translate (me : in out; V : Vec2d) |
232 | ---C++:inline |
233 | is static; |
234 | |
235 | Translated (me; V : Vec2d) returns Lin2d is static; |
236 | ---C++:inline |
237 | |
238 | |
239 | |
240 | --- Purpose : |
241 | -- Translates a line in the direction of the vector V. |
242 | -- The magnitude of the translation is the vector's magnitude. |
243 | |
244 | |
245 | |
246 | Translate (me : in out; P1, P2 : Pnt2d) is static; |
247 | ---C++:inline |
248 | |
249 | Translated (me; P1, P2 : Pnt2d) returns Lin2d is static; |
250 | ---C++:inline |
251 | |
252 | |
253 | --- Purpose : |
254 | -- Translates a line from the point P1 to the point P2. |
255 | |
256 | |
257 | fields |
258 | |
259 | pos : Ax2d; |
260 | |
261 | end; |