1// Copyright (c) 1996-1999 Matra Datavision 2// Copyright (c) 1999-2014 OPEN CASCADE SAS 3// 4// This file is part of Open CASCADE Technology software library. 5// 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. 11// 12// Alternatively, this file may be used under the terms of Open CASCADE 13// commercial license or contractual agreement. 14 15inline gp_Ax22d::gp_Ax22d() 16 : 17 vydir(0.,1.) 18 // vxdir(1.,0.) use default ctor of gp_Dir2d, as it creates the same dir(1, 0) 19{} 20 21inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P , 22 const gp_Dir2d& Vx, 23 const gp_Dir2d& Vy) : 24 point(P), 25 vydir(Vy), 26 vxdir(Vx) 27{ 28 Standard_Real value = Vx.Crossed(Vy); 29 if (value >= 0.0) vydir.SetCoord(-vxdir.Y(), vxdir.X()); 30 else vydir.SetCoord( vxdir.Y(),-vxdir.X()); 31} 32 33inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P , 34 const gp_Dir2d& Vx , 35 const Standard_Boolean Sense) : 36 point(P), 37 vxdir(Vx) 38{ 39 if (Sense) vydir.SetCoord(-Vx.Y(), Vx.X()); 40 else vydir.SetCoord( Vx.Y(),-Vx.X()); 41} 42 43inline gp_Ax22d::gp_Ax22d(const gp_Ax2d& A , 44 const Standard_Boolean Sense) : 45 point(A.Location()), 46 vxdir(A.Direction()) 47{ 48 if (Sense) vydir.SetCoord(-vxdir.Y(), vxdir.X()); 49 else vydir.SetCoord( vxdir.Y(),-vxdir.X()); 50} 51 52inline void gp_Ax22d::SetAxis(const gp_Ax22d& A1) 53{ 54 point = A1.Location(); 55 vxdir = A1.XDirection(); 56 vydir = A1.YDirection(); 57} 58 59inline void gp_Ax22d::SetXAxis (const gp_Ax2d& A1) 60{ 61 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; 62 point = A1.Location (); 63 vxdir = A1.Direction(); 64 if (sign) vydir.SetCoord(-vxdir.Y(), vxdir.X()); 65 else vydir.SetCoord( vxdir.Y(),-vxdir.X()); 66} 67 68inline void gp_Ax22d::SetYAxis (const gp_Ax2d& A1) 69{ 70 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; 71 point = A1.Location (); 72 vydir = A1.Direction(); 73 if (sign) vxdir.SetCoord( vydir.Y(),-vydir.X()); 74 else vxdir.SetCoord(-vydir.Y(), vydir.X()); 75} 76 77inline void gp_Ax22d::SetLocation (const gp_Pnt2d& P) 78{ point = P; } 79 80inline void gp_Ax22d::SetXDirection (const gp_Dir2d& Vx) 81{ 82 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; 83 vxdir = Vx; 84 if (sign) vydir.SetCoord(-Vx.Y(), Vx.X()); 85 else vydir.SetCoord( Vx.Y(),-Vx.X()); 86} 87 88inline void gp_Ax22d::SetYDirection (const gp_Dir2d& Vy) 89{ 90 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0; 91 vydir = Vy; 92 if (sign) vxdir.SetCoord( Vy.Y(),-Vy.X()); 93 else vxdir.SetCoord(-Vy.Y(), Vy.X()); 94} 95 96inline gp_Ax2d gp_Ax22d::XAxis () const 97{ return gp_Ax2d(point, vxdir); } 98 99inline gp_Ax2d gp_Ax22d::YAxis () const 100{ return gp_Ax2d(point, vydir); } 101 102inline const gp_Pnt2d& gp_Ax22d::Location () const 103{ return point; } 104 105inline const gp_Dir2d& gp_Ax22d::XDirection () const 106{ return vxdir; } 107 108inline const gp_Dir2d& gp_Ax22d::YDirection () const 109{ return vydir; } 110 111inline void gp_Ax22d::Rotate (const gp_Pnt2d& P, 112 const Standard_Real Ang) 113{ 114 gp_Pnt2d Temp = point; 115 Temp.Rotate (P,Ang); 116 point = Temp; 117 vxdir.Rotate (Ang); 118 vydir.Rotate (Ang); 119} 120 121inline gp_Ax22d gp_Ax22d::Rotated(const gp_Pnt2d& P, 122 const Standard_Real Ang) const 123{ 124 gp_Ax22d Temp = *this; 125 Temp.Rotate (P,Ang); 126 return Temp; 127} 128 129inline void gp_Ax22d::Scale (const gp_Pnt2d& P, 130 const Standard_Real S) 131{ 132 gp_Pnt2d Temp = point; 133 Temp.Scale (P, S); 134 point = Temp; 135 if (S < 0.0) { 136 vxdir.Reverse (); 137 vydir.Reverse (); 138 } 139} 140 141inline gp_Ax22d gp_Ax22d::Scaled(const gp_Pnt2d& P, 142 const Standard_Real S) const 143{ 144 gp_Ax22d Temp = *this; 145 Temp.Scale (P, S); 146 return Temp; 147} 148 149inline void gp_Ax22d::Transform (const gp_Trsf2d& T) 150{ 151 gp_Pnt2d Temp = point; 152 Temp.Transform (T); 153 point = Temp; 154 vxdir.Transform (T); 155 vydir.Transform (T); 156} 157 158inline gp_Ax22d gp_Ax22d::Transformed(const gp_Trsf2d& T) const 159{ 160 gp_Ax22d Temp = *this; 161 Temp.Transform (T); 162 return Temp; 163} 164 165inline void gp_Ax22d::Translate (const gp_Vec2d& V) 166{ point.Translate (V); } 167 168inline gp_Ax22d gp_Ax22d::Translated(const gp_Vec2d& V) const 169{ 170 gp_Ax22d Temp = *this; 171 Temp.Translate (V); 172 return Temp; 173} 174inline void gp_Ax22d::Translate (const gp_Pnt2d& P1,const gp_Pnt2d& P2) 175{ point.Translate (P1, P2); } 176 177inline gp_Ax22d gp_Ax22d::Translated (const gp_Pnt2d& P1, 178 const gp_Pnt2d& P2) const 179{ 180 gp_Ax22d Temp = *this; 181 Temp.Translate (P1, P2); 182 return Temp; 183} 184 185