Table of Contents

Class CoordinateSystemBaseVectors

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

Class for the base vectors of a Cartesian coordinate system. This kind of triple vector is also called "trihedron".

[Serializable]
public class CoordinateSystemBaseVectors : ManualSerialization, IEquatable<IObjectBase>, ICloneable, ISerializable, IDeserializationCallback
Inheritance
ObjectBase
SerializableObjectBase
ManualSerialization
CoordinateSystemBaseVectors
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

CoordinateSystemBaseVectors()

Constructor that creates a system base object with the axes ((1,0,0), (0,1,0), (0,0,1))

public CoordinateSystemBaseVectors()

CoordinateSystemBaseVectors(double, double, double)

Constructor that uses Euler angles. See Bronstein et.al. "Taschenbuch der Mathematik" 2., überarb. und erw. Aufl.; Deutsch-Verlag, 1995; p.179-180.

public CoordinateSystemBaseVectors(double eulerPsi, double eulerTheta, double eulerPhi)

Parameters

eulerPsi double

Angle Psi

eulerTheta double

Angle Theta

eulerPhi double

Angle Phi

CoordinateSystemBaseVectors(CoordinateSystemBaseVectors)

Copy constructor

public CoordinateSystemBaseVectors(CoordinateSystemBaseVectors sBaseVectors)

Parameters

sBaseVectors CoordinateSystemBaseVectors

SystemBaseVectors to copy

CoordinateSystemBaseVectors(Matrix3x3D)

Constructor that uses a rotation matrix for initializing the direction cosines.

public CoordinateSystemBaseVectors(Matrix3x3D rotationMatrix)

Parameters

rotationMatrix Matrix3x3D

Rotation matrix R (i.e. R orthogonal and det(R)=1) that describes the rotation of the axes of the reference coordinate system to this Also (another interpretation of R): R defines a coordinate transformation from the coordinate system spanned by this base vectors (coordinates x') to the reference coordinate system (coordinates x) by x = Rx' (and therefore x' = R^Tx) - where both systems have the same origin.

CoordinateSystemBaseVectors(OrientationDefinitionBase)

Constructor which gets an orientation definition.

public CoordinateSystemBaseVectors(OrientationDefinitionBase orientationDefinition)

Parameters

orientationDefinition OrientationDefinitionBase

Orientation definition to create a new CoordinateSystemBaseVectors object from.

CoordinateSystemBaseVectors(Quaternion)

Constructor which gets a quaternion.

public CoordinateSystemBaseVectors(Quaternion quaternion)

Parameters

quaternion Quaternion

The quaternion describing the base vectors.

CoordinateSystemBaseVectors(Vector3D, double, bool)

Constructs a new coordinate system base vectors object via z-rotation and the direction vector of the z-axis: The orientation of the system's axes result from 2 steps and a certain order. A) inclinationFirst = false: (i) Rotation about z-axis with angle zeta - using the right-hand-rule, (ii) Inclination of z-axis specified by new direction axis. B) inclinationFirst = true: (i) Inclination of z-axis specified by direction vector, (ii) Rotation about inclined z-axis by angle zeta - using the right-hand-rule.

public CoordinateSystemBaseVectors(Vector3D directionOfZAxis, double zeta, bool inclinationFirst)

Parameters

directionOfZAxis Vector3D

Direction vector of new z-axis

zeta double

Angle (radian) of rotation about z-axis by using the right-hand-rule.

inclinationFirst bool

Flag to signal if z-axis is inclined first (true) or after rotation of z-axis (false).

CoordinateSystemBaseVectors(Vector3D, Vector3D, CoordinatePlane)

Constructor which gets only two base vectors. This may be helpful if one of the base vectors has already been created from a cross product, so creating the third base vector also by a cross product may produce large numerical problems.

public CoordinateSystemBaseVectors(Vector3D axis1, Vector3D axis2, CoordinatePlane plane)

Parameters

axis1 Vector3D

First base vector (meaning is set by planeIndex).

axis2 Vector3D

Second base vector (meaning is set by planeIndex).

plane CoordinatePlane

Sets the meaning of axis1 and axis2 by defining which plane is spanned by the given axes.

CoordinateSystemBaseVectors(Vector3D, Vector3D, Vector3D)

Constructor that uses direction cosines. This constructor is not recommended, because there's a significant probability for numerical inaccuracies which cause orthogonality problems. Better options may be the constructors getting a OrientationDefinitionBase or getting two axes and a plane index.

public CoordinateSystemBaseVectors(Vector3D xAxis, Vector3D yAxis, Vector3D zAxis)

Parameters

xAxis Vector3D

Direction cosine of the x-axis.

yAxis Vector3D

Direction cosine of the y-axis.

zAxis Vector3D

Direction cosine of the z-axis.

Properties

Quaternion

Quaternion which represents the orientation of the base vectors in the reference coordinate system.

public Quaternion Quaternion { get; set; }

Property Value

Quaternion

XAxis

Direction cosines of the x-Axis

public Vector3D XAxis { get; }

Property Value

Vector3D

YAxis

Direction cosines of the y-Axis

public Vector3D YAxis { get; }

Property Value

Vector3D

ZAxis

Direction cosines of the z-Axis

public Vector3D ZAxis { get; }

Property Value

Vector3D

Methods

Clone()

Deep copy

public override object Clone()

Returns

object

Copy of this

Equals(object, EqualityIntent)

Method which checks for equal objects.

public override bool Equals(object obj, EqualityIntent equalityIntent)

Parameters

obj object

The object to compare with this instance.

equalityIntent EqualityIntent

The equality intent.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

Equals(CoordinateSystemBaseVectors, bool)

Method that checks whether another CoordinateSystemBaseVectors object is equivalent to this

public bool Equals(CoordinateSystemBaseVectors baseVectors, bool indulgentCheck)

Parameters

baseVectors CoordinateSystemBaseVectors

CoordinateSystemBaseVectors object to check

indulgentCheck bool

Flag that indicates whether an indulgent check is to be done (like in NumericalChecks) or if an exact check has to be done.

Returns

bool

Is CoordinateSystemBaseVectors object equivalent?

GetDefinedSystemBaseForZVector(Vector3D)

Constructs a new system of base vectors from one vector serving as z-axis. The x-axis is defined as being the orthogonal projection of the reference system's x-axis onto the plane on which the given (z-)vector is orthogonal.

public static CoordinateSystemBaseVectors GetDefinedSystemBaseForZVector(Vector3D zVector)

Parameters

zVector Vector3D

Vector to create a system of base vectors from.

Returns

CoordinateSystemBaseVectors

A new system of base vectors, created from the given vector serving as z-axis.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetInverseRotationMatrix()

Get the corresponding rotation matrix build up from the direction cosines, i.e. the coordinates of the unit vectors of the three axes. If local and reference coordinate system have the same origin, a multiplication with this matrix would perform a coordinate transformation from the reference (external) cs to the local (internal) coordinate system

public Matrix3x3D GetInverseRotationMatrix()

Returns

Matrix3x3D

The inverse rotation matrix.

GetOrientation(OrientationDefinitionType)

Get the orientation of this, described by an OrientationDefinitionBase object of a given type. As this method doesn't know whether the z-axis rotation shall be done first or last, it assumes the z-axis rotation has to be done at last.

public OrientationDefinitionBase GetOrientation(OrientationDefinitionType type)

Parameters

type OrientationDefinitionType

Type of the OrientationDefinitionBase object to give.

Returns

OrientationDefinitionBase

Orientation of this as OrientationDefinitionBase.

GetOrientationByAxisRotationSequence()

Get the orientation of this, described by a sequence of axis rotations

public AxisRotationSequence GetOrientationByAxisRotationSequence()

Returns

AxisRotationSequence

Orientation of this as AxisRotationSequence.

GetOrientationByCartesianAngles(bool)

Get the orientation of this, described by the Cartesian angles of the z-axis and an additional rotation about the z-axis. As this method doesn't know whether the z-axis rotation shall be done first or last, it assumes the z-axis rotation has to be done at last.

public OrientationByCartesianAngles GetOrientationByCartesianAngles(bool cartesianAnglesApplicationBeforeZetaRotation)

Parameters

cartesianAnglesApplicationBeforeZetaRotation bool

If set to true the Cartesian angles are applied before an eventual zeta rotation.

Returns

OrientationByCartesianAngles

Orientation of this as OrientationByCartesianAngles.

GetOrientationByDirectionAngles(bool)

Get the orientation of this, described by the direction angles of the z-axis and an additional rotation about the z-axis.

public OrientationByDirectionAngles GetOrientationByDirectionAngles(bool directionAnglesApplicationBeforeZetaRotation)

Parameters

directionAnglesApplicationBeforeZetaRotation bool

if set to true the direction angles are applied before an eventual zeta rotation.

Returns

OrientationByDirectionAngles

Orientation of this as OrientationByDirectionAngles.

GetOrientationByEulerAngles()

Get the orientation of this coordinate system base expressed in Euler angles (Psi, Theta, Phi). For the definition of the Euler angles see Bronstein et.al. "Taschenbuch der Mathematik" 2., überarb. und erw. Aufl.; Deutsch-Verlag, 1995; p.179-180.

public OrientationByEulerAngles GetOrientationByEulerAngles()

Returns

OrientationByEulerAngles

Orientation of this as OrientationByEulerAngles.

GetOrientationBySphereAngles(bool)

Get the orientation of this, described by the sphere angles of the z-axis and an additional rotation about the z-axis

public OrientationBySphereAngles GetOrientationBySphereAngles(bool sphereAnglesApplicationBeforeZetaRotation)

Parameters

sphereAnglesApplicationBeforeZetaRotation bool

If set to true the sphere angles are applied before an eventual zeta rotation.

Returns

OrientationBySphereAngles

Orientation of this as OrientationBySphereAngles.

GetRotationMatrix()

Get the corresponding rotation matrix build up from the direction cosines, i.e. the coordinates of the unit vectors of the three axes. If local and reference coordinate system have the same origin, a multiplication with this matrix would perform a coordinate transformation from the local (internal) coordinate system to the reference (external) cs.

public Matrix3x3D GetRotationMatrix()

Returns

Matrix3x3D

The rotation matrix.

RotationMatrixForArbitraryAxis(Vector3D, double)

Calculates the rotation matrix for a arbitrary rotation axis and a rotation angle (by using the right-hand-rule). If a coordinate system shall be rotated, the transposed matrix has to be used. Please note: Using the constructor of Quaternion with the same parameters could be a better choice regarding performance.

public static Matrix3x3D RotationMatrixForArbitraryAxis(Vector3D rotationAxis, double angle)

Parameters

rotationAxis Vector3D

Rotation axis (unit vector).

angle double

Rotation angle.

Returns

Matrix3x3D

The rotation matrix for the rotation about the given axis with the given angle (right-hand-rule).

See Also
Quaternion

RotationMatrixForXAxis(double)

Calculates the rotation matrix for a rotation about the x-axis

public static Matrix3x3D RotationMatrixForXAxis(double angle)

Parameters

angle double

Rotation angle

Returns

Matrix3x3D

The rotation matrix for the rotation of a coordinate system about the x-axis.

RotationMatrixForZAxis(double)

Calculates the rotation matrix for a rotation about the z-axis

public static Matrix3x3D RotationMatrixForZAxis(double angle)

Parameters

angle double

Rotation angle

Returns

Matrix3x3D

The rotation matrix for the rotation of a coordinate system about the z-axis

ToString()

Gives the axes of this base vectors object as one string.

public override string ToString()

Returns

string

Operators

operator ==(CoordinateSystemBaseVectors, CoordinateSystemBaseVectors)

Overloaded equality operator

public static bool operator ==(CoordinateSystemBaseVectors bv1, CoordinateSystemBaseVectors bv2)

Parameters

bv1 CoordinateSystemBaseVectors

First SystemBaseVectors object to compare

bv2 CoordinateSystemBaseVectors

Second SystemBaseVectors object to compare

Returns

bool

Are both SystemBaseVectors objects equal?

operator !=(CoordinateSystemBaseVectors, CoordinateSystemBaseVectors)

Overloaded inequality operator

public static bool operator !=(CoordinateSystemBaseVectors bv1, CoordinateSystemBaseVectors bv2)

Parameters

bv1 CoordinateSystemBaseVectors

First SystemBaseVectors object to compare

bv2 CoordinateSystemBaseVectors

Second SystemBaseVectors object to compare

Returns

bool

Are both SystemBaseVectors objects unequal?