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