0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / gp / gp_Ax1.hxx
CommitLineData
42cf5bc1 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_Ax1_HeaderFile
16#define _gp_Ax1_HeaderFile
17
18#include <Standard.hxx>
19#include <Standard_DefineAlloc.hxx>
20#include <Standard_Handle.hxx>
21
22#include <gp_Pnt.hxx>
23#include <gp_Dir.hxx>
24#include <Standard_Boolean.hxx>
25#include <Standard_Real.hxx>
26class gp_Pnt;
27class gp_Dir;
28class gp_Ax2;
29class gp_Trsf;
30class gp_Vec;
31
32
33//! Describes an axis in 3D 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" or "main Direction").
37//! An axis is used:
38//! - to describe 3D geometric entities (for example, the
39//! axis of a revolution entity). It serves the same purpose
40//! as the STEP function "axis placement one axis", or
41//! - to define geometric transformations (axis of
42//! symmetry, axis of rotation, and so on).
43//! For example, this entity can be used to locate a geometric entity
44//! or to define a symmetry axis.
45class gp_Ax1
46{
47public:
48
49 DEFINE_STANDARD_ALLOC
50
51
52 //! Creates an axis object representing Z axis of
53 //! the reference co-ordinate system.
54 gp_Ax1();
55
56
57 //! P is the location point and V is the direction of <me>.
58 gp_Ax1(const gp_Pnt& P, const gp_Dir& V);
59
60 //! Assigns V as the "Direction" of this axis.
61 void SetDirection (const gp_Dir& V);
62
63 //! Assigns P as the origin of this axis.
64 void SetLocation (const gp_Pnt& P);
65
66 //! Returns the direction of <me>.
67 const gp_Dir& Direction() const;
68
69 //! Returns the location point of <me>.
70 const gp_Pnt& Location() const;
71
72
73 //! Returns True if :
74 //! . the angle between <me> and <Other> is lower or equal
75 //! to <AngularTolerance> and
76 //! . the distance between <me>.Location() and <Other> is lower
77 //! or equal to <LinearTolerance> and
78 //! . the distance between <Other>.Location() and <me> is lower
79 //! or equal to LinearTolerance.
80 Standard_EXPORT Standard_Boolean IsCoaxial (const gp_Ax1& Other, const Standard_Real AngularTolerance, const Standard_Real LinearTolerance) const;
81
82
83 //! Returns True if the direction of the <me> and <Other>
84 //! are normal to each other.
85 //! That is, if the angle between the two axes is equal to Pi/2.
86 //! Note: the tolerance criterion is given by AngularTolerance..
87 Standard_Boolean IsNormal (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
88
89
90 //! Returns True if the direction of <me> and <Other> are
91 //! parallel with opposite orientation. That is, if the angle
92 //! between the two axes is equal to Pi.
93 //! Note: the tolerance criterion is given by AngularTolerance.
94 Standard_Boolean IsOpposite (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
95
96
97 //! Returns True if the direction of <me> and <Other> are
98 //! parallel with same orientation or opposite orientation. That
99 //! is, if the angle between the two axes is equal to 0 or Pi.
100 //! Note: the tolerance criterion is given by
101 //! AngularTolerance.
102 Standard_Boolean IsParallel (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
103
104
105 //! Computes the angular value, in radians, between <me>.Direction() and
106 //! <Other>.Direction(). Returns the angle between 0 and 2*PI
107 //! radians.
108 Standard_Real Angle (const gp_Ax1& Other) const;
109
110 //! Reverses the unit vector of this axis.
111 //! and assigns the result to this axis.
112 void Reverse();
113
114 //! Reverses the unit vector of this axis and creates a new one.
115 gp_Ax1 Reversed() const;
116
117
118 //! Performs the symmetrical transformation of an axis
119 //! placement with respect to the point P which is the
120 //! center of the symmetry and assigns the result to this axis.
121 Standard_EXPORT void Mirror (const gp_Pnt& P);
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 and creates a new axis.
126 Standard_EXPORT gp_Ax1 Mirrored (const gp_Pnt& P) const;
127
128
129 //! Performs the symmetrical transformation of an axis
130 //! placement with respect to an axis placement which
131 //! is the axis of the symmetry and assigns the result to this axis.
132 Standard_EXPORT void Mirror (const gp_Ax1& A1);
133
134
135 //! Performs the symmetrical transformation of an axis
136 //! placement with respect to an axis placement which
137 //! is the axis of the symmetry and creates a new axis.
138 Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax1& A1) const;
139
140
141 //! Performs the symmetrical transformation of an axis
142 //! placement with respect to a plane. The axis placement
143 //! <A2> locates the plane of the symmetry :
144 //! (Location, XDirection, YDirection) and assigns the result to this axis.
145 Standard_EXPORT void Mirror (const gp_Ax2& A2);
146
147
148 //! Performs the symmetrical transformation of an axis
149 //! placement with respect to a plane. The axis placement
150 //! <A2> locates the plane of the symmetry :
151 //! (Location, XDirection, YDirection) and creates a new axis.
152 Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax2& A2) const;
153
154 //! Rotates this axis at an angle Ang (in radians) about the axis A1
155 //! and assigns the result to this axis.
156 void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
157
158 //! Rotates this axis at an angle Ang (in radians) about the axis A1
159 //! and creates a new one.
160 gp_Ax1 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
161
162
163 //! Applies a scaling transformation to this axis with:
164 //! - scale factor S, and
165 //! - center P and assigns the result to this axis.
166 void Scale (const gp_Pnt& P, const Standard_Real S);
167
168
169 //! Applies a scaling transformation to this axis with:
170 //! - scale factor S, and
171 //! - center P and creates a new axis.
172 gp_Ax1 Scaled (const gp_Pnt& P, const Standard_Real S) const;
173
174 //! Applies the transformation T to this axis.
175 //! and assigns the result to this axis.
176 void Transform (const gp_Trsf& T);
177
178
179 //! Applies the transformation T to this axis and creates a new one.
180 //!
181 //! Translates an axis plaxement in the direction of the vector
182 //! <V>. The magnitude of the translation is the vector's magnitude.
183 gp_Ax1 Transformed (const gp_Trsf& T) const;
184
185
186 //! Translates this axis by the vector V,
187 //! and assigns the result to this axis.
188 void Translate (const gp_Vec& V);
189
190
191 //! Translates this axis by the vector V,
192 //! and creates a new one.
193 gp_Ax1 Translated (const gp_Vec& V) const;
194
195
196 //! Translates this axis by:
197 //! the vector (P1, P2) defined from point P1 to point P2.
198 //! and assigns the result to this axis.
199 void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
200
201
202 //! Translates this axis by:
203 //! the vector (P1, P2) defined from point P1 to point P2.
204 //! and creates a new one.
205 gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
206
207
208
209
210protected:
211
212
213
214
215
216private:
217
218
219
220 gp_Pnt loc;
221 gp_Dir vdir;
222
223
224};
225
226
227#include <gp_Ax1.lxx>
228
229
230
231
232
233#endif // _gp_Ax1_HeaderFile