8 #error This class is not to be included by the user directly. Use Rotd.h or Rotf.h instead.
18 static ROT2 zero() {
return ROT2((REAL) 0.0); }
19 static ROT2 identity() {
return ROT2((REAL) 0.0); }
20 ROT2& set_identity() { theta = (REAL) 0.0;
return *
this; }
21 ROT2& set_zero() { theta = (REAL) 0.0;
return *
this; }
22 ROT2& invert() { theta = -
theta;
return *
this; }
23 ROT2 inverse()
const {
return ROT2(-theta); }
25 ROT2& operator=(
const ROT2& q) { theta = q.
theta;
return *
this; }
28 ROT2 operator*(REAL scalar)
const {
return ROT2(theta * scalar); }
29 ROT2 operator/(REAL scalar)
const {
return operator*(1.0/scalar); }
30 ROT2& operator*=(
const ROT2& q) { theta += q.
theta;
return *
this; }
31 ROT2& operator*=(REAL scalar) { theta *= scalar;
return *
this; }
32 ROT2& operator/=(REAL scalar) {
return operator*=(1.0/scalar); }
36 REAL cth = std::cos(theta);
37 REAL sth = std::sin(theta);
38 return ORIGIN2(cth*o.x() + sth*o.y(), -sth*o.x() + cth*o.y());
43 REAL cth = std::cos(theta);
44 REAL sth = std::sin(theta);
45 return VECTOR2(cth*o.x() + sth*o.y(), -sth*o.x() + cth*o.y());
52 inline std::ostream& operator<<(std::ostream& out,
const ROT2& q)
54 out <<
"2D rotation: " << q.
theta << std::endl;
REAL theta
angle of rotation
Definition: Rot2.h:49
A two-dimensional floating point vector used for computational geometry calculations and with associa...
Definition: Vector2.h:15
Represents an orientation in 2D.
Definition: Rot2.h:12
A two-dimensional floating point vector used for computational geometry calculations and without asso...
Definition: Origin2.h:14