Warnings on vc14 were eliminated
[occt.git] / src / gp / gp_Ax2d.hxx
1 // Copyright (c) 1991-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _gp_Ax2d_HeaderFile
16 #define _gp_Ax2d_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
21
22 #include <gp_Pnt2d.hxx>
23 #include <gp_Dir2d.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Real.hxx>
26 class gp_Pnt2d;
27 class gp_Dir2d;
28 class gp_Trsf2d;
29 class gp_Vec2d;
30
31
32
33 //! Describes an axis in the plane (2D space).
34 //! An axis is defined by:
35 //! -   its origin (also referred to as its "Location point"),   and
36 //! -   its unit vector (referred to as its "Direction").
37 //! An axis implicitly defines a direct, right-handed
38 //! coordinate system in 2D space by:
39 //! -   its origin,
40 //! - its "Direction" (giving the "X Direction" of the coordinate system), and
41 //! -   the unit vector normal to "Direction" (positive angle
42 //! measured in the trigonometric sense).
43 //! An axis is used:
44 //! -   to describe 2D geometric entities (for example, the
45 //! axis which defines angular coordinates on a circle).
46 //! It serves for the same purpose as the STEP function
47 //! "axis placement one axis", or
48 //! -   to define geometric transformations (axis of
49 //! symmetry, axis of rotation, and so on).
50 //! Note: to define a left-handed 2D coordinate system, use gp_Ax22d.
51 class gp_Ax2d 
52 {
53 public:
54
55   DEFINE_STANDARD_ALLOC
56
57   
58   //! Creates an axis object representing X axis of
59   //! the reference co-ordinate system.
60     gp_Ax2d();
61   
62
63   //! Creates an Ax2d. <P> is the "Location" point of
64   //! the axis placement and V is the "Direction" of
65   //! the axis placement.
66     gp_Ax2d(const gp_Pnt2d& P, const gp_Dir2d& V);
67   
68   //! Changes the "Location" point (origin) of <me>.
69     void SetLocation (const gp_Pnt2d& Locat);
70   
71   //! Changes the direction of <me>.
72     void SetDirection (const gp_Dir2d& V);
73   
74   //! Returns the origin of <me>.
75     const gp_Pnt2d& Location() const;
76   
77   //! Returns the direction of <me>.
78     const gp_Dir2d& Direction() const;
79   
80
81   //! Returns True if  :
82   //! . the angle between <me> and <Other> is lower or equal
83   //! to <AngularTolerance> and
84   //! . the distance between <me>.Location() and <Other> is lower
85   //! or equal to <LinearTolerance> and
86   //! . the distance between <Other>.Location() and <me> is lower
87   //! or equal to LinearTolerance.
88   Standard_EXPORT Standard_Boolean IsCoaxial (const gp_Ax2d& Other, const Standard_Real AngularTolerance, const Standard_Real LinearTolerance) const;
89   
90   //! Returns true if this axis and the axis Other are normal to
91   //! each other. That is, if the angle between the two axes is equal to Pi/2 or -Pi/2.
92   //! Note: the tolerance criterion is given by AngularTolerance.
93     Standard_Boolean IsNormal (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
94   
95   //! Returns true if this axis and the axis Other are parallel,
96   //! and have opposite orientations. That is, if the angle
97   //! between the two axes is equal to Pi or -Pi.
98   //! Note: the tolerance criterion is given by AngularTolerance.
99     Standard_Boolean IsOpposite (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
100   
101   //! Returns true if this axis and the axis Other are parallel,
102   //! and have either the same or opposite orientations. That
103   //! is, if the angle between the two axes is equal to 0, Pi or -Pi.
104   //! Note: the tolerance criterion is given by AngularTolerance.
105     Standard_Boolean IsParallel (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
106   
107
108   //! Computes the angle, in radians, between this axis and
109   //! the axis Other. The value of the angle is between -Pi and Pi.
110     Standard_Real Angle (const gp_Ax2d& Other) const;
111   
112   //! Reverses the direction of <me> and assigns the result to this axis.
113     void Reverse();
114   
115
116   //! Computes a new axis placement with a direction opposite to
117   //! the direction of <me>.
118     gp_Ax2d Reversed() const;
119   
120   Standard_EXPORT void Mirror (const gp_Pnt2d& P);
121   
122
123   //! Performs the symmetrical transformation of an axis
124   //! placement with respect to the point P which is the
125   //! center of the symmetry.
126   Standard_EXPORT gp_Ax2d Mirrored (const gp_Pnt2d& P) const;
127   
128   Standard_EXPORT void Mirror (const gp_Ax2d& A);
129   
130
131   //! Performs the symmetrical transformation of an axis
132   //! placement with respect to an axis placement which
133   //! is the axis of the symmetry.
134   Standard_EXPORT gp_Ax2d Mirrored (const gp_Ax2d& A) const;
135   
136     void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
137   
138
139   //! Rotates an axis placement. <P> is the center of the
140   //! rotation . Ang is the angular value of the rotation
141   //! in radians.
142     gp_Ax2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
143   
144   Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S);
145   
146
147   //! Applies a scaling transformation on the axis placement.
148   //! The "Location" point of the axisplacement is modified.
149   //! The "Direction" is reversed if the scale is negative.
150     gp_Ax2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
151   
152     void Transform (const gp_Trsf2d& T);
153   
154   //! Transforms an axis placement with a Trsf.
155     gp_Ax2d Transformed (const gp_Trsf2d& T) const;
156   
157     void Translate (const gp_Vec2d& V);
158   
159
160   //! Translates an axis placement in the direction of the vector
161   //! <V>. The magnitude of the translation is the vector's magnitude.
162     gp_Ax2d Translated (const gp_Vec2d& V) const;
163   
164     void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
165   
166
167   //! Translates an axis placement from the point <P1> to the
168   //! point <P2>.
169     gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
170
171
172
173
174 protected:
175
176
177
178
179
180 private:
181
182
183
184   gp_Pnt2d loc;
185   gp_Dir2d vdir;
186
187
188 };
189
190
191 #include <gp_Ax2d.lxx>
192
193
194
195
196
197 #endif // _gp_Ax2d_HeaderFile