Simulating Guidewires in Blood Vessels using Cosserat Rod Theory |

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GuidewireSim.ConstraintSolvingStep Class Reference
Inheritance diagram for GuidewireSim.ConstraintSolvingStep:

## Public Member Functions
void | SolveStretchConstraints (Vector3[] spherePositionPredictions, BSM.Quaternion[] cylinderOrientationPredictions, int spheresCount, BSM.Quaternion[] worldSpaceBasis, float rodElementLength)
void | SolveBendTwistConstraints (BSM.Quaternion[] cylinderOrientationPredictions, int cylinderCount, Vector3[] discreteRestDarbouxVectors, float rodElementLength)
void | SolveStretchConstraint (Vector3 particlePositionOne, Vector3 particlePositionTwo, BSM.Quaternion orientation, BSM.Quaternion e_3, float rodElementLength, out Vector3 deltaPositionOne, out Vector3 deltaPositionTwo, out BSM.Quaternion deltaOrientation, float inverseMassOne=1f, float inverseMassTwo=1f, float inertiaWeight=1f)
void | SolveBendTwistConstraint (BSM.Quaternion orientationOne, BSM.Quaternion orientationTwo, Vector3 discreteRestDarbouxVector, float rodElementLength, out BSM.Quaternion deltaOrientationOne, out BSM.Quaternion deltaOrientationTwo, float inertiaWeightOne=1f, float inertiaWeightTwo=1f)

## Private Member Functions
void | Awake ()
void | SolveStretchConstraintsInBilateralOrder (Vector3[] spherePositionPredictions, BSM.Quaternion[] cylinderOrientationPredictions, int spheresCount, float rodElementLength, BSM.Quaternion e_3)
void | SolveStretchConstraintsInNaiveOrder (Vector3[] spherePositionPredictions, BSM.Quaternion[] cylinderOrientationPredictions, int spheresCount, float rodElementLength, BSM.Quaternion e_3)
void | SolveBendTwistConstraintsInBilateralOrder (BSM.Quaternion[] cylinderOrientationPredictions, int cylinderCount, Vector3[] discreteRestDarbouxVectors, float rodElementLength)
void | SolveBendTwistConstraintsInNaiveOrder (BSM.Quaternion[] cylinderOrientationPredictions, int cylinderCount, Vector3[] discreteRestDarbouxVectors, float rodElementLength)
void | CorrectStretchPredictions (int sphereIndex, Vector3[] spherePositionPredictions, BSM.Quaternion[] cylinderOrientationPredictions)
void | CorrectBendTwistPredictions (int cylinderIndex, BSM.Quaternion[] cylinderOrientationPredictions)

## Private Attributes
MathHelper | mathHelper
| The component MathHelper that provides math related helper functions. More...
Vector3 | deltaPositionOne = new Vector3()
| The correction of `particlePositionOne` in method SolveStretchConstraint(). More...
Vector3 | deltaPositionTwo = new Vector3()
| The correction of `particlePositionTwo` in method SolveStretchConstraint(). More...
BSM.Quaternion | deltaOrientation = new BSM.Quaternion()
| The correction of `orientation` in method SolveStretchConstraint(). More...
BSM.Quaternion | deltaOrientationOne = new BSM.Quaternion()
| The correction of `orientationOne` in method SolveBendTwistConstraint(). More...
BSM.Quaternion | deltaOrientationTwo = new BSM.Quaternion()
| The correction of `orientationTwo` in method SolveBendTwistConstraint(). More...
float | stretchStiffness = 0.1f
float | bendStiffness = 0.1f
bool | executeInBilateralOrder = false
| Whether to solve both constraints in bilateral interleaving order. Naive order is used when false. More...

## Detailed Description

This class executes and implements various algorithms of the constraint solving step of the algorithm and manages all coherent data.

## Member Function Documentation

## ◆ Awake()

void GuidewireSim.ConstraintSolvingStep.Awake | ( |  | ) |
| private

## ◆ CorrectBendTwistPredictions()

void GuidewireSim.ConstraintSolvingStep.CorrectBendTwistPredictions | ( | int | cylinderIndex,
|  | BSM.Quaternion[] | cylinderOrientationPredictions
| ) |  |
| private

Corrects the predictions of the bend twist constraint by adding `deltaOrientationOne` and `deltaOrientationTwo`.

Note
  Note that `deltaOrientationOne` and `deltaOrientationTwo` may have a length unequal one by definition.

Parameters

  cylinderIndex | The index of the first element of `cylinderOrientationPredictions` that gets corrected.
  cylinderOrientationPredictions | The array of orientation predictions of which two quaternions get corrected in this method.

Requirements:

  The relevant entries of `cylinderOrientationPredictions` should be unit quaternions, i.e. have length approximately equal to one.

  After the quaternion predictions got corrected, they should again be unit quaternions, i.e. have length approximately equal to one.

## ◆ CorrectStretchPredictions()

void GuidewireSim.ConstraintSolvingStep.CorrectStretchPredictions | ( | int | sphereIndex,
|  | Vector3[] | spherePositionPredictions,
|  | BSM.Quaternion[] | cylinderOrientationPredictions
| ) |  |
| private

Corrects the predictions of the stretch constraint by adding `deltaPositionOne`, `deltaPositionTwo` and `deltaOrientation`.

Note
  Note that `deltaOrientation` may has a length unequal one by definition.

Parameters

  sphereIndex | The index of the first element of `spherePositionPredictions` that gets corrected.
  spherePositionPredictions | The array of position predictions of which two positions get corrected in this method.
  cylinderOrientationPredictions | The array of orientation predictions of which one quaternions gets corrected in this method.

Requirements:

  The relevant entries of `cylinderOrientationPredictions` should be unit quaternions, i.e. have length approximately equal to one.

  After the quaternion prediction got corrected, it should again be a unit quaternions, i.e. have length approximately equal to one.

## ◆ SolveBendTwistConstraint()

void GuidewireSim.ConstraintSolvingStep.SolveBendTwistConstraint | ( | BSM.Quaternion | orientationOne,
|  | BSM.Quaternion | orientationTwo,
|  | Vector3 | discreteRestDarbouxVector,
|  | float | rodElementLength,
|  | out BSM.Quaternion | deltaOrientationOne,
|  | out BSM.Quaternion | deltaOrientationTwo,
|  | float | inertiaWeightOne = `1f`,
|  | float | inertiaWeightTwo = `1f`
| ) |  |

Solves the bend twist constraint by calculating the corrections `deltaOrientationOne` and `deltaOrientationTwo`.

Note
  To be more precise, the bend twist constraint is not solved but minimized, i.e. the constraint will after correcting with the corrections be closer to zero.

Parameters

  | orientationOne | The first orientation quaternion prediction of the orientation element to be corrected.
  | orientationTwo | The second orientation quaternion prediction of the orientation element to be corrected.
  | discreteRestDarbouxVector | The discrete Darboux Vector at the rest configuration, i.e. at frame 0.
  | rodElementLength | The distance between two spheres, also the distance between two orientations.
  [out] | deltaOrientationOne | The correction of `orientationOne`.
  [out] | deltaOrientationTwo | The correction of `orientationTwo`.
  | inertiaWeightOne | The inertia weight scalar for `orientationOne`. Use a value of 1 for a moving orientation and 0 for a fixed orientation.
  | inertiaWeightTwo | The inertia weight scalar for `orientationTwo`. Use a value of 1 for a moving orientation and 0 for a fixed orientation.

Requirements:

  `orientationOne` and `orientationTwo` should be unit quaternions, i.e. have length approximately equal to one.

  `rodElementLength` should be positive.

  `inertiaWeightOne` and `inertiaWeightTwo` should be values between 0 and 1.

## ◆ SolveBendTwistConstraints()

void GuidewireSim.ConstraintSolvingStep.SolveBendTwistConstraints | ( | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | cylinderCount,
|  | Vector3[] | discreteRestDarbouxVectors,
|  | float | rodElementLength
| ) |  |

Is responsible for executing one iteration of the constraint solving step for the bend twist constraint, i.e. corrects each orientation prediction one time.

Note
  Can be executed in naive order or bilateral interleaving order.

Parameters

  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  cylinderCount | The count of all cylinders of the guidewire. Equals the length of `cylinderOrientationPredictions`.
  discreteRestDarbouxVectors | The array of all discrete Darboux Vectors at the rest configuration, i.e. at frame 0. Has (n-1) elements, if n is the number of orientations of the guidewire, because the darboux vector is taken of two adjacent orientations.
  rodElementLength | The distance between two spheres, also the distance between two orientations.

Requirements:

  `cylinderCount` should be at least one.

  `rodElementLength` should be positive.

  Executes the constraint solving step in bilateral interleaving order if executeInBilateralOrder and otherwise in naive order.

## ◆ SolveBendTwistConstraintsInBilateralOrder()

void GuidewireSim.ConstraintSolvingStep.SolveBendTwistConstraintsInBilateralOrder | ( | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | cylinderCount,
|  | Vector3[] | discreteRestDarbouxVectors,
|  | float | rodElementLength
| ) |  |
| private

Is responsible for executing one iteration of the constraint solving step for the bend twist constraint in bilateral order, i.e. corrects each orientation prediction one time.

Note
  You can read more about bilateral order in the 2016 paper "Position and Orientation Based Cosserat Rods".

Attention
  The index shifting of this algorithm is not easy to understand, but got deeply tested.

Parameters

  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  cylinderCount | The count of all cylinders of the guidewire. Equals the length of `cylinderOrientationPredictions`.
  discreteRestDarbouxVectors | The array of all discrete Darboux Vectors at the rest configuration, i.e. at frame 0. Has (n-1) elements, if n is the number of orientations of the guidewire, because the darboux vector is taken of two adjacent orientations.
  rodElementLength | The distance between two spheres, also the distance between two orientations.

Requirements:

  `cylinderCount` should be at least one.

  `rodElementLength` should be positive.

## ◆ SolveBendTwistConstraintsInNaiveOrder()

void GuidewireSim.ConstraintSolvingStep.SolveBendTwistConstraintsInNaiveOrder | ( | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | cylinderCount,
|  | Vector3[] | discreteRestDarbouxVectors,
|  | float | rodElementLength
| ) |  |
| private

Is responsible for executing one iteration of the constraint solving step for the bend twist constraint in naive order, i.e. corrects each orientation prediction one time.

Note
  Naive order means the predictions are updated beginning from one end of the guidewire to the other end of the guidewire.

Parameters

  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  cylinderCount | The count of all cylinders of the guidewire. Equals the length of `cylinderOrientationPredictions`.
  discreteRestDarbouxVectors | The array of all discrete Darboux Vectors at the rest configuration, i.e. at frame 0. Has (n-1) elements, if n is the number of orientations of the guidewire, because the darboux vector is taken of two adjacent orientations.
  rodElementLength | The distance between two spheres, also the distance between two orientations.

Requirements:

  `cylinderCount` should be at least one.

  `rodElementLength` should be positive.

## ◆ SolveStretchConstraint()

void GuidewireSim.ConstraintSolvingStep.SolveStretchConstraint | ( | Vector3 | particlePositionOne,
|  | Vector3 | particlePositionTwo,
|  | BSM.Quaternion | orientation,
|  | BSM.Quaternion | e_3,
|  | float | rodElementLength,
|  | out Vector3 | deltaPositionOne,
|  | out Vector3 | deltaPositionTwo,
|  | out BSM.Quaternion | deltaOrientation,
|  | float | inverseMassOne = `1f`,
|  | float | inverseMassTwo = `1f`,
|  | float | inertiaWeight = `1f`
| ) |  |

Solves the stretch constraint by calculating the corrections `deltaPositionOne` and `deltaPositionTwo`, `deltaOrientation`.

Note
  To be more precise, the stretch constraint is not solved but minimized, i.e. the constraint will after correcting with the corrections be closer to zero.

Parameters

  | particlePositionOne | The first particle position prediction of the centerline element to be corrected.
  | particlePositionTwo | The second particle position prediction of the centerline element to be corrected.
  | orientation | The orientation quaternion prediction of the orientation element between the particle positions to be corrected.
  | e_3 | The third basis vector of the world space coordinates embedded as a quaternion with scalar part 0.
  | rodElementLength | The distance between two spheres, also the distance between two orientations.
  [out] | deltaPositionOne | The correction of `particlePositionOne`.
  [out] | deltaPositionTwo | The correction of `particlePositionTwo`.
  [out] | deltaOrientation | The correction of `orientation`.
  | inverseMassOne | The inverse mass scalar for `particlePositionOne`. Use a value of 1 for a moving particle and 0 for a fixed particle.
  | inverseMassTwo | The inverse mass scalar for `particlePositionTwo`. Use a value of 1 for a moving particle and 0 for a fixed particle.
  | inertiaWeight | The inertia weight scalar for `orientation`. Use a value of 1 for a moving orientation and 0 for a fixed orientation.

Requirements:

  `orientation` should be a unit quaternions, i.e. have length approximately equal to one.

  `e_3` should be a unit quaternions, i.e. have length approximately equal to one.

  `rodElementLength` should be positive.

  `inverseMassOne`, `inverseMassTwo` and `inertiaWeight` should be values between 0 and 1.

## ◆ SolveStretchConstraints()

void GuidewireSim.ConstraintSolvingStep.SolveStretchConstraints | ( | Vector3[] | spherePositionPredictions,
|  | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | spheresCount,
|  | BSM.Quaternion[] | worldSpaceBasis,
|  | float | rodElementLength
| ) |  |

Is responsible for executing one iteration of the constraint solving step for the stretch constraint, i.e. corrects each particle position prediction one time and also each orientation prediction one time.

Note
  Can be executed in naive order or bilateral interleaving order.

Parameters

  spherePositionPredictions | The array of position predictions that get corrected in this step.
  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  spheresCount | The count of all spheres of the guidewire. Equals the length of `spherePositionPredictions`.
  worldSpaceBasis | The three basis vectors of the world coordinate system as embedded quaternions with scalar part 0.
  rodElementLength | The distance between two spheres, also the distance between two orientations.

Requirements:

  `spheresCount` should be at least one.

  `rodElementLength` should be positive.

  Executes the constraint solving step in bilateral interleaving order if executeInBilateralOrder and otherwise in naive order.

## ◆ SolveStretchConstraintsInBilateralOrder()

void GuidewireSim.ConstraintSolvingStep.SolveStretchConstraintsInBilateralOrder | ( | Vector3[] | spherePositionPredictions,
|  | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | spheresCount,
|  | float | rodElementLength,
|  | BSM.Quaternion | e_3
| ) |  |
| private

Executes one iteration of the constraint solving step for the stretch constraint in bilateral order, i.e. corrects each particle position prediction one time and also each orientation prediction one time.

Note
  You can read more about bilateral order in the 2016 paper "Position and Orientation Based Cosserat Rods".

Attention
  The index shifting of this algorithm is not easy to understand, but got deeply tested.

Parameters

  spherePositionPredictions | The array of position predictions that get corrected in this step.
  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  spheresCount | The count of all spheres of the guidewire. Equals the length of `spherePositionPredictions`.
  rodElementLength | The distance between two spheres, also the distance between two orientations.
  e_3 | The third basis vector of the world coordinate system as embedded quaternions with scalar part 0.

Requirements:

  `spheresCount` should be at least one.

  `rodElementLength` should be positive.

## ◆ SolveStretchConstraintsInNaiveOrder()

void GuidewireSim.ConstraintSolvingStep.SolveStretchConstraintsInNaiveOrder | ( | Vector3[] | spherePositionPredictions,
|  | BSM.Quaternion[] | cylinderOrientationPredictions,
|  | int | spheresCount,
|  | float | rodElementLength,
|  | BSM.Quaternion | e_3
| ) |  |
| private

Executes one iteration of the constraint solving step for the stretch constraint in naive order, i.e. corrects each particle position prediction one time and also each orientation prediction one time.

Note
  Naive order means the predictions are updated beginning from one end of the guidewire to the other end of the guidewire.

Parameters

  spherePositionPredictions | The array of position predictions that get corrected in this step.
  cylinderOrientationPredictions | The array of orientation predictions that get corrected in this step.
  spheresCount | The count of all spheres of the guidewire. Equals the length of `spherePositionPredictions`.
  rodElementLength | The distance between two spheres, also the distance between two orientations.
  e_3 | The third basis vector of the world coordinate system as embedded quaternions with scalar part 0.

Requirements:

  `spheresCount` should be at least one.

  `rodElementLength` should be positive.

## Member Data Documentation

## ◆ bendStiffness

float GuidewireSim.ConstraintSolvingStep.bendStiffness = 0.1f
| private

## ◆ deltaOrientation

BSM.Quaternion GuidewireSim.ConstraintSolvingStep.deltaOrientation = new BSM.Quaternion()
| private

The correction of `orientation` in method SolveStretchConstraint().

## ◆ deltaOrientationOne

BSM.Quaternion GuidewireSim.ConstraintSolvingStep.deltaOrientationOne = new BSM.Quaternion()
| private

The correction of `orientationOne` in method SolveBendTwistConstraint().

## ◆ deltaOrientationTwo

BSM.Quaternion GuidewireSim.ConstraintSolvingStep.deltaOrientationTwo = new BSM.Quaternion()
| private

The correction of `orientationTwo` in method SolveBendTwistConstraint().

## ◆ deltaPositionOne

Vector3 GuidewireSim.ConstraintSolvingStep.deltaPositionOne = new Vector3()
| private

The correction of `particlePositionOne` in method SolveStretchConstraint().

## ◆ deltaPositionTwo

Vector3 GuidewireSim.ConstraintSolvingStep.deltaPositionTwo = new Vector3()
| private

The correction of `particlePositionTwo` in method SolveStretchConstraint().

## ◆ executeInBilateralOrder

bool GuidewireSim.ConstraintSolvingStep.executeInBilateralOrder = false
| private

Whether to solve both constraints in bilateral interleaving order. Naive order is used when false.

## ◆ mathHelper

MathHelper GuidewireSim.ConstraintSolvingStep.mathHelper
| private

The component MathHelper that provides math related helper functions.

## ◆ stretchStiffness

float GuidewireSim.ConstraintSolvingStep.stretchStiffness = 0.1f
| private

The documentation for this class was generated from the following file:

- ConstraintSolvingStep.cs