38 return x == other.
x &&
y == other.
y;
61 : data{ scale, 0._f, translation.x, 0._f, scale, translation.y } {}
68 const Float tx = 0._f,
69 const Float ty = 0._f)
70 : data{ xx, yx, tx, xy, yy, ty } {}
75 return data[3 * i + j];
81 return data[3 * i + j];
115 const Float det = a * d - b * c;
116 const Float detInv = 1._f / det;
123 -(d * tx - b * ty) * detInv,
124 (c * tx - a * ty) * detInv);
133 return AffineMatrix2(data[0], data[3], data[1], data[4], -data[2], -data[5]);
144 for (
Size i = 0; i < 6; ++i) {
145 if (data[i] != other.data[i]) {
#define SPH_ASSERT(x,...)
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Additional math routines (with more includes).
#define NAMESPACE_SPH_END
Class defining additional operators from existing ones.
Float get(const Size i, const Size j) const
Returns the given component of the matrix.
PlotPoint transformPoint(const PlotPoint &p) const
Applies the affine transform on given point.
AffineMatrix2(const Float scale=1._f, const PlotPoint translation=PlotPoint(0._f, 0._f))
Creates the matrix given a uniform scaling factor and a translation vector.
static AffineMatrix2 rotate(const Float phi)
Create a rotation matrix.
bool operator==(const AffineMatrix2 &other) const
Float operator()(const Size i, const Size j) const
Returns the given component of the matrix.
AffineMatrix2(const Float xx, const Float yx, const Float xy, const Float yy, const Float tx=0._f, const Float ty=0._f)
Creates the matrix from individual components.
PlotPoint transformVector(const PlotPoint &p) const
Applies the transform on given vector.
Float & operator()(const Size i, const Size j)
Returns the given component of the matrix.
AffineMatrix2 transpose() const
Returns the transposed matrix.
AffineMatrix2 inverse() const
Returns the inverse of the matrix.
Class defining additional operators from existing ones.
PlotPoint & operator+=(const PlotPoint &other)
PlotPoint(const Float x, const Float y)
PlotPoint & operator*=(const Float value)
bool operator==(const PlotPoint &other) const