/usr/include/opencascade/gp_Trsf2d.lxx is in libopencascade-foundation-dev 6.5.0.dfsg-2build1.
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 | // File gp_Trsf2d.lxx, JCV 08/01/91
#include <gp_Trsf.hxx>
#include <gp_Pnt2d.hxx>
inline gp_Trsf2d::gp_Trsf2d () {
shape = gp_Identity;
scale = 1.0;
matrix.SetIdentity ();
loc.SetCoord (0.0, 0.0);
}
inline gp_Trsf2d::gp_Trsf2d (const gp_Trsf& T) :
scale(T.ScaleFactor()),
shape(T.Form()),
loc(T.TranslationPart().X(),T.TranslationPart().Y())
{
const gp_Mat& M = T.HVectorialPart();
matrix(1,1) = M(1,1);
matrix(1,2) = M(1,2);
matrix(2,1) = M(2,1);
matrix(2,2) = M(2,2);
}
inline void gp_Trsf2d::SetMirror(const gp_Pnt2d& P)
{
shape = gp_PntMirror;
scale = -1.0;
matrix.SetIdentity ();
loc = P.XY();
loc.Multiply (2.0);
}
inline void gp_Trsf2d::SetRotation (const gp_Pnt2d& P,
const Standard_Real Ang)
{
shape = gp_Rotation;
scale = 1.0;
loc = P.XY ();
loc.Reverse ();
matrix.SetRotation (Ang);
loc.Multiply (matrix);
loc.Add (P.XY());
}
inline void gp_Trsf2d::SetScale (const gp_Pnt2d& P,
const Standard_Real S)
{
shape = gp_Scale;
scale = S;
matrix.SetIdentity ();
loc = P.XY ();
loc.Multiply (1.0 - S);
}
inline void gp_Trsf2d::SetTranslation(const gp_Vec2d& V)
{
shape = gp_Translation;
scale = 1.0;
matrix.SetIdentity ();
loc = V.XY ();
}
inline void gp_Trsf2d::SetTranslation (const gp_Pnt2d& P1,
const gp_Pnt2d& P2)
{
shape = gp_Translation;
scale = 1.0;
matrix.SetIdentity ();
loc = (P2.XY()).Subtracted (P1.XY());
}
inline Standard_Boolean gp_Trsf2d::IsNegative() const
{ return (matrix.Determinant() < 0.0); }
inline const gp_XY& gp_Trsf2d::TranslationPart () const
{ return loc; }
inline const gp_Mat2d& gp_Trsf2d::HVectorialPart () const
{ return matrix; }
inline Standard_Real gp_Trsf2d::Value (const Standard_Integer Row,
const Standard_Integer Col) const
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 2 || Col < 1 || Col > 3, " ");
if (Col < 3) return scale * matrix.Value (Row, Col);
else return loc.Coord (Row);
}
inline gp_TrsfForm gp_Trsf2d::Form() const
{ return shape; }
inline Standard_Real gp_Trsf2d::ScaleFactor() const
{ return scale; }
inline gp_Trsf2d gp_Trsf2d::Inverted() const
{
gp_Trsf2d T = *this;
T.Invert();
return T;
}
inline gp_Trsf2d gp_Trsf2d::Multiplied (const gp_Trsf2d& T) const {
gp_Trsf2d Tresult(*this);
Tresult.Multiply(T);
return Tresult;
}
inline gp_Trsf2d gp_Trsf2d::Powered (const Standard_Integer N)
{
gp_Trsf2d T = *this;
T.Power (N);
return T;
}
inline void gp_Trsf2d::Transforms (Standard_Real& X,
Standard_Real& Y) const
{
gp_XY Doublet (X, Y);
Doublet.Multiply (matrix);
if (scale != 1.0) Doublet.Multiply (scale);
Doublet.Add(loc);
Doublet.Coord (X, Y);
}
inline void gp_Trsf2d::Transforms (gp_XY& Coord) const
{
Coord.Multiply (matrix);
if (scale != 1.0) Coord.Multiply (scale);
Coord.Add(loc);
}
|