3#include "_cexports/c_core_3d.h"
63 return {{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}};
77 template <std::
size_t N>
80 static_assert(N == 9,
"CVB: Matrix3D must have 9 elements");
98 Matrix3D(
double alpha,
double beta,
double gamma)
100 Internal::DoResCall([&]() {
101 auto thisData =
reinterpret_cast<CExports::CVC3DMatrix *
>(
this);
102 return CVB_CALL_CAPI(CVC3DRotationMatrixFromRotationAngles(alpha, beta, gamma, *thisData));
98 Matrix3D(
double alpha,
double beta,
double gamma) {
…}
124 Internal::DoResCall([&]() {
125 auto thisData =
reinterpret_cast<CExports::CVC3DMatrix *
>(
this);
126 return CVB_CALL_CAPI(CVC3DMatrixFromRotationAnglesScale(
127 alpha, beta, gamma, *
reinterpret_cast<CExports::CVC3DFactors *
>(&scale), *thisData));
153 auto thisData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(
this);
154 return CVB_CALL_CAPI(CVC3DRotationAnglesFromRotationMatrix(*thisData, alpha, beta, gamma))
155 == Cvb::CExports::CVC_ERROR_CODES::CVC_E_OK;
201 Internal::DoResCall([&]() {
203 auto thisData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(
this);
204 auto errcode = CVB_CALL_CAPI(CVC3DRotationAnglesScaleFromMatrix(
205 *thisData, alpha, beta, gamma, *
reinterpret_cast<CExports::CVC3DFactors *
>(&scale)));
209 return CVB_CALL_CAPI(CVC3DRotationAnglesScaleFromMatrixApproximation(
210 *thisData, alpha, beta, gamma, *
reinterpret_cast<CExports::CVC3DFactors *
>(&scale), precision));
236 Internal::DoResCall([&]() {
237 auto thisData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(
this);
238 return CVB_CALL_CAPI(CVC3DRollPitchYawFromRotationMatrix(*thisData, roll, pitch, yaw));
250 return matrix_[row].data();
261 return matrix_[row].data();
271 const double &
At(
int row,
int column)
const noexcept
273 return (*
this)[row][column];
271 const double &
At(
int row,
int column)
const noexcept {
…}
283 double &
At(
int row,
int column)
noexcept
285 return (*
this)[row][column];
283 double &
At(
int row,
int column)
noexcept {
…}
295 return Internal::DoResCallValueOut<double>([&](
double &value) {
296 auto thisData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(
this);
297 return CVB_CALL_CAPI(CVC3DMatrixDeterminant(*thisData, value));
309 Internal::DoResCall([&]() {
310 auto data =
reinterpret_cast<const CExports::CVC3DMatrix *
>(
this);
311 auto dataInv =
reinterpret_cast<CExports::CVC3DMatrix *
>(
this);
312 return CVB_CALL_CAPI(CVC3DInvertMatrix(*data, *dataInv));
338 return matrix_ == matrix.matrix_;
349 return !(*
this == matrix);
360 *
this = *
this + matrix;
372 *
this = *
this - matrix;
384 *
this = *
this * matrix;
396 for (
auto &line : matrix_)
397 for (
auto &element : line)
410 for (
auto &line : matrix_)
411 for (
auto &element : line)
423 lhs[0][0] + rhs[0][0],
424 lhs[0][1] + rhs[0][1],
425 lhs[0][2] + rhs[0][2],
426 lhs[1][0] + rhs[1][0],
427 lhs[1][1] + rhs[1][1],
428 lhs[1][2] + rhs[1][2],
429 lhs[2][0] + rhs[2][0],
430 lhs[2][1] + rhs[2][1],
431 lhs[2][2] + rhs[2][2],
438 lhs[0][0] - rhs[0][0],
439 lhs[0][1] - rhs[0][1],
440 lhs[0][2] - rhs[0][2],
441 lhs[1][0] - rhs[1][0],
442 lhs[1][1] - rhs[1][1],
443 lhs[1][2] - rhs[1][2],
444 lhs[2][0] - rhs[2][0],
445 lhs[2][1] - rhs[2][1],
446 lhs[2][2] - rhs[2][2],
453 return Internal::DoResCallValueOut<Matrix3D>([&](
Matrix3D &value) {
454 auto valueData =
reinterpret_cast<CExports::CVC3DMatrix *
>(&value);
455 auto lhsData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(&lhs);
456 auto rhsData =
reinterpret_cast<const CExports::CVC3DMatrix *
>(&rhs);
457 return CVB_CALL_CAPI(CVC3DMultiplyMatrices(*lhsData, *rhsData, *valueData));
473 lhs[0][0] * rhs[0] + lhs[0][1] * rhs[1] + lhs[0][2] * rhs[2],
474 lhs[1][0] * rhs[0] + lhs[1][1] * rhs[1] + lhs[1][2] * rhs[2],
475 lhs[2][0] * rhs[0] + lhs[2][1] * rhs[1] + lhs[2][2] * rhs[2],
490 return {{lhs[0][0] * rhs, lhs[0][1] * rhs, lhs[0][2] * rhs, lhs[1][0] * rhs, lhs[1][1] * rhs, lhs[1][2] * rhs,
491 lhs[2][0] * rhs, lhs[2][1] * rhs, lhs[2][2] * rhs}};
519 return {{lhs[0][0] / rhs, lhs[0][1] / rhs, lhs[0][2] / rhs, lhs[1][0] / rhs, lhs[1][1] / rhs, lhs[1][2] / rhs,
520 lhs[2][0] / rhs, lhs[2][1] / rhs, lhs[2][2] / rhs}};
Double precision 3x3 matrix class.
Definition matrix_3d.hpp:54
const double & At(int row, int column) const noexcept
Index based element access.
Definition matrix_3d.hpp:271
Matrix3D(double alpha, double beta, double gamma, Factors3D scale)
Creates a transformation matrix from the given Euler angles and scaling.
Definition matrix_3d.hpp:122
bool operator!=(const Matrix3D &matrix) const noexcept
Compares to an other matrix.
Definition matrix_3d.hpp:347
void RotationAnglesScale(double &alpha, double &beta, double &gamma, Factors3D &scale, double &precision) const
Computes the Euler angles and scaling from the matrix.
Definition matrix_3d.hpp:199
Matrix3D & operator*=(const Matrix3D &matrix)
Multiplies and assigns to this matrix.
Definition matrix_3d.hpp:382
const double * operator[](int row) const noexcept
Index based element access.
Definition matrix_3d.hpp:248
Matrix3D Inverse()
Gets the inverse of this matrix if possible.
Definition matrix_3d.hpp:323
bool operator==(const Matrix3D &matrix) const noexcept
Compares to an other matrix.
Definition matrix_3d.hpp:336
bool TryGetRotationAngles(double &alpha, double &beta, double &gamma) const noexcept
Tries to compute the Euler angles from the matrix.
Definition matrix_3d.hpp:151
double * operator[](int row) noexcept
Index based element access.
Definition matrix_3d.hpp:259
void RollPitchYaw(double &roll, double &pitch, double &yaw) const
Computes the Euler angles Roll, Pitch and Yaw for this matrix.
Definition matrix_3d.hpp:234
Matrix3D operator*(const double &lhs, const Matrix3D &rhs)
Multiply scalar with matrix .
Definition matrix_3d.hpp:503
Matrix3D() noexcept=default
Default constructor for empty matrix.
Matrix3D & operator/=(const double &value) noexcept
Divides each element of this matrix by the given value.
Definition matrix_3d.hpp:408
double Det() const
Matrix determinant.
Definition matrix_3d.hpp:293
Matrix3D & operator-=(const Matrix3D &matrix) noexcept
Subtracts and assigns to this matrix.
Definition matrix_3d.hpp:370
Matrix3D(double alpha, double beta, double gamma)
Creates a rotation matrix from the given Euler angles.
Definition matrix_3d.hpp:98
Matrix3D operator/(const Matrix3D &lhs, const double &rhs)
Divide matrix by scalar.
Definition matrix_3d.hpp:517
Point3D< double > operator*(const Matrix3D &lhs, const Point3D< double > &rhs)
Multiply matrix with 3D point.
Definition matrix_3d.hpp:470
void Invert()
Inverts this matrix in-place if possible.
Definition matrix_3d.hpp:307
Matrix3D & operator+=(const Matrix3D &matrix) noexcept
Adds and assigns to this matrix.
Definition matrix_3d.hpp:358
static Matrix3D Identity() noexcept
The identity element.
Definition matrix_3d.hpp:61
Matrix3D & operator*=(const double &value) noexcept
Multiplies and assigns to this matrix.
Definition matrix_3d.hpp:394
double & At(int row, int column) noexcept
Index based element access.
Definition matrix_3d.hpp:283
Matrix3D operator*(const Matrix3D &lhs, const double &rhs)
Multiply matrix with scalar.
Definition matrix_3d.hpp:488
Multi-purpose 3D vector class.
Definition point_3d.hpp:22
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
AffineMatrix2D operator+(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Add two affine matrices.
Definition affine_matrix_2d.hpp:223
AffineMatrix2D operator*(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Multiply two affine matrices.
Definition affine_matrix_2d.hpp:251
AffineMatrix2D operator-(const AffineMatrix2D &lhs, const AffineMatrix2D &rhs) noexcept
Subtract two affine matrices.
Definition affine_matrix_2d.hpp:237
Factor components to be applied in the 3D domain.
Definition core_3d.hpp:16