1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 // Modif JCV 04/10/90 ajout des methodes Form Scale IsNegative
16 // Modif JCV 10/12/90 ajout de la methode Translationpart
19 #include <Standard_OutOfRange.hxx>
20 #include <gp_Trsf2d.hxx>
24 inline gp_Trsf::gp_Trsf () :
27 matrix(1,0,0, 0,1,0, 0,0,1),
31 inline void gp_Trsf::SetMirror (const gp_Pnt& P)
36 matrix.SetIdentity ();
40 inline void gp_Trsf::SetTranslation (const gp_Vec& V)
42 shape = gp_Translation;
44 matrix.SetIdentity ();
48 inline void gp_Trsf::SetTranslation(const gp_Pnt& P1,
51 shape = gp_Translation;
53 matrix.SetIdentity ();
54 loc = (P2.XYZ()).Subtracted (P1.XYZ());
57 inline void gp_Trsf::SetForm(const gp_TrsfForm P)
62 inline Standard_Boolean gp_Trsf::IsNegative() const
63 { return (scale < 0.0); }
65 inline const gp_XYZ& gp_Trsf::TranslationPart () const
68 inline const gp_Mat& gp_Trsf::HVectorialPart () const
71 inline Standard_Real gp_Trsf::Value (const Standard_Integer Row,
72 const Standard_Integer Col) const
74 Standard_OutOfRange_Raise_if
75 (Row < 1 || Row > 3 || Col < 1 || Col > 4, " ");
76 if (Col < 4) return scale * matrix.Value (Row, Col);
77 else return loc.Coord (Row);
80 inline gp_TrsfForm gp_Trsf::Form () const
83 inline Standard_Real gp_Trsf::ScaleFactor () const
86 inline gp_Trsf gp_Trsf::Inverted() const
93 inline gp_Trsf gp_Trsf::Multiplied (const gp_Trsf& T) const
95 gp_Trsf Tresult(*this);
100 inline gp_Trsf gp_Trsf::Powered (const Standard_Integer N) const
107 inline void gp_Trsf::Transforms (Standard_Real& X,
109 Standard_Real& Z) const
111 gp_XYZ Triplet (X, Y, Z);
112 Triplet.Multiply (matrix);
113 if (scale != 1.0) Triplet.Multiply (scale);
120 inline void gp_Trsf::Transforms (gp_XYZ& Coord) const
122 Coord.Multiply (matrix);
123 if (scale != 1.0) Coord.Multiply (scale);