3.2.3 Vector Algebra FunctionsModeler3D vector algebra functions perform many common vector algebra operations, such as cross and dot products of vectors. These functions can be used to build more complicated functions that are not provided by Modeler3D. These functions take point, vector, and axis objects as arguments, just like the output functions described in Section 3.2.2. When local point numbers are used, the local coordinates are taken from the current body objects, as specified with SetBodies. Each of the vector algebra functions is demonstrated in the context of the slider-crank mechanism model defined at the beginning of this section. Vector algebra functions. The Direction function is used to convert Modeler3D vector objects into 3D vectors in global coordinates. Here is the direction vector of the connecting rod.
Out[31]= | |
Now get a numerical result.
Out[32]= | |
Several Modeler3D output functions are textbook vector algebra functions that are capable of dealing with normal 3D vectors or Modeler3D vector/axis objects interchangeably. Magnitude can return the length of the line from one end of the connecting rod to the other.
Out[33]= | |
Here is the length of a simple 3D vector.
Out[34]= | |
Unit also works with vectors or vector objects.
Out[35]= | |
The cross product of two vectors is found with the Cross function. Here is the cross product of a Modeler3D Line object and a vector.
Out[36]= | |
Now get a numerical result.
Out[37]= | |
Here is the 3D rotation matrix associated with the crank.
Out[38]= | |
Here is the skew symmetric matrix operator.
Out[39]= | |
The global coordinates of a point specified in a local reference frame are equal to the coordinates of the origin of the reference frame plus the local coordinates of the point, rotated into the global reference frame. Here is a calculation of the global coordinates of the local point {3, 8} on the slider.
Out[40]= | |
The Location function performs effectively the same calculation.
Out[41]= | |
The PointToLocal function converts the global point back to local coordinates.
Out[42]= | |
A constant utility. Coordinate ConversionsThe following four conversion functions will not accept Modeler3D geometry objects as arguments. These functions only accept 3D vectors of the form {x, y, z}. Coordinate conversions. Coordinate conversion options. This converts a cylindrical coordinate triplet to Cartesian coordinates.
Out[43]= | |
This converts it back.
Out[44]= | |
This converts a 3D vector to polar coordinates.
Out[45]= | |
|