summaryrefslogtreecommitdiff
path: root/inc/gp_Ax22d.lxx
blob: cdb2b3d57abcfb0098d2ef8040cd396cd66e795e (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// File:	gp_Ax22d.lxx


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;
}