30#ifndef ROBODK_MATRIX4X4_H
31#define ROBODK_MATRIX4X4_H
34#include "deprecated.h"
44typedef ::QMatrix4x4 BaseMatrix4x4;
47#error "This class cannot yet be used without the Qt Framework"
188 void SetVX(
double x,
double y,
double z);
193 void SetVY(
double x,
double y,
double z);
198 void SetVZ(
double x,
double y,
double z);
203 void SetPos(
double x,
double y,
double z);
208 void SetVX(
const double* xyz);
213 void SetVY(
const double* xyz);
218 void SetVZ(
const double* xyz);
223 void SetPos(
const double* xyz);
263 void VX(
double* xyz)
const;
268 void VY(
double* xyz)
const;
273 void VZ(
double* xyz)
const;
278 void Pos(
double* xyz)
const;
283 void Set(
int row,
int column,
double value);
288 double Get(
int row,
int column)
const;
316 void ToXYZRPW(
double* xyzwpr)
const;
369#ifdef ROBODK_API_FLOATS
377 const float*
Values()
const;
386 const double*
Values()
const;
394 void Values(
double* values)
const;
401 void Values(
float* values)
const;
479 inline operator QString()
const {
return ToString(); }
482 bool FromString(
const QString& str);
494 const ::QString& separator = QLatin1String(
", "),
496 bool xyzrpwOnly =
false)
const;
506 ROBODK_DEPRECATED(
"Use Inverted() instead")
509 ROBODK_DEPRECATED(
"Use SetPos() instead")
510 inline void setPos(
double x,
double y,
double z) {
SetPos(x, y, z); }
518 mutable double _md[16];
The Matrix4x4 class represents a 4x4 transformation matrix in 3D space.
Vector3 VX() const
Returns the X vector (N vector).
void SetVZ(const Vector3 &a)
Sets the Z vector (A vector).
void SetVY(const Vector3 &o)
Sets the Y vector (O vector).
static Matrix4x4 transl(double x, double y, double z)
Constructs a matrix that translates coordinates by the components x, y, and z.
void ToXYZRPW(double *xyzwpr) const
Calculates the position and euler angles ([x,y,z,r,p,w] vector) from this matrix.
void Pos(double *xyz) const
Writes the position (T vector) into array of 3 double-precision xyz values.
Vector3 VY() const
Returns the Y vector (O vector).
static Matrix4x4 rotx(double rx)
Constructs a matrix that rotates coordinates around X axis.
bool Valid() const
Returns true if the matrix is marked as valid; false otherwise.
void FromXYZRPW(const double *xyzwpr)
Calculates this matrix from the position and euler angles ([x,y,z,r,p,w] vector).
static Matrix4x4 rotz(double rz)
Constructs a matrix that rotates coordinates around Z axis.
const double * Values() const
Returns a constant pointer to the raw data of this matrix as 16 double- or single-precision numbers.
Matrix4x4()
Constructs an identity matrix.
Matrix4x4 & operator=(const Matrix4x4 &matrix)
Sets this Matrix4x4 object as a copy of matrix.
void SetValues(const double *values)
Sets the elements of matrix from the given 16 double-precision values.
void SetVX(const Vector3 &n)
Sets the X vector (N vector).
void SetPos(double x, double y, double z)
Sets the position (T).
bool MakeHomogeneous()
Forces this matrix to be homogeneous.
static Matrix4x4 roty(double ry)
Constructs a matrix that rotates coordinates around Y axis.
const double * ValuesD() const
Returns a constant pointer to the raw data of this matrix as 16 double-precision numbers.
Matrix4x4 Inverted(bool *invertible=nullptr) const
Returns the inverse of this matrix.
void Set(int row, int column, double value)
Sets a new value to the element at position (row, column) in this matrix.
static Matrix4x4 XYZRPW_2_Mat(double x, double y, double z, double r, double p, double w)
Constructs a matrix from the position and euler angles ([x,y,z,r,p,w] vector).
Vector3 VZ() const
Returns the Z vector (A vector).
const float * ValuesF() const
Returns a constant pointer to the raw data of this matrix as 16 single-precision numbers.
double Get(int row, int column) const
Returns the value of the element at position (row, column) in this matrix.
bool IsHomogeneous() const
Returns true if the matrix is homogeneous; false otherwise.
The Vector3 class represents a vector or vertex in 3D space.