0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Geom / Geom_Axis2Placement.cxx
CommitLineData
b311480e 1// Created on: 1993-03-09
2// Created by: JCV
3// Copyright (c) 1993-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <Geom_Axis2Placement.hxx>
19#include <Geom_Geometry.hxx>
20#include <gp_Ax2.hxx>
21#include <gp_Dir.hxx>
22#include <gp_Pnt.hxx>
23#include <gp_Trsf.hxx>
24#include <Standard_ConstructionError.hxx>
25#include <Standard_Type.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(Geom_Axis2Placement,Geom_AxisPlacement)
28
7fd59977 29typedef Geom_Axis2Placement Axis2Placement;
30typedef gp_Ax1 Ax1;
31typedef gp_Dir Dir;
32typedef gp_Pnt Pnt;
33typedef gp_Trsf Trsf;
34typedef gp_Vec Vec;
35
36
37//=======================================================================
38//function : Copy
39//purpose :
40//=======================================================================
41
42Handle(Geom_Geometry) Geom_Axis2Placement::Copy() const {
43
c04c30b3 44 Handle(Geom_Axis2Placement) A2;
7fd59977 45 A2 = new Axis2Placement (axis.Location(), axis.Direction(), vxdir, vydir);
46 return A2;
47}
48
49
50//=======================================================================
51//function : Geom_Axis2Placement
52//purpose :
53//=======================================================================
54
55Geom_Axis2Placement::Geom_Axis2Placement (const gp_Ax2& A2) {
56
57 vxdir = A2. XDirection();
58 vydir = A2. YDirection();
59 axis = A2.Axis();
60}
61
62
63//=======================================================================
64//function : Geom_Axis2Placement
65//purpose :
66//=======================================================================
67
68Geom_Axis2Placement::Geom_Axis2Placement (
69
70const gp_Pnt& P,
71const gp_Dir& N,
72const gp_Dir& Vx) {
73
74 axis = gp_Ax1 (P, N);
75 vxdir = N.CrossCrossed (Vx, N);
76 vydir = N.Crossed (vxdir);
77}
78
79
80//=======================================================================
81//function : Geom_Axis2Placement
82//purpose :
83//=======================================================================
84
85Geom_Axis2Placement::Geom_Axis2Placement (
86
87const gp_Pnt& P,
88const gp_Dir& Vz,
89const gp_Dir& Vx,
90const gp_Dir& Vy
91
92) : vxdir (Vx), vydir (Vy) {
93
94 axis.SetLocation (P);
95 axis.SetDirection (Vz);
96}
97
98
99//=======================================================================
100//function : XDirection
101//purpose :
102//=======================================================================
103
104const gp_Dir& Geom_Axis2Placement::XDirection () const { return vxdir; }
105
106
107//=======================================================================
108//function : YDirection
109//purpose :
110//=======================================================================
111
112const gp_Dir& Geom_Axis2Placement::YDirection () const { return vydir; }
113
114
115//=======================================================================
116//function : SetAx2
117//purpose :
118//=======================================================================
119
120void Geom_Axis2Placement::SetAx2 (const gp_Ax2& A2) {
121
122 vxdir = A2.XDirection();
123 vydir = A2.YDirection();
124 axis = A2.Axis();
125}
126
127
128//=======================================================================
129//function : SetDirection
130//purpose :
131//=======================================================================
132
133void Geom_Axis2Placement::SetDirection (const gp_Dir& V) {
134
135 axis.SetDirection (V);
136 vxdir = V.CrossCrossed (vxdir, V);
137 vydir = V.Crossed (vxdir);
138}
139
140
141//=======================================================================
142//function : SetXDirection
143//purpose :
144//=======================================================================
145
146void Geom_Axis2Placement::SetXDirection (const gp_Dir& Vx) {
147
148 vxdir = axis.Direction().CrossCrossed (Vx, axis.Direction());
149 vydir = axis.Direction().Crossed (vxdir);
150}
151
152
153
154//=======================================================================
155//function : SetYDirection
156//purpose :
157//=======================================================================
158
159void Geom_Axis2Placement::SetYDirection (const gp_Dir& Vy) {
160
161 vxdir = Vy.Crossed (axis.Direction());
162 vydir = (axis.Direction()).Crossed (vxdir);
163}
164
165
166//=======================================================================
167//function : Ax2
168//purpose :
169//=======================================================================
170
171gp_Ax2 Geom_Axis2Placement::Ax2 () const {
172
173 return gp_Ax2 (axis.Location(), axis.Direction(), vxdir);
174}
175
176
177//=======================================================================
178//function : Transform
179//purpose :
180//=======================================================================
181
182void Geom_Axis2Placement::Transform (const gp_Trsf& T) {
183
184 //axis.Location().Transform (T);
185 axis.SetLocation(axis.Location().Transformed(T)); // 10-03-93
186 vxdir.Transform (T);
187 vydir.Transform (T);
188 axis.SetDirection (vxdir.Crossed (vydir));
189}
190
191
192