+++ /dev/null
-// 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.
-
-#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);
-}
-