32#ifndef RCSC_GEOM_MATRIX2D_H
33#define RCSC_GEOM_MATRIX2D_H
85 const double &
m21,
const double &
m22,
86 const double &
dx,
const double &
dy )
89 , M_dx(
dx ), M_dy(
dy )
100 M_12 = M_21 = M_dx = M_dy = 0.0;
116 const double &
m21,
const double &
m22,
117 const double &
dx,
const double &
dy )
121 M_dx =
dx; M_dy =
dy;
163 double cosa = angle.
cos();
164 double sina = angle.
sin();
236 return M_11*M_22 - M_12*M_21;
245 return ! ( std::fabs(
det() ) < 0.00000000001 );
312 M_11 *= sx; M_12 *= sx; M_dx *= sx;
313 M_21 *= sy; M_22 *= sy; M_dy *= sy;
349 double tm11 = M_11*m.M_11 + M_12*m.M_21;
350 double tm12 = M_11*m.M_12 + M_12*m.M_22;
351 double tm21 = M_21*m.M_11 + M_22*m.M_21;
352 double tm22 = M_21*m.M_12 + M_22*m.M_22;
354 double tdx = M_11*m.M_dx + M_12*m.M_dy + M_dx;
355 double tdy = M_21*m.M_dx + M_22*m.M_dy + M_dy;
357 M_11 = tm11; M_12 = tm12;
358 M_21 = tm21; M_22 = tm22;
359 M_dx = tdx; M_dy = tdy;
371 M_21*v.
x + M_22*v.
y + M_dy );
381 const double & y )
const
383 return Vector2D( M_11*x + M_12*y + M_dx,
384 M_21*x + M_22*y + M_dy );
393 double tx = M_11*v->
x + M_12*v->
y + M_dx;
394 double ty = M_21*v->
x + M_22*v->
y + M_dy;
417 Circle2D
transform(
const Circle2D & c )
const
419 return Circle2D(
transform( c.center() ),
430 Triangle2D
transform(
const Triangle2D & t )
const
443 std::ostream &
print( std::ostream & os )
const
498 return m.
print( os );
degree wrapper class Header File.
degree wrapper class
Definition angle_deg.h:45
double cos() const
calculate cosine
Definition angle_deg.h:301
double sin() const
calculate sine
Definition angle_deg.h:310
2D translation matrix class
Definition matrix_2d.h:51
Matrix2D & rotate(const AngleDeg &angle)
rotates the coordinate system
Definition matrix_2d.cpp:66
std::ostream & print(std::ostream &os) const
put all elemtns to the output stream
Definition matrix_2d.h:443
Matrix2D & translate(const double &dx, const double &dy)
moves the coordinate system.
Definition matrix_2d.h:263
const double & dx() const
get the horizontal translation factor.
Definition matrix_2d.h:215
double det() const
get the matrix's determinant.
Definition matrix_2d.h:234
bool invertible() const
check if this matrix is invertible (is not isingular).
Definition matrix_2d.h:243
Matrix2D inverted() const
get the inverted matrix.
Definition matrix_2d.cpp:45
static Matrix2D make_translation(const double &dx, const double &dy)
create the translation matrix.
Definition matrix_2d.h:132
const Matrix2D & operator*=(const Matrix2D &m)
multiplied by other matrix
Definition matrix_2d.h:347
const Matrix2D & assign(const double &m11, const double &m12, const double &m21, const double &m22, const double &dx, const double &dy)
set a matrix element with the specified values.
Definition matrix_2d.h:115
const double & m11() const
get the horizontal scaling factor.
Definition matrix_2d.h:175
void transform(Vector2D *v) const
transform input vector with this matrix
Definition matrix_2d.h:391
const double & m22() const
get the vertical scaling factor.
Definition matrix_2d.h:205
Matrix2D & scale(const double &sx, const double &sy)
scales the coordinate system.
Definition matrix_2d.h:294
Vector2D transform(const Vector2D &v) const
create transformed vector from input vector with this matrix
Definition matrix_2d.h:368
const double & dy() const
get the vertical translation factor.
Definition matrix_2d.h:225
Matrix2D()
create an identity matrix
Definition matrix_2d.h:66
const double & m21() const
get the horizontal shearing factor.
Definition matrix_2d.h:195
static Matrix2D make_scaling(const double &sx, const double &sy)
create the scaling matrix.
Definition matrix_2d.h:147
Matrix2D(const double &m11, const double &m12, const double &m21, const double &m22, const double &dx, const double &dy)
create a matrix with all elements.
Definition matrix_2d.h:84
static Matrix2D make_rotation(const AngleDeg &angle)
create the rotation matrix.
Definition matrix_2d.h:161
const Matrix2D & reset()
reset to the identity matrix
Definition matrix_2d.h:97
const double & m12() const
get the vertical shearing factor.
Definition matrix_2d.h:185
Vector2D transform(const double &x, const double &y) const
create transformed vector from input coordinates with this matrix
Definition matrix_2d.h:380
2d segment line class
Definition segment_2d.h:46
2D point vector class
Definition vector_2d.h:47
static Vector2D polar2vector(const double &mag, const AngleDeg &theta)
get new Vector created by POLAR value.
Definition vector_2d.h:560
double y
Y coordinate.
Definition vector_2d.h:65
double x
X coordinate.
Definition vector_2d.h:64
Vector2D & assign(const double &xx, const double &yy)
assign XY value directly.
Definition vector_2d.h:101
2d vector class Header File.
std::ostream & operator<<(std::ostream &os, const rcsc::Matrix2D &m)
output stream operator.
Definition matrix_2d.h:495
const rcsc::Matrix2D operator*(const rcsc::Matrix2D &lhs, const rcsc::Matrix2D &rhs)
multiplication operator of Matrix x Matrix.
Definition matrix_2d.h:467