Other
RotationFromPoint
Calculates a rotation matrix from 3 points. This function only sets the rotation matrix of the transformation matrix passed in and will not modify any offsets.
The X axis is oriented along the vector from point A to point B. The Z axis is the vector normal to the plane created from the 3 points. The Y axis is the normalized result of Z crossed with X.
Parameters
Direction | Name | Type | Description |
---|---|---|---|
In | A | double* | Pointer to a point [x, y, z] |
In | B | double* | Pointer to a point [x, y, z] |
In | C | double* | Pointer to a point [x, y, z] |
Out | Out | double* | Pointer to the calculated matrix [4x4] |
Return | BOOL | Always 0 |
Usage
plcbit RotationFromPoints(double* A, double* B, double* C, double* Out);
CentroidFromPoints
Calculate the centroid of a given number of points. All points are [1x4].
Parameters
Direction | Name | Type | Description |
---|---|---|---|
In | Points | double* | Pointer to a series of points [x1, y1, z1, 1, x2, y2, z2, 1, …] |
In | NumberPoints | USINT | The number of points |
Out | Out | double* | Pointer to calculated centroid [1x3] |
Return | BOOL | Always 0 |
Usage
plcbit CentroidFromPoints(double* Points, unsigned short NumberPoints, double* Out);
TransformationFromPoints
Uses RotationFromPoints() to calculate the rotation matrix from the series of points and assigns the cartesian offset to the value of the first point passed in.
Parameters
Direction | Name | Type | Description |
---|---|---|---|
In | Points | double* | Pointer to a series of points [x1, y1, z1, 1, x2, y2, z2, 1, …] |
In | NumberPoints | USINT | The number of points |
Out | Out | double* | Pointer to calculated matrix [4x4] |
Return | BOOL | Always 0 |
Usage
plcbit TransformationFromPoints(double* Points, unsigned short NumberPoints, double* Out);
PlaneNormal
Calculates the vector normal to a plane formed by three points. The vector is calculated by crossing the vector from point A to B by the vector from point A to point C.
Parameters
Direction | Name | Type | Description |
---|---|---|---|
In | A | double* | Pointer to a point [x, y, z] |
In | B | double* | Pointer to a point [x, y, z] |
In | C | double* | Pointer to a point [x, y, z] |
Out | Out | double* | Pointer to the calculated vector [1x3] |
Return | BOOL | Always 0 |
Usage
plcbit PlaneNormal(double* A, double* B, double* C, double* Out);