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 #ifndef _gp_Ax1_HeaderFile
16 #define _gp_Ax1_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Real.hxx>
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").
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.
52 //! Creates an axis object representing Z axis of
53 //! the reference co-ordinate system.
57 //! P is the location point and V is the direction of <me>.
58 gp_Ax1(const gp_Pnt& P, const gp_Dir& V);
60 //! Assigns V as the "Direction" of this axis.
61 void SetDirection (const gp_Dir& V);
63 //! Assigns P as the origin of this axis.
64 void SetLocation (const gp_Pnt& P);
66 //! Returns the direction of <me>.
67 const gp_Dir& Direction() const;
69 //! Returns the location point of <me>.
70 const gp_Pnt& Location() const;
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;
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;
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;
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;
105 //! Computes the angular value, in radians, between <me>.Direction() and
106 //! <Other>.Direction(). Returns the angle between 0 and 2*PI
108 Standard_Real Angle (const gp_Ax1& Other) const;
110 //! Reverses the unit vector of this axis.
111 //! and assigns the result to this axis.
114 //! Reverses the unit vector of this axis and creates a new one.
115 Standard_NODISCARD gp_Ax1 Reversed() const;
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);
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_NODISCARD Standard_EXPORT gp_Ax1 Mirrored (const gp_Pnt& P) const;
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);
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_NODISCARD Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax1& A1) const;
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);
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_NODISCARD Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax2& A2) const;
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);
158 //! Rotates this axis at an angle Ang (in radians) about the axis A1
159 //! and creates a new one.
160 Standard_NODISCARD gp_Ax1 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
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);
169 //! Applies a scaling transformation to this axis with:
170 //! - scale factor S, and
171 //! - center P and creates a new axis.
172 Standard_NODISCARD gp_Ax1 Scaled (const gp_Pnt& P, const Standard_Real S) const;
174 //! Applies the transformation T to this axis.
175 //! and assigns the result to this axis.
176 void Transform (const gp_Trsf& T);
179 //! Applies the transformation T to this axis and creates a new one.
181 //! Translates an axis plaxement in the direction of the vector
182 //! <V>. The magnitude of the translation is the vector's magnitude.
183 Standard_NODISCARD gp_Ax1 Transformed (const gp_Trsf& T) const;
186 //! Translates this axis by the vector V,
187 //! and assigns the result to this axis.
188 void Translate (const gp_Vec& V);
191 //! Translates this axis by the vector V,
192 //! and creates a new one.
193 Standard_NODISCARD gp_Ax1 Translated (const gp_Vec& V) const;
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);
202 //! Translates this axis by:
203 //! the vector (P1, P2) defined from point P1 to point P2.
204 //! and creates a new one.
205 Standard_NODISCARD gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
208 //! Dumps the content of me into the stream
209 Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
230 #include <gp_Ax1.lxx>
236 #endif // _gp_Ax1_HeaderFile