1 // Created on: 1993-03-09
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom_Axis2Placement.hxx>
19 #include <Geom_Geometry.hxx>
23 #include <gp_Trsf.hxx>
24 #include <Standard_ConstructionError.hxx>
25 #include <Standard_Type.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(Geom_Axis2Placement,Geom_AxisPlacement)
29 typedef Geom_Axis2Placement Axis2Placement;
37 //=======================================================================
40 //=======================================================================
42 Handle(Geom_Geometry) Geom_Axis2Placement::Copy() const {
44 Handle(Geom_Axis2Placement) A2;
45 A2 = new Axis2Placement (axis.Location(), axis.Direction(), vxdir, vydir);
50 //=======================================================================
51 //function : Geom_Axis2Placement
53 //=======================================================================
55 Geom_Axis2Placement::Geom_Axis2Placement (const gp_Ax2& A2) {
57 vxdir = A2. XDirection();
58 vydir = A2. YDirection();
63 //=======================================================================
64 //function : Geom_Axis2Placement
66 //=======================================================================
68 Geom_Axis2Placement::Geom_Axis2Placement (
75 vxdir = N.CrossCrossed (Vx, N);
76 vydir = N.Crossed (vxdir);
80 //=======================================================================
81 //function : Geom_Axis2Placement
83 //=======================================================================
85 Geom_Axis2Placement::Geom_Axis2Placement (
92 ) : vxdir (Vx), vydir (Vy) {
95 axis.SetDirection (Vz);
99 //=======================================================================
100 //function : XDirection
102 //=======================================================================
104 const gp_Dir& Geom_Axis2Placement::XDirection () const { return vxdir; }
107 //=======================================================================
108 //function : YDirection
110 //=======================================================================
112 const gp_Dir& Geom_Axis2Placement::YDirection () const { return vydir; }
115 //=======================================================================
118 //=======================================================================
120 void Geom_Axis2Placement::SetAx2 (const gp_Ax2& A2) {
122 vxdir = A2.XDirection();
123 vydir = A2.YDirection();
128 //=======================================================================
129 //function : SetDirection
131 //=======================================================================
133 void Geom_Axis2Placement::SetDirection (const gp_Dir& V) {
135 axis.SetDirection (V);
136 vxdir = V.CrossCrossed (vxdir, V);
137 vydir = V.Crossed (vxdir);
141 //=======================================================================
142 //function : SetXDirection
144 //=======================================================================
146 void Geom_Axis2Placement::SetXDirection (const gp_Dir& Vx) {
148 vxdir = axis.Direction().CrossCrossed (Vx, axis.Direction());
149 vydir = axis.Direction().Crossed (vxdir);
154 //=======================================================================
155 //function : SetYDirection
157 //=======================================================================
159 void Geom_Axis2Placement::SetYDirection (const gp_Dir& Vy) {
161 vxdir = Vy.Crossed (axis.Direction());
162 vydir = (axis.Direction()).Crossed (vxdir);
166 //=======================================================================
169 //=======================================================================
171 gp_Ax2 Geom_Axis2Placement::Ax2 () const {
173 return gp_Ax2 (axis.Location(), axis.Direction(), vxdir);
177 //=======================================================================
178 //function : Transform
180 //=======================================================================
182 void Geom_Axis2Placement::Transform (const gp_Trsf& T) {
184 //axis.Location().Transform (T);
185 axis.SetLocation(axis.Location().Transformed(T)); // 10-03-93
188 axis.SetDirection (vxdir.Crossed (vydir));