/usr/include/oce/gp_Trsf.lxx is in liboce-foundation-dev 0.18.2-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 | // Copyright (c) 1995-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.
// Modif JCV 04/10/90 ajout des methodes Form Scale IsNegative
// Modif JCV 10/12/90 ajout de la methode Translationpart
#include <Standard_OutOfRange.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
inline gp_Trsf::gp_Trsf () :
scale(1.0),
shape(gp_Identity),
matrix(1,0,0, 0,1,0, 0,0,1),
loc(0.0, 0.0, 0.0)
{}
inline void gp_Trsf::SetMirror (const gp_Pnt& P)
{
shape = gp_PntMirror;
scale = -1.0;
loc = P.XYZ();
matrix.SetIdentity ();
loc.Multiply(2.0);
}
inline void gp_Trsf::SetTranslation (const gp_Vec& V)
{
shape = gp_Translation;
scale = 1.;
matrix.SetIdentity ();
loc = V.XYZ();
}
inline void gp_Trsf::SetTranslation(const gp_Pnt& P1,
const gp_Pnt& P2)
{
shape = gp_Translation;
scale = 1.0;
matrix.SetIdentity ();
loc = (P2.XYZ()).Subtracted (P1.XYZ());
}
inline Standard_Boolean gp_Trsf::IsNegative() const
{ return (scale < 0.0); }
inline const gp_XYZ& gp_Trsf::TranslationPart () const
{ return loc; }
inline const gp_Mat& gp_Trsf::HVectorialPart () const
{ return matrix; }
inline Standard_Real gp_Trsf::Value (const Standard_Integer Row,
const Standard_Integer Col) const
{
Standard_OutOfRange_Raise_if
(Row < 1 || Row > 3 || Col < 1 || Col > 4, " ");
if (Col < 4) return scale * matrix.Value (Row, Col);
else return loc.Coord (Row);
}
inline gp_TrsfForm gp_Trsf::Form () const
{ return shape; }
inline Standard_Real gp_Trsf::ScaleFactor () const
{ return scale; }
inline gp_Trsf gp_Trsf::Inverted() const
{
gp_Trsf T = *this;
T.Invert();
return T;
}
inline gp_Trsf gp_Trsf::Multiplied (const gp_Trsf& T) const
{
gp_Trsf Tresult(*this);
Tresult.Multiply(T);
return Tresult;
}
inline gp_Trsf gp_Trsf::Powered (const Standard_Integer N) const
{
gp_Trsf T = *this;
T.Power (N);
return T;
}
inline void gp_Trsf::Transforms (Standard_Real& X,
Standard_Real& Y,
Standard_Real& Z) const
{
gp_XYZ Triplet (X, Y, Z);
Triplet.Multiply (matrix);
if (scale != 1.0) Triplet.Multiply (scale);
Triplet.Add(loc);
X = Triplet.X();
Y = Triplet.Y();
Z = Triplet.Z();
}
inline void gp_Trsf::Transforms (gp_XYZ& Coord) const
{
Coord.Multiply (matrix);
if (scale != 1.0) Coord.Multiply (scale);
Coord.Add(loc);
}
|