6#include <QtGui/QMatrix4x4>
10#include "legacymatrix2d.h"
15#define M_PI 3.14159265358979323846264338327950288
28#define RDK_SIZE_JOINTS_MAX 12
32#define RDK_SIZE_MAX_CONFIG 4
40typedef double tXYZWPR[6];
43typedef double tXYZ[3];
60typedef double tConfig[RDK_SIZE_MAX_CONFIG];
65#define DOT(v,q) ((v)[0]*(q)[0] + (v)[1]*(q)[1] + (v)[2]*(q)[2])
68#define NORM(v) (sqrt((v)[0]*(v)[0] + (v)[1]*(v)[1] + (v)[2]*(v)[2]))
71#define NORMALIZE(inout){\
73 norm = sqrt((inout)[0]*(inout)[0] + (inout)[1]*(inout)[1] + (inout)[2]*(inout)[2]);\
74 (inout)[0] = (inout)[0]/norm;\
75 (inout)[1] = (inout)[1]/norm;\
76 (inout)[2] = (inout)[2]/norm;}
79#define CROSS(out,a,b) \
80 (out)[0] = (a)[1]*(b)[2] - (b)[1]*(a)[2]; \
81 (out)[1] = (a)[2]*(b)[0] - (b)[2]*(a)[0]; \
82 (out)[2] = (a)[0]*(b)[1] - (b)[0]*(a)[1];
91#define MULT_MAT(out,inA,inB)\
92 (out)[0] = (inA)[0]*(inB)[0] + (inA)[4]*(inB)[1] + (inA)[8]*(inB)[2];\
93 (out)[1] = (inA)[1]*(inB)[0] + (inA)[5]*(inB)[1] + (inA)[9]*(inB)[2];\
94 (out)[2] = (inA)[2]*(inB)[0] + (inA)[6]*(inB)[1] + (inA)[10]*(inB)[2];\
96 (out)[4] = (inA)[0]*(inB)[4] + (inA)[4]*(inB)[5] + (inA)[8]*(inB)[6];\
97 (out)[5] = (inA)[1]*(inB)[4] + (inA)[5]*(inB)[5] + (inA)[9]*(inB)[6];\
98 (out)[6] = (inA)[2]*(inB)[4] + (inA)[6]*(inB)[5] + (inA)[10]*(inB)[6];\
100 (out)[8] = (inA)[0]*(inB)[8] + (inA)[4]*(inB)[9] + (inA)[8]*(inB)[10];\
101 (out)[9] = (inA)[1]*(inB)[8] + (inA)[5]*(inB)[9] + (inA)[9]*(inB)[10];\
102 (out)[10] = (inA)[2]*(inB)[8] + (inA)[6]*(inB)[9] + (inA)[10]*(inB)[10];\
104 (out)[12] = (inA)[0]*(inB)[12] + (inA)[4]*(inB)[13] + (inA)[8]*(inB)[14] + (inA)[12];\
105 (out)[13] = (inA)[1]*(inB)[12] + (inA)[5]*(inB)[13] + (inA)[9]*(inB)[14] + (inA)[13];\
106 (out)[14] = (inA)[2]*(inB)[12] + (inA)[6]*(inB)[13] + (inA)[10]*(inB)[14] + (inA)[14];\
110#define MULT_MAT_VECTOR(out,H,p)\
111 (out)[0] = (H)[0]*(p)[0] + (H)[4]*(p)[1] + (H)[8]*(p)[2];\
112 (out)[1] = (H)[1]*(p)[0] + (H)[5]*(p)[1] + (H)[9]*(p)[2];\
113 (out)[2] = (H)[2]*(p)[0] + (H)[6]*(p)[1] + (H)[10]*(p)[2];
116#define MULT_MAT_POINT(out,H,p)\
117 (out)[0] = (H)[0]*(p)[0] + (H)[4]*(p)[1] + (H)[8]*(p)[2] + (H)[12];\
118 (out)[1] = (H)[1]*(p)[0] + (H)[5]*(p)[1] + (H)[9]*(p)[2] + (H)[13];\
119 (out)[2] = (H)[2]*(p)[0] + (H)[6]*(p)[1] + (H)[10]*(p)[2] + (H)[14];
151 return robodk::legacy::Matrix2D_Create();
161inline void Matrix2D_Delete(
tMatrix2D** matrix)
163 robodk::legacy::Matrix2D_Delete(matrix);
175inline void Matrix2D_Set_Size(
tMatrix2D* matrix,
int rows,
int columns)
177 robodk::legacy::Matrix2D_SetDimensions(matrix, rows, columns);
191inline int Matrix2D_Size(
const tMatrix2D* matrix,
int dimension)
193 return robodk::legacy::Matrix2D_GetDimension(matrix, dimension);
201inline int Matrix2D_Get_ncols(
const tMatrix2D* matrix)
203 return robodk::legacy::Matrix2D_ColumnCount(matrix);
211inline int Matrix2D_Get_nrows(
const tMatrix2D* matrix)
213 return robodk::legacy::Matrix2D_RowCount(matrix);
219inline double Matrix2D_Get_ij(
const tMatrix2D* matrix,
int row,
int column)
221 return robodk::legacy::Matrix2D_Get(matrix, row, column);
227inline void Matrix2D_Set_ij(
const tMatrix2D* matrix,
int row,
int column,
double value)
229 robodk::legacy::Matrix2D_Set(matrix, row, column, value);
235inline double* Matrix2D_Get_col(
const tMatrix2D* matrix,
int column)
237 return robodk::legacy::Matrix2D_GetColumn(matrix, column);
249 return robodk::legacy::Matrix2D_Copy(source, destination);
255inline void Debug_Array(
const double* array,
int size)
257 robodk::legacy::Matrix2D_DebugArray(array, size);
263inline void Debug_Matrix2D(
const tMatrix2D* matrix)
265 robodk::legacy::Matrix2D_Debug(matrix);
273inline void Matrix2D_Save(QTextStream* stream,
tMatrix2D* matrix,
bool csv =
false)
275 robodk::legacy::Matrix2D_Save(stream, matrix, csv);
281inline void Matrix2D_Save(QDataStream* stream,
tMatrix2D* matrix)
283 robodk::legacy::Matrix2D_Save(stream, matrix);
289inline void Matrix2D_Load(QDataStream* stream,
tMatrix2D** matrix)
291 robodk::legacy::Matrix2D_Load(stream, matrix);
298inline Mat transl(
double x,
double y,
double z)
303inline Mat rotx(
double rx)
308inline Mat roty(
double ry)
313inline Mat rotz(
double rz)
319inline QDebug operator<<(QDebug dbg,
const Mat &m)
321 return dbg.noquote() << m.ToString();
324inline QDebug operator<<(QDebug dbg,
const tJoints &jnts)
326 return dbg.noquote() << jnts.ToString();
329inline QDebug operator<<(QDebug dbg,
const Mat *m)
331 return dbg.noquote() << (m ==
nullptr ?
"Mat(null)" : m->ToString());
334inline QDebug operator<<(QDebug dbg,
const tJoints *jnts)
336 return dbg.noquote() << (jnts ==
nullptr ?
"tJoints(null)" : jnts->ToString());
The Item class represents an item in RoboDK station. An item can be a robot, a frame,...
This class is the iterface to the RoboDK API. With the RoboDK API you can automate certain tasks and ...
The Joints class represents a joint position of a robot (robot axes).
The Matrix4x4 class represents a 4x4 transformation matrix in 3D space.
static Matrix4x4 transl(double x, double y, double z)
Constructs a matrix that translates coordinates by the components x, y, and z.
static Matrix4x4 rotx(double rx)
Constructs a matrix that rotates coordinates around X axis.
static Matrix4x4 rotz(double rz)
Constructs a matrix that rotates coordinates around Z axis.
static Matrix4x4 roty(double ry)
Constructs a matrix that rotates coordinates around Y axis.
The Matrix2D struct represents a variable size 2D matrix.
The Color struct represents an RGBA color (each color component should be in the range [0-1])
float a
Alpha value (0 = transparent; 1 = opaque)