5 #include "_cexports/c_core_3d.h" 10 #include "point_3d.hpp" 30 inline Matrix3D
operator+(
const Matrix3D & lhs,
const Matrix3D & rhs);
41 inline Matrix3D
operator-(
const Matrix3D & lhs,
const Matrix3D & rhs);
53 inline Matrix3D
operator*(
const Matrix3D & lhs,
const Matrix3D & rhs);
87 template<std::
size_t N>
90 static_assert(N == 9,
"CVB: Matrix3D must have 9 elements");
91 std::copy(std::begin(list), std::end(list), matrix_.data()->data());
104 Internal::DoResCall([&]()
106 auto thisData = reinterpret_cast<CExports::CVC3DMatrix*>(
this);
107 return CVB_CALL_CAPI(CVC3DRotationMatrixFromRollPitchYaw(roll, pitch, yaw, *thisData));
124 Internal::DoResCall([&]()
126 auto thisData = reinterpret_cast<const CExports::CVC3DMatrix*>(
this);
127 return CVB_CALL_CAPI(CVC3DRollPitchYawFromRotationMatrix(*thisData, roll, pitch, yaw));
140 return matrix_[row].data();
152 return matrix_[row].data();
162 const double&
At(
int row,
int column)
const noexcept
164 return (*
this)[row][column];
174 double&
At(
int row,
int column) noexcept
176 return (*
this)[row][column];
186 return Internal::DoResCallValueOut<double>([&](
double & value)
188 auto thisData = reinterpret_cast<const CExports::CVC3DMatrix*>(
this);
189 return CVB_CALL_CAPI(CVC3DMatrixDeterminant(*thisData, value));
202 Internal::DoResCall([&]()
204 auto data = reinterpret_cast<const CExports::CVC3DMatrix*>(
this);
205 auto dataInv = reinterpret_cast<CExports::CVC3DMatrix*>(
this);
206 return CVB_CALL_CAPI(CVC3DInvertMatrix(*data, *dataInv));
218 return matrix_ == matrix.matrix_;
229 return !(*
this == matrix);
240 *
this = *
this + matrix;
252 *
this = *
this - matrix;
264 *
this = *
this * matrix;
276 for (
auto & line : matrix_)
277 for (
auto & element : line)
290 for(
auto & line : matrix_)
291 for(
auto & element : line)
311 lhs[0][0] + rhs[0][0], lhs[0][1] + rhs[0][1], lhs[0][2] + rhs[0][2],
312 lhs[1][0] + rhs[1][0], lhs[1][1] + rhs[1][1], lhs[1][2] + rhs[1][2],
313 lhs[2][0] + rhs[2][0], lhs[2][1] + rhs[2][1], lhs[2][2] + rhs[2][2],
322 lhs[0][0] - rhs[0][0], lhs[0][1] - rhs[0][1], lhs[0][2] - rhs[0][2],
323 lhs[1][0] - rhs[1][0], lhs[1][1] - rhs[1][1], lhs[1][2] - rhs[1][2],
324 lhs[2][0] - rhs[2][0], lhs[2][1] - rhs[2][1], lhs[2][2] - rhs[2][2],
332 return Internal::DoResCallValueOut<Matrix3D>([&](
Matrix3D & value)
334 auto valueData = reinterpret_cast<CExports::CVC3DMatrix*>(&value);
335 auto lhsData = reinterpret_cast<const CExports::CVC3DMatrix*>(&lhs);
336 auto rhsData = reinterpret_cast<const CExports::CVC3DMatrix*>(&rhs);
337 return CVB_CALL_CAPI(CVC3DMultiplyMatrices(*lhsData,
357 lhs[0][0] * rhs[0] + lhs[0][1] * rhs[1] + lhs[0][2] * rhs[2],
358 lhs[1][0] * rhs[0] + lhs[1][1] * rhs[1] + lhs[1][2] * rhs[2],
359 lhs[2][0] * rhs[0] + lhs[2][1] * rhs[1] + lhs[2][2] * rhs[2],
376 lhs[0][0] * rhs, lhs[0][1] * rhs, lhs[0][2] * rhs,
377 lhs[1][0] * rhs, lhs[1][1] * rhs, lhs[1][2] * rhs,
378 lhs[2][0] * rhs, lhs[2][1] * rhs, lhs[2][2] * rhs
409 lhs[0][0] / rhs, lhs[0][1] / rhs, lhs[0][2] / rhs,
410 lhs[1][0] / rhs, lhs[1][1] / rhs, lhs[1][2] / rhs,
411 lhs[2][0] / rhs, lhs[2][1] / rhs, lhs[2][2] / rhs
Matrix3D & operator+=(const Matrix3D &matrix) noexcept
Adds and assigns to this matrix.
Definition: matrix_3d.hpp:238
AffineMatrix2D operator+(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Add two affine matrices.
Definition: affine_matrix_2d.hpp:217
void RollPitchYaw(double &roll, double &pitch, double &yaw) const
Computes the Euler angles Roll, Pitch and Yaw for this matrix.
Definition: matrix_3d.hpp:122
bool operator!=(const Matrix3D &matrix) const noexcept
Compares to an other matrix.
Definition: matrix_3d.hpp:227
static Matrix3D Identity() noexcept
The identity element.
Definition: matrix_3d.hpp:67
Matrix3D & operator *=(const double &value) noexcept
Multiplies and assigns to this matrix.
Definition: matrix_3d.hpp:274
AffineMatrix2D operator/(const AffineMatrix2D &lhs, const double &rhs)
Divide affine matrix by scalar.
Definition: affine_matrix_2d.hpp:301
double & At(int row, int column) noexcept
Index based element access.
Definition: matrix_3d.hpp:174
bool operator==(const Matrix3D &matrix) const noexcept
Compares to an other matrix.
Definition: matrix_3d.hpp:216
Double precision 3x3 matrix class.
Definition: matrix_3d.hpp:58
Root namespace for the Image Manager interface.
Definition: version.hpp:11
Matrix3D() noexcept=default
Default constructor for empty matrix.
Matrix3D(double roll, double pitch, double yaw)
Creates a rotation matrix from the given Euler angles.
Definition: matrix_3d.hpp:102
double * operator[](int row) noexcept
Index based element access.
Definition: matrix_3d.hpp:150
AffineMatrix2D operator *(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Multiply two affine matrices.
Definition: affine_matrix_2d.hpp:245
Matrix3D & operator/=(const double &value) noexcept
Divides each element of this matrix by the given value.
Definition: matrix_3d.hpp:288
double Det() const
Matrix determinant.
Definition: matrix_3d.hpp:184
const double & At(int row, int column) const noexcept
Index based element access.
Definition: matrix_3d.hpp:162
Matrix3D & operator *=(const Matrix3D &matrix)
Multiplies and assigns to this matrix.
Definition: matrix_3d.hpp:262
Matrix3D & operator -=(const Matrix3D &matrix) noexcept
Subtracts and assigns to this matrix.
Definition: matrix_3d.hpp:250
const double * operator[](int row) const noexcept
Index based element access.
Definition: matrix_3d.hpp:138
AffineMatrix2D operator-(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Subtract two affine matrices.
Definition: affine_matrix_2d.hpp:231
void Invert()
Inverts this matrix if possible.
Definition: matrix_3d.hpp:200