// 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. inline gp_Ax22d::gp_Ax22d() : vydir(0.,1.), vxdir(1.,0.) {} inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P , const gp_Dir2d& Vx, const gp_Dir2d& Vy) : point(P), vydir(Vy), vxdir(Vx) { Standard_Real value = Vx.Crossed(Vy); if (value >= 0.0) vydir.SetCoord(-vxdir.Y(), vxdir.X()); else vydir.SetCoord( vxdir.Y(),-vxdir.X()); } inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P , const gp_Dir2d& Vx , const Standard_Boolean Sense) : point(P), vxdir(Vx) { if (Sense) vydir.SetCoord(-Vx.Y(), Vx.X()); else vydir.SetCoord( Vx.Y(),-Vx.X()); } inline gp_Ax22d::gp_Ax22d(const gp_Ax2d& A , const Standard_Boolean Sense) : point(A.Location()), vxdir(A.Direction()) { if (Sense) vydir.SetCoord(-vxdir.Y(), vxdir.X()); else vydir.SetCoord( vxdir.Y(),-vxdir.X()); } inline void gp_Ax22d::SetAxis(const gp_Ax22d& A1) { point = A1.Location(); vxdir = A1.XDirection(); vydir = A1.YDirection(); } inline void gp_Ax22d::SetXAxis (const gp_Ax2d& A1) { Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; point = A1.Location (); vxdir = A1.Direction(); if (sign) vydir.SetCoord(-vxdir.Y(), vxdir.X()); else vydir.SetCoord( vxdir.Y(),-vxdir.X()); } inline void gp_Ax22d::SetYAxis (const gp_Ax2d& A1) { Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; point = A1.Location (); vydir = A1.Direction(); if (sign) vxdir.SetCoord( vydir.Y(),-vydir.X()); else vxdir.SetCoord(-vydir.Y(), vydir.X()); } inline void gp_Ax22d::SetLocation (const gp_Pnt2d& P) { point = P; } inline void gp_Ax22d::SetXDirection (const gp_Dir2d& Vx) { Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; vxdir = Vx; if (sign) vydir.SetCoord(-Vx.Y(), Vx.X()); else vydir.SetCoord( Vx.Y(),-Vx.X()); } inline void gp_Ax22d::SetYDirection (const gp_Dir2d& Vy) { Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; vydir = Vy; if (sign) vxdir.SetCoord( Vy.Y(),-Vy.X()); else vxdir.SetCoord(-Vy.Y(), Vy.X()); } inline gp_Ax2d gp_Ax22d::XAxis () const { return gp_Ax2d(point, vxdir); } inline gp_Ax2d gp_Ax22d::YAxis () const { return gp_Ax2d(point, vydir); } inline const gp_Pnt2d& gp_Ax22d::Location () const { return point; } inline const gp_Dir2d& gp_Ax22d::XDirection () const { return vxdir; } inline const gp_Dir2d& gp_Ax22d::YDirection () const { return vydir; } inline void gp_Ax22d::Rotate (const gp_Pnt2d& P, const Standard_Real Ang) { gp_Pnt2d Temp = point; Temp.Rotate (P,Ang); point = Temp; vxdir.Rotate (Ang); vydir.Rotate (Ang); } inline gp_Ax22d gp_Ax22d::Rotated(const gp_Pnt2d& P, const Standard_Real Ang) const { gp_Ax22d Temp = *this; Temp.Rotate (P,Ang); return Temp; } inline void gp_Ax22d::Scale (const gp_Pnt2d& P, const Standard_Real S) { gp_Pnt2d Temp = point; Temp.Scale (P, S); point = Temp; if (S < 0.0) { vxdir.Reverse (); vydir.Reverse (); } } inline gp_Ax22d gp_Ax22d::Scaled(const gp_Pnt2d& P, const Standard_Real S) const { gp_Ax22d Temp = *this; Temp.Scale (P, S); return Temp; } inline void gp_Ax22d::Transform (const gp_Trsf2d& T) { gp_Pnt2d Temp = point; Temp.Transform (T); point = Temp; vxdir.Transform (T); vydir.Transform (T); } inline gp_Ax22d gp_Ax22d::Transformed(const gp_Trsf2d& T) const { gp_Ax22d Temp = *this; Temp.Transform (T); return Temp; } inline void gp_Ax22d::Translate (const gp_Vec2d& V) { point.Translate (V); } inline gp_Ax22d gp_Ax22d::Translated(const gp_Vec2d& V) const { gp_Ax22d Temp = *this; Temp.Translate (V); return Temp; } inline void gp_Ax22d::Translate (const gp_Pnt2d& P1,const gp_Pnt2d& P2) { point.Translate (P1, P2); } inline gp_Ax22d gp_Ax22d::Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const { gp_Ax22d Temp = *this; Temp.Translate (P1, P2); return Temp; }