|
void | CalculateCylinderPositions (int cylinderCount, Vector3[] spherePositions, Vector3[] cylinderPositions) |
|
Vector3 | MatrixVectorMultiplication (float[,] matrix, Vector3 vector) |
|
BSM.Quaternion | EmbeddedVector (Vector3 vector) |
|
Vector3 | ImaginaryPart (BSM.Quaternion quaternion) |
|
Quaternion | QuaternionConversionFromBSM (BSM.Quaternion bsmQuaternion) |
|
BSM.Quaternion | QuaternionConversionToBSM (Quaternion quaternion) |
|
Vector3 | DiscreteDarbouxVector (BSM.Quaternion orientationOne, BSM.Quaternion orientationTwo, float rodElementLength) |
|
float | DarbouxSignFactor (Vector3 currentDarbouxVector, Vector3 restDarbouxVector) |
|
float | VectorLength (Vector3 vector) |
|
float | QuaternionLength (BSM.Quaternion quaternion) |
|
float | RodElementLengthDeviation (Vector3 particlePositionOne, Vector3 particlePositionTwo, float defaultRodElementLength) |
|
float | StretchConstraintDeviation (Vector3 particlePositionOne, Vector3 particlePositionTwo, BSM.Quaternion orientation, BSM.Quaternion e_3, float rodElementLength, bool logIntermediateResults=false) |
|
float | BendTwistConstraintDeviation (BSM.Quaternion orientationOne, BSM.Quaternion orientationTwo, float rodElementLength, Vector3 discreteRestDarbouxVector, bool logIntermediateResults=false) |
|
float | RodElementLength (Vector3 particlePositionOne, Vector3 particlePositionTwo) |
|
Vector3[][] | UpdateDirectors (int cylinderCount, BSM.Quaternion[] cylinderOrientations, Vector3[][] directors, BSM.Quaternion[] worldSpaceBasis) |
|
BSM.Quaternion | RandomUnitQuaternion () |
|
float | GetGaussianRandomNumber () |
|
This class provides various helper methods for calculation.
◆ BendTwistConstraintDeviation()
float GuidewireSim.MathHelper.BendTwistConstraintDeviation |
( |
BSM.Quaternion |
orientationOne, |
|
|
BSM.Quaternion |
orientationTwo, |
|
|
float |
rodElementLength, |
|
|
Vector3 |
discreteRestDarbouxVector, |
|
|
bool |
logIntermediateResults = false |
|
) |
| |
Returns the deviation of the bend twist constraint from zero.
- Parameters
-
orientationOne | \( q \) of the equation (32). |
orientationTwo | \( u \) of the equation (32). |
rodElementLength | The Rod Element Length between orientationOne and orientationTwo . Used to calculate \( \mathbb{\Omega} \) of the equation (32). |
discreteRestDarbouxVector | \( \mathbb{\Omega}^0 \) of the equation (32). |
logIntermediateResults | Whether to output several logs that contain intermediate results of the calculation. Default is false. |
- Returns
- The Deviation of the calculated bend twist constraint and zero.
- Note
- Check the Position and Orientation Based Cosserat Rods Paper (2016), equation (32), for more information on the bend twist constraint.
◆ CalculateCylinderPositions()
void GuidewireSim.MathHelper.CalculateCylinderPositions |
( |
int |
cylinderCount, |
|
|
Vector3[] |
spherePositions, |
|
|
Vector3[] |
cylinderPositions |
|
) |
| |
Calculates cylinderPositions
as the middle points of two adjacent spheres.
- Parameters
-
cylinderCount | The count of all cylinders of the guidewire. Equals the length of cylinderOrientationPredictions . |
spherePositions | The position at the current frame of each sphere. |
cylinderPositions | The position/ center of mass of each cylinder. |
- Note
cylinderPositions
is not marked as an out parameter, since cylinderPositions
is not initialized in this method, but its values are changed.
◆ DarbouxSignFactor()
float GuidewireSim.MathHelper.DarbouxSignFactor |
( |
Vector3 |
currentDarbouxVector, |
|
|
Vector3 |
restDarbouxVector |
|
) |
| |
Calculates the sign factor of the current discrete Darboux Vector and the rest Darboux Vector of the same orientations.
- Note
- Check the Position and Orientation Based Cosserat Rods Paper (2016) for more information on the sign factor.
- Parameters
-
currentDarbouxVector | The discrete Darboux Vector of two fixed orientations at the current frame. |
restDarbouxVector | The rest Darboux Vector of the same two orientations at frame 0. |
- Returns
- The Sign Factor between these two entities.
◆ DiscreteDarbouxVector()
Vector3 GuidewireSim.MathHelper.DiscreteDarbouxVector |
( |
BSM.Quaternion |
orientationOne, |
|
|
BSM.Quaternion |
orientationTwo, |
|
|
float |
rodElementLength |
|
) |
| |
Calculates the discrete Darboux Vector of two adjacent orientations orientationOne
, orientationTwo
.
- Parameters
-
orientationOne | The orientation with the lower index, e.g. \( i \). |
orientationTwo | The orientation with the higher index, e.g. \( i + 1 \). |
rodElementLength | The distance between two spheres, also the distance between two orientations. |
- Returns
- The discrete Darboux Vector between
orientationOne
and orientationTwo
.
- Note
- There is only cylinderCount - 1 many darboux vectors. The i-th Darboux Vector is between orientation i and orientation i+1.
- Attention
- The order in which the orientations are entered matters. The Darboux Vector of \( q_1, q_2 \) is not the same as the Darboux Vector of \( q_2, q_1 \).
◆ EmbeddedVector()
BSM.Quaternion GuidewireSim.MathHelper.EmbeddedVector |
( |
Vector3 |
vector | ) |
|
Returns a quaternion that is the embedded vector with scalar part zero.
- Example
- \( (x, y, z) \mapsto (x, y, z, 0) \).
- Parameters
-
vector | The vector to be embedded. |
- Returns
- The quaternion that is the embedded vector with scalar part zero.
◆ GetGaussianRandomNumber()
float GuidewireSim.MathHelper.GetGaussianRandomNumber |
( |
| ) |
|
Provides a sample from \( \mathcal{N}(0,1)\) by using the Marsaglia polar method to transform a uniform distribution to a normal distribution.
- Returns
- A sample from \( \mathcal{N}(0,1)\).
- Note
- To understand this method, google the Marsaglia polar method. Note that unity does not provide a function to generate a random number following a gaussian distribution.
◆ ImaginaryPart()
Vector3 GuidewireSim.MathHelper.ImaginaryPart |
( |
BSM.Quaternion |
quaternion | ) |
|
Returns the imaginary part of a quaternion
.
- Example
- \( (x, y, z, w) \mapsto (x, y, z) \).
- Parameters
-
quaternion | The quaternion whose imaginary part to return. |
- Returns
- The imaginary part of a
quaternion
.
◆ MatrixVectorMultiplication()
Vector3 GuidewireSim.MathHelper.MatrixVectorMultiplication |
( |
float |
matrix[,], |
|
|
Vector3 |
vector |
|
) |
| |
Calculates the multiplication of \( M x \), where \( M \) is the matrix
, and \( x \) is the vector
input.
- Parameters
-
matrix | The matrix to be multiplied with the vector. |
vector | The matrix to be multiplied with the matrix. |
- Returns
- The multiplication \( M x \).
- Requirements:
matrix
must be a \( 3 \times 3 \) matrix.
◆ QuaternionConversionFromBSM()
Quaternion GuidewireSim.MathHelper.QuaternionConversionFromBSM |
( |
BSM.Quaternion |
bsmQuaternion | ) |
|
Takes as input a BSM.Quaternion and returns a UnityEngine.Quaternion.
- Parameters
-
bsmQuaternion | The BSM.Quaternion to be converted. |
- Returns
- The converted UnityEngine.Quaternion.
◆ QuaternionConversionToBSM()
BSM.Quaternion GuidewireSim.MathHelper.QuaternionConversionToBSM |
( |
Quaternion |
quaternion | ) |
|
Takes as input a UnityEngine.Quaternion and returns a BSM.Quaternion.
- Parameters
-
bsmQuaternion | The UnityEngine.Quaternion to be converted. |
- Returns
- The converted BSM.Quaternion.
◆ QuaternionLength()
float GuidewireSim.MathHelper.QuaternionLength |
( |
BSM.Quaternion |
quaternion | ) |
|
Returns the quaternion length of quaternion
, i.e. \( \sqrt{x^2 + y^2 + z^2 + w^2} \).
- Parameters
-
quaternion | The quaternion whose length to return. |
- Returns
- The quaternion length of
quaternion
.
◆ RandomUnitQuaternion()
BSM.Quaternion GuidewireSim.MathHelper.RandomUnitQuaternion |
( |
| ) |
|
Provides a random unit quaternion drawn from a gaussian distribution.
- Returns
- A random unit quaternion drawn from a gaussian distribution.
- Note
- This works by drawing four random, gaussian distributed, numbers, and filling the components of the quaternion with these numbers. Mathematically, this is equal to drawing a quaternion from a gaussian distribution in \( \mathcal{R}^{4} \), since the joint distribution of gaussian samples is again gaussian.
- Requirements:
- The length of the drawn quaternion is approximately equal to one.
◆ RodElementLength()
float GuidewireSim.MathHelper.RodElementLength |
( |
Vector3 |
particlePositionOne, |
|
|
Vector3 |
particlePositionTwo |
|
) |
| |
Calculates the rod element length between particlePositionOne
and particlePositionTwo
.
- Parameters
-
particlePositionOne | The first particle of the rod element under consideration. |
particlePositionTwo | The first particle of the rod element under consideration. |
- Returns
- The rod element length.
◆ RodElementLengthDeviation()
float GuidewireSim.MathHelper.RodElementLengthDeviation |
( |
Vector3 |
particlePositionOne, |
|
|
Vector3 |
particlePositionTwo, |
|
|
float |
defaultRodElementLength |
|
) |
| |
Returns the deviation between the actual distance of particlePositionOne
and particlePositionTwo
(current Rod Element Length) and the defaultRodElementLength
.
- Parameters
-
particlePositionOne | The first particle under consideration for the rod element length. |
particlePositionTwo | The first particle under consideration for the rod element length. |
defaultRodElementLength | The rod element length at rest state (i.e. frame 0) between these two particles. |
- Returns
- The deviation between the actual rod element length and the default rod element length.
◆ SquaredNorm()
float GuidewireSim.MathHelper.SquaredNorm |
( |
Vector3 |
vector | ) |
|
|
private |
Returns the squared norm of a vector
.
- Parameters
-
vector | The vector whose squared norm to return. |
- Returns
- The Squared norm of
vector
.
◆ StretchConstraintDeviation()
float GuidewireSim.MathHelper.StretchConstraintDeviation |
( |
Vector3 |
particlePositionOne, |
|
|
Vector3 |
particlePositionTwo, |
|
|
BSM.Quaternion |
orientation, |
|
|
BSM.Quaternion |
e_3, |
|
|
float |
rodElementLength, |
|
|
bool |
logIntermediateResults = false |
|
) |
| |
Returns the deviation of the stretch constraint from zero.
- Parameters
-
particlePositionOne | \( p_1 \) of the equation (31). |
particlePositionTwo | \( p_2 \) of the equation (31). |
orientation | \( q \) of the equation (31). |
e_3 | \( e_3 \) of the equation (31). |
rodElementLength | \( l \) of the equation (31). |
logIntermediateResults | Whether to output several logs that contain intermediate results of the calculation. Default is false. |
- Returns
- The Deviation of the calculated stretch constraint and zero.
- Note
- Check the Position and Orientation Based Cosserat Rods Paper (2016), equation (31), for more information on the stretch constraint.
◆ UpdateDirectors()
Vector3 [][] GuidewireSim.MathHelper.UpdateDirectors |
( |
int |
cylinderCount, |
|
|
BSM.Quaternion[] |
cylinderOrientations, |
|
|
Vector3 |
directors[][], |
|
|
BSM.Quaternion[] |
worldSpaceBasis |
|
) |
| |
Updates all directors of each orientation at the update step of the simulation loop.
- Example
- The directors \( d_1, d_2, d_3 \) are calculated as \( d_i = q \cdot e_i \cdot \bar{q} \) for each orientation \( q\), where \( e_i \) is the i-th world space basis vector. In quaternion calculus, this means rotating \( e_i \) by \( q \).
- Parameters
-
cylinderCount | The count of all cylinders of the guidewire. Equals the length of cylinderOrientationPredictions . |
cylinderOrientations | The orientation of each cylinder at its center of mass. |
directors | The orthonormal basis of each orientation element / cylinder, also called directors. |
worldSpaceBasis | The three basis vectors of the world coordinate system. |
- Returns
- All directors of each orientation.
◆ VectorLength()
float GuidewireSim.MathHelper.VectorLength |
( |
Vector3 |
vector | ) |
|
Returns the vector length of vector
, i.e. \( \sqrt{x_1^2 + x_2^2 + x_3^2} \) for a three-dimensional vector.
- Parameters
-
vector | The vector whose length to return. |
- Returns
- The vector length of
vector
.
The documentation for this class was generated from the following file: