Name | Description |
---|---|
VectorMath.InnerProduct | Calculate the inner product of two vectors. |
VectorMath.CrossProduct | Calculate the cross product of two vectors. |
FrameMath.InvertFrame | Calculate the inverse of a frame. |
FrameMath.RotateFrame | Rotate a frame about an axis by a specified angle. |
FrameMath.FrameToZYXeuler | Convert a frame to ZYX Euler angles. |
FrameMath.MultiplyFrames | Multiply two frames together. |
FrameMath.ZYXeulerToFrame | Convert ZYX Euler angles to a frame. |
FrameMath.SetIdentityMatrixInFrame | Set the identity matrix in a frame. |
Calculate the inner product of two vectors.
void InnerProduct(XyzVector vector1, XyzVector vector2, out double product);
vector1
[IN] multiplicand. See XyzVector
vector2
[IN] multiplier. See XyzVector
product
[OUT] result of the inner product.
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
XyzVector vec1 = new XyzVector(1.0, 2.0, 3.0);
XyzVector vec2 = new XyzVector(1.0, 2.0, 3.0);
math.Vector.InnerProduct(vec1, vec2, out double result);
Console.WriteLine(result);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
14
Calculate the cross product of two vectors.
void CrossProduct(XyzVector vector1, XyzVector vector2, out XyzVector product);
vector1
[IN] multiplicand. See XyzVector
vector2
[IN] multiplier. See XyzVector
product
[OUT] result of the cross product. See XyzVector
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
XyzVector vec1 = new XyzVector(1.0, 2.0, 3.0);
XyzVector vec2 = new XyzVector(55.0, 2.0, 3.0);
math.Vector.CrossProduct(vec1, vec2, out XyzVector crossProduct);
Console.WriteLine(crossProduct);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
X: 0
Y: 162
Z: -108
Calculate the inverse of a frame.
void InvertFrame(EulerMatrix frame, out EulerMatrix inverseFrame);
frame
[IN] The frame to invert. See EulerMatrix
inverseFrame
[OUT] The inverse of the frame. See EulerMatrix
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
EulerMatrix eulerMatrix = new EulerMatrix(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
math.Frame.InvertFrame(eulerMatrix, out EulerMatrix invertedFrame);
Console.WriteLine(invertedFrame);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Nx: 1
Ny: 0
Nz: 0
Ox: 0
Oy: 1
Oz: 0
Ax: 0
Ay: 0
Az: 1
Px: -0
Py: -0
Pz: -0
Rotate a frame about an axis by a specified angle.
void RotateFrame(EulerMatrix org_frame, XyzVector rotationVector, double angle, out EulerMatrix rotatedFrame);
org_frame
[IN] Origin frame. See EulerMatrix
rotationVector
[IN] The vector to rotate about. See XyzVector
angle
[IN] The angle to rotate by.
rotatedFrame
[OUT] The rotated frame. See EulerMatrix
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
EulerMatrix eulerMatrix = new EulerMatrix(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
XyzVector rotationVector = new XyzVector(1, 2, 3);
math.Frame.RotateFrame(eulerMatrix, rotationVector, 90, out EulerMatrix rotatedFrame);
Console.WriteLine(rotatedFrame);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Nx: 1
Ny: 5
Nz: 0.9999999999999996
Ox: -1.0000000000000002
Oy: 3.9999999999999996
Oz: 6.999999999999999
Ax: 5
Ay: 4.999999999999999
Az: 8.999999999999998
Px: 0
Py: 0
Pz: 0
Convert a frame to ZYX Euler angles.
void FrameToZYXeuler(EulerMatrix frame, out CoordinateArray coord);
frame
[IN] The frame to convert. See EulerMatrix
coord
[OUT] Converted angles.
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
EulerMatrix eulerMatrix = new EulerMatrix(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
math.Frame.FrameToZYXeuler(eulerMatrix, out double[] eulerFrame);
foreach (double euler in eulerFrame)
{
Console.WriteLine(euler);
}
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
0
0
0
0
-0
0
0
0
Multiply two frames together.
void MultiplyFrames(EulerMatrix f1, EulerMatrix f2, out EulerMatrix productFrame);
f1
[IN] multiplicand. See EulerMatrix
f2
[IN] multiplier. See EulerMatrix
productFrame
[OUT] result of the multiplication.
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
EulerMatrix eulerMatrix = new EulerMatrix(50, 61, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
EulerMatrix eulerMatrix1 = new EulerMatrix(1, 20, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
math.Frame.MultiplyFrames(eulerMatrix, eulerMatrix1, out EulerMatrix result);
Console.WriteLine(result);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Nx: 50
Ny: 81
Nz: 0
Ox: 0
Oy: 1
Oz: 0
Ax: 0
Ay: 0
Az: 1
Px: 0
Py: 0
Pz: 0
Convert ZYX Euler angles to a frame.
void ZYXeulerToFrame(CoordinateArray coord, out EulerMatrix frame);
coord
[IN] The angles to convert.
frame
[OUT] Converted frame. See EulerMatrix
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
double[] coord = new double[] { 0,0,20,0,0,0 };
math.Frame.ZYXeulerToFrame(coord, out EulerMatrix frame);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
nx: 1, ox: 0, ax: 0, px: 0
ny: 0, oy: 1, ay: 0, py: 0
nz: -0, oz: 0, az: 1, pz: 20
Set the identity matrix in a frame.
void SetIdentityMatrixInFrame(out EulerMatrix frame);
frame
[OUT] The frame to set the identity matrix in. See EulerMatrix
None
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
MathFunctions math = MathFunctions.Init();
math.Frame.SetIdentityMatrixInFrame(out EulerMatrix eulerMatrix);
Console.WriteLine(eulerMatrix);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
nx: 1, ox: 0, ax: 0, px: 0
ny: 0, oy: 1, ay: 0, py: 0
nz: 0, oz: 0, az: 1, pz: 0