42cf5bc1 |
1 | // Created on: 1993-03-09 |
2 | // Created by: JCV |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Geom_Axis2Placement_HeaderFile |
18 | #define _Geom_Axis2Placement_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <gp_Dir.hxx> |
24 | #include <Geom_AxisPlacement.hxx> |
25 | class Standard_ConstructionError; |
26 | class gp_Ax2; |
27 | class gp_Pnt; |
28 | class gp_Dir; |
29 | class gp_Trsf; |
30 | class Geom_Geometry; |
31 | |
32 | |
33 | class Geom_Axis2Placement; |
34 | DEFINE_STANDARD_HANDLE(Geom_Axis2Placement, Geom_AxisPlacement) |
35 | |
36 | //! Describes a right-handed coordinate system in 3D space. |
37 | //! A coordinate system is defined by: |
38 | //! - its origin, also termed the "Location point" of the coordinate system, |
39 | //! - three orthogonal unit vectors, termed respectively |
40 | //! the "X Direction", "Y Direction" and "Direction" (or |
41 | //! "main Direction") of the coordinate system. |
42 | //! As a Geom_Axis2Placement coordinate system is |
43 | //! right-handed, its "Direction" is always equal to the |
44 | //! cross product of its "X Direction" and "Y Direction". |
45 | //! The "Direction" of a coordinate system is called the |
46 | //! "main Direction" because when this unit vector is |
47 | //! modified, the "X Direction" and "Y Direction" are |
48 | //! recomputed, whereas when the "X Direction" or "Y |
49 | //! Direction" is changed, the "main Direction" is |
50 | //! retained. The "main Direction" is also the "Z Direction". |
51 | //! Note: Geom_Axis2Placement coordinate systems |
52 | //! provide the same kind of "geometric" services as |
53 | //! gp_Ax2 coordinate systems but have more complex |
54 | //! data structures. The geometric objects provided by |
55 | //! the Geom package use gp_Ax2 objects to include |
56 | //! coordinate systems in their data structures, or to |
57 | //! define the geometric transformations, which are applied to them. |
58 | //! Geom_Axis2Placement coordinate systems are |
59 | //! used in a context where they can be shared by |
60 | //! several objects contained inside a common data structure. |
61 | class Geom_Axis2Placement : public Geom_AxisPlacement |
62 | { |
63 | |
64 | public: |
65 | |
66 | |
67 | //! Returns a transient copy of A2. |
68 | Standard_EXPORT Geom_Axis2Placement(const gp_Ax2& A2); |
69 | |
70 | |
71 | //! P is the origin of the axis placement, N is the main |
72 | //! direction of the axis placement and Vx is the "XDirection". |
73 | //! If the two directions N and Vx are not orthogonal the |
74 | //! "XDirection" is computed as follow : |
75 | //! XDirection = N ^ (Vx ^ N). |
76 | //! Raised if N and Vx are parallel. |
77 | Standard_EXPORT Geom_Axis2Placement(const gp_Pnt& P, const gp_Dir& N, const gp_Dir& Vx); |
78 | |
79 | //! Assigns the origin and the three unit vectors of A2 to |
80 | //! this coordinate system. |
81 | Standard_EXPORT void SetAx2 (const gp_Ax2& A2); |
82 | |
83 | |
84 | //! Changes the main direction of the axis placement. |
85 | //! The "Xdirection" is modified : |
86 | //! New XDirection = V ^ (Previous_Xdirection ^ V). |
87 | //! |
88 | //! Raised if V and the previous "XDirection" are parallel |
89 | //! because it is impossible to calculate the new "XDirection" |
90 | //! and the new "YDirection". |
79104795 |
91 | Standard_EXPORT void SetDirection (const gp_Dir& V) Standard_OVERRIDE; |
42cf5bc1 |
92 | |
93 | |
94 | //! Changes the "XDirection" of the axis placement, Vx is the |
95 | //! new "XDirection". If Vx is not normal to the main direction |
96 | //! then "XDirection" is computed as follow : |
97 | //! XDirection = Direction ^ ( Vx ^ Direction). |
98 | //! The main direction is not modified. |
99 | //! Raised if Vx and "Direction" are parallel. |
100 | Standard_EXPORT void SetXDirection (const gp_Dir& Vx); |
101 | |
102 | |
103 | //! Changes the "YDirection" of the axis placement, Vy is the |
104 | //! new "YDirection". If Vy is not normal to the main direction |
105 | //! then "YDirection" is computed as follow : |
106 | //! YDirection = Direction ^ ( Vy ^ Direction). |
107 | //! The main direction is not modified. The "XDirection" is |
108 | //! modified. |
109 | //! Raised if Vy and the main direction are parallel. |
110 | Standard_EXPORT void SetYDirection (const gp_Dir& Vy); |
111 | |
112 | //! Returns a non transient copy of <me>. |
113 | Standard_EXPORT gp_Ax2 Ax2() const; |
114 | |
115 | //! Returns the "XDirection". This is a unit vector. |
116 | Standard_EXPORT const gp_Dir& XDirection() const; |
117 | |
118 | //! Returns the "YDirection". This is a unit vector. |
119 | Standard_EXPORT const gp_Dir& YDirection() const; |
120 | |
121 | |
122 | //! Transforms an axis placement with a Trsf. |
123 | //! The "Location" point, the "XDirection" and the |
124 | //! "YDirection" are transformed with T. The resulting |
125 | //! main "Direction" of <me> is the cross product between |
126 | //! the "XDirection" and the "YDirection" after transformation. |
79104795 |
127 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 |
128 | |
129 | //! Creates a new object which is a copy of this coordinate system. |
79104795 |
130 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
131 | |
132 | |
133 | |
134 | |
92efcf78 |
135 | DEFINE_STANDARD_RTTIEXT(Geom_Axis2Placement,Geom_AxisPlacement) |
42cf5bc1 |
136 | |
137 | protected: |
138 | |
139 | |
140 | |
141 | |
142 | private: |
143 | |
144 | |
145 | Standard_EXPORT Geom_Axis2Placement(const gp_Pnt& P, const gp_Dir& Vz, const gp_Dir& Vx, const gp_Dir& Vy); |
146 | |
147 | gp_Dir vxdir; |
148 | gp_Dir vydir; |
149 | |
150 | |
151 | }; |
152 | |
153 | |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | #endif // _Geom_Axis2Placement_HeaderFile |