/usr/include/oce/gp_Ax2.lxx is in liboce-foundation-dev 0.17.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | // Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <Precision.hxx>
inline gp_Ax2::gp_Ax2() : vydir(0.,1.,0.), vxdir(1.,0.,0.)
{ }
inline gp_Ax2::gp_Ax2(const gp_Pnt& P,
const gp_Dir& N,
const gp_Dir& Vx) : axis(P, N), vydir(N), vxdir(N)
{
vxdir.CrossCross(Vx, N);
vydir.Cross(vxdir);
}
inline void gp_Ax2::SetAxis (const gp_Ax1& A1)
{
Standard_Real a = A1.Direction() * vxdir;
if(Abs(Abs(a) - 1.) <= Precision::Angular()) {
if(a > 0.) {
vxdir = vydir;
vydir = axis.Direction();
axis = A1;
}
else {
vxdir = axis.Direction();
axis = A1;
}
}
else {
axis = A1;
vxdir = axis.Direction().CrossCrossed (vxdir, axis.Direction());
vydir = axis.Direction().Crossed (vxdir);
}
}
inline void gp_Ax2::SetDirection (const gp_Dir& V)
{
Standard_Real a = V * vxdir;
if(Abs(Abs(a) - 1.) <= Precision::Angular()) {
if(a > 0.) {
vxdir = vydir;
vydir = axis.Direction();
axis.SetDirection (V);
}
else {
vxdir = axis.Direction();
axis.SetDirection (V);
}
}
else {
axis.SetDirection (V);
vxdir = V.CrossCrossed (vxdir, V);
vydir = V.Crossed (vxdir);
}
}
inline void gp_Ax2::SetLocation (const gp_Pnt& P)
{ axis.SetLocation(P); }
inline void gp_Ax2::SetXDirection (const gp_Dir& Vx)
{
vxdir = axis.Direction().CrossCrossed (Vx, axis.Direction());
vydir = axis.Direction().Crossed (vxdir);
}
inline void gp_Ax2::SetYDirection (const gp_Dir& Vy)
{
vxdir = Vy.Crossed (axis.Direction());
vydir = (axis.Direction()).Crossed (vxdir);
}
inline Standard_Real gp_Ax2::Angle (const gp_Ax2& Other) const
{ return axis.Angle (Other.axis); }
inline const gp_Ax1& gp_Ax2::Axis () const
{ return axis; }
inline const gp_Dir& gp_Ax2::Direction () const
{ return axis.Direction(); }
inline const gp_Pnt& gp_Ax2::Location () const
{ return axis.Location(); }
inline const gp_Dir& gp_Ax2::XDirection () const
{ return vxdir; }
inline const gp_Dir& gp_Ax2::YDirection () const
{ return vydir; }
inline Standard_Boolean gp_Ax2::IsCoplanar
(const gp_Ax2& Other,
const Standard_Real LinearTolerance,
const Standard_Real AngularTolerance) const
{
const gp_Dir& DD = axis.Direction();
const gp_Pnt& PP = axis.Location ();
const gp_Pnt& OP = Other.axis.Location ();
Standard_Real D1 = (DD.X() * (OP.X() - PP.X()) +
DD.Y() * (OP.Y() - PP.Y()) +
DD.Z() * (OP.Z() - PP.Z()));
if (D1 < 0 ) D1 = - D1;
return (D1 <= LinearTolerance &&
axis.IsParallel (Other.axis, AngularTolerance));
}
inline Standard_Boolean gp_Ax2::IsCoplanar
(const gp_Ax1& A,
const Standard_Real LinearTolerance,
const Standard_Real AngularTolerance) const
{
const gp_Dir& DD = axis.Direction();
const gp_Pnt& PP = axis.Location ();
const gp_Pnt& AP = A .Location ();
Standard_Real D1 = (DD.X() * (AP.X() - PP.X()) +
DD.Y() * (AP.Y() - PP.Y()) +
DD.Z() * (AP.Z() - PP.Z()));
if (D1 < 0) D1 = - D1;
return (D1 <= LinearTolerance &&
axis.IsNormal (A, AngularTolerance));
}
inline void gp_Ax2::Rotate(const gp_Ax1& A1, const Standard_Real Ang)
{
gp_Pnt Temp = axis.Location();
Temp.Rotate (A1, Ang);
axis.SetLocation (Temp);
vxdir.Rotate (A1, Ang);
vydir.Rotate (A1, Ang);
axis.SetDirection (vxdir.Crossed (vydir));
}
inline gp_Ax2 gp_Ax2::Rotated(const gp_Ax1& A1,
const Standard_Real Ang) const
{
gp_Ax2 Temp = *this;
Temp.Rotate (A1, Ang);
return Temp;
}
inline void gp_Ax2::Scale (const gp_Pnt& P, const Standard_Real S)
{
gp_Pnt Temp = axis.Location();
Temp.Scale (P, S);
axis.SetLocation (Temp);
if (S < 0.0) {
vxdir.Reverse ();
vydir.Reverse ();
}
}
inline gp_Ax2 gp_Ax2::Scaled(const gp_Pnt& P,
const Standard_Real S) const
{
gp_Ax2 Temp = *this;
Temp.Scale (P, S);
return Temp;
}
inline void gp_Ax2::Transform (const gp_Trsf& T)
{
gp_Pnt Temp = axis.Location();
Temp.Transform (T);
axis.SetLocation (Temp);
vxdir.Transform (T);
vydir.Transform (T);
axis.SetDirection (vxdir.Crossed (vydir));
}
inline gp_Ax2 gp_Ax2::Transformed(const gp_Trsf& T) const
{
gp_Ax2 Temp = *this;
Temp.Transform (T);
return Temp;
}
inline void gp_Ax2::Translate (const gp_Vec& V)
{ axis.Translate (V); }
inline gp_Ax2 gp_Ax2::Translated(const gp_Vec& V) const
{
gp_Ax2 Temp = *this;
Temp.Translate (V);
return Temp;
}
inline void gp_Ax2::Translate (const gp_Pnt& P1, const gp_Pnt& P2)
{ axis.Translate (P1, P2); }
inline gp_Ax2 gp_Ax2::Translated (const gp_Pnt& P1,
const gp_Pnt& P2) const
{
gp_Ax2 Temp = *this;
Temp.Translate (P1, P2);
return Temp;
}
|