1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
4 -- This file is part of Open CASCADE Technology software library.
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
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.
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
15 class Ax22d from gp inherits Storable
17 -- Describes a coordinate system in a plane (2D space).
18 -- A coordinate system is defined by:
19 -- - its origin (also referred to as its "Location point"), and
20 -- - two orthogonal unit vectors, respectively, called the "X
21 -- Direction" and the "Y Direction".
22 -- A gp_Ax22d may be right-handed ("direct sense") or
23 -- left-handed ("inverse" or "indirect sense").
24 -- You use a gp_Ax22d to:
25 -- - describe 2D geometric entities, in particular to position
26 -- them. The local coordinate system of a geometric
27 -- entity serves for the same purpose as the STEP
28 -- function "axis placement two axes", or
29 -- - define geometric transformations.
30 -- Note: we refer to the "X Axis" and "Y Axis" as the axes having:
31 -- - the origin of the coordinate system as their origin, and
32 -- - the unit vectors "X Direction" and "Y Direction",
33 -- respectively, as their unit vectors.
41 raises ConstructionError from Standard
48 --- Purpose : Creates an object representing the reference
49 -- co-ordinate system (OXY).
51 Create (P : Pnt2d; Vx, Vy : Dir2d) returns Ax22d
54 -- Creates a coordinate system with origin P and where:
55 -- - Vx is the "X Direction", and
56 -- - the "Y Direction" is orthogonal to Vx and
57 -- oriented so that the cross products Vx^"Y
58 -- Direction" and Vx^Vy have the same sign.
59 -- Raises ConstructionError if Vx and Vy are parallel (same or opposite orientation).
60 raises ConstructionError;
65 Sense : Boolean from Standard = Standard_True) returns Ax22d;
68 -- Creates - a coordinate system with origin P and "X Direction"
70 -- - right-handed if Sense is true (default value), or
71 -- - left-handed if Sense is false
74 Sense : Boolean from Standard = Standard_True) returns Ax22d;
77 -- Creates - a coordinate system where its origin is the origin of
78 -- A and its "X Direction" is the unit vector of A, which is:
79 -- - right-handed if Sense is true (default value), or
80 -- - left-handed if Sense is false.
82 SetAxis (me : in out; A1 : Ax22d)
85 -- Assigns the origin and the two unit vectors of the
86 -- coordinate system A1 to this coordinate system.
90 SetXAxis (me : in out; A1 : Ax2d)
93 -- Changes the XAxis and YAxis ("Location" point and "Direction")
95 -- The "YDirection" is recomputed in the same sense as before.
99 SetYAxis (me : in out; A1 : Ax2d)
101 --- Purpose : Changes the XAxis and YAxis ("Location" point and "Direction") of <me>.
102 -- The "XDirection" is recomputed in the same sense as before.
105 SetLocation (me : in out; P : Pnt2d) is static;
108 -- Changes the "Location" point (origin) of <me>.
111 SetXDirection (me : in out; Vx : Dir2d)
114 -- Assigns Vx to the "X Direction" of
115 -- this coordinate system. The other unit vector of this
116 -- coordinate system is recomputed, normal to Vx ,
117 -- without modifying the orientation (right-handed or
118 -- left-handed) of this coordinate system.
122 SetYDirection(me : in out; Vy : Dir2d)
124 --- Purpose : Assignsr Vy to the "Y Direction" of
125 -- this coordinate system. The other unit vector of this
126 -- coordinate system is recomputed, normal to Vy,
127 -- without modifying the orientation (right-handed or
128 -- left-handed) of this coordinate system.
132 XAxis (me) returns Ax2d is static;
134 --- Purpose : Returns an axis, for which
135 -- - the origin is that of this coordinate system, and
136 -- - the unit vector is either the "X Direction" of this coordinate system.
137 -- Note: the result is the "X Axis" of this coordinate system.
139 YAxis (me) returns Ax2d is static;
141 --- Purpose : Returns an axis, for which
142 -- - the origin is that of this coordinate system, and
143 -- - the unit vector is either the "Y Direction" of this coordinate system.
144 -- Note: the result is the "Y Axis" of this coordinate system.
146 Location (me) returns Pnt2d is static;
149 -- Returns the "Location" point (origin) of <me>.
150 ---C++: return const&
153 XDirection (me) returns Dir2d is static;
156 -- Returns the "XDirection" of <me>.
157 ---C++: return const&
159 YDirection(me) returns Dir2d is static;
162 -- Returns the "YDirection" of <me>.
163 ---C++: return const&
166 Mirror (me : in out; P : Pnt2d) is static;
168 Mirrored (me; P : Pnt2d) returns Ax22d is static;
171 -- Performs the symmetrical transformation of an axis
172 -- placement with respect to the point P which is the
173 -- center of the symmetry.
175 -- The main direction of the axis placement is not changed.
176 -- The "XDirection" and the "YDirection" are reversed.
177 -- So the axis placement stay right handed.
180 Mirror (me : in out; A : Ax2d) is static;
182 Mirrored (me; A : Ax2d) returns Ax22d is static;
185 -- Performs the symmetrical transformation of an axis
186 -- placement with respect to an axis placement which
187 -- is the axis of the symmetry.
188 -- The transformation is performed on the "Location"
189 -- point, on the "XDirection" and "YDirection".
190 -- The resulting main "Direction" is the cross product between
191 -- the "XDirection" and the "YDirection" after transformation.
195 Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
198 Rotated (me; P : Pnt2d; Ang : Real) returns Ax22d is static;
201 -- Rotates an axis placement. <A1> is the axis of the
202 -- rotation . Ang is the angular value of the rotation
208 Scale (me : in out; P : Pnt2d; S : Real) is static;
211 Scaled (me; P : Pnt2d; S : Real) returns Ax22d is static;
214 -- Applies a scaling transformation on the axis placement.
215 -- The "Location" point of the axisplacement is modified.
217 -- If the scale <S> is negative :
218 -- . the main direction of the axis placement is not changed.
219 -- . The "XDirection" and the "YDirection" are reversed.
220 -- So the axis placement stay right handed.
225 Transform (me : in out; T : Trsf2d) is static;
228 Transformed (me; T : Trsf2d) returns Ax22d is static;
231 -- Transforms an axis placement with a Trsf.
232 -- The "Location" point, the "XDirection" and the
233 -- "YDirection" are transformed with T. The resulting
234 -- main "Direction" of <me> is the cross product between
235 -- the "XDirection" and the "YDirection" after transformation.
238 Translate (me : in out; V : Vec2d)
242 Translated (me; V : Vec2d) returns Ax22d is static;
245 -- Translates an axis plaxement in the direction of the vector
246 -- <V>. The magnitude of the translation is the vector's magnitude.
251 Translate (me : in out; P1, P2 : Pnt2d)
255 Translated (me; P1, P2 : Pnt2d) returns Ax22d is static;
258 -- Translates an axis placement from the point <P1> to the