Namespaces

Types in MathNet.Spatial.Euclidean

Type UnitVector3D

Namespace MathNet.Spatial.Euclidean

Parent ValueType

Interfaces IXmlSerializable, IEquatable<UnitVector3D>, IEquatable<Vector3D>, IFormattable

A unit vector, this is used to describe a direction in 3D

Static Functions

Methods

Properties

Fields

Public Static Functions

UnitVector3D Create(double x, double y, double z, double tolerance)

Initializes a new instance of the UnitVector3D struct. The provided values are scaled to L2 norm == 1
Parameters
double x

The x component.

double y

The y component.

double z

The z component.

double tolerance

The allowed deviation from 1 for the L2-norm of x,y,z

UnitVector3D OfVector(Vector<double> vector)

Create a new UnitVector3D from a Math.NET Numerics vector of length 3.
Parameters
Vector<double> vector

A vector with length 2 to populate the created instance with.

UnitVector3D Parse(string value, IFormatProvider formatProvider, double tolerance)

Attempts to convert a string of the form x,y,z into a vector
Parameters
string value

The string to be converted

IFormatProvider formatProvider

The IFormatProvider

double tolerance

The tolerance for how big deviation from Length = 1 is accepted

Return
UnitVector3D

A point at the coordinates specified

UnitVector3D ReadFrom(XmlReader reader)

Creates an UnitVector3D from an XmlReader.
Parameters
XmlReader reader

An XmlReader positioned at the node to read into this UnitVector3D.

Return
UnitVector3D

An UnitVector3D that contains the data read from the reader.

bool TryParse(string text, IFormatProvider formatProvider, UnitVector3D& result, double tolerance)

bool TryParse(string text, UnitVector3D& result, double tolerance)

Public Methods

Angle AngleTo(UnitVector3D v)

Compute the angle between this vector and a unit vector using the arccosine of the dot product.
Parameters
UnitVector3D v

The other vector

Return
Angle

The angle between the vectors, with a range between 0° and 180°

Angle AngleTo(Vector3D v)

The nearest angle between the vectors
Parameters
Vector3D v

The other vector

Return
Angle

The angle

Vector3D CrossProduct(Vector3D other)

Returns the cross product of this vector and a unit vector
Parameters
Vector3D other

A vector

Return
Vector3D

A new vector with the cross product result

UnitVector3D CrossProduct(UnitVector3D other)

Returns the cross product of this vector and a vector
Parameters
UnitVector3D other

A vector

Return
UnitVector3D

A new vector with the cross product result

double DotProduct(UnitVector3D v)

Returns the dot product of two vectors.
Parameters
UnitVector3D v

The second vector.

Return
double

The dot product.

double DotProduct(Vector3D v)

Returns the dot product of two vectors.
Parameters
Vector3D v

The second vector.

Return
double

The dot product.

bool Equals(object obj)

bool Equals(UnitVector3D other)

bool Equals(Vector3D other)

bool Equals(Vector3D other, double tolerance)

Returns a value to indicate if a pair of vectors are equal
Parameters
Vector3D other

The vector to compare against.

double tolerance

A tolerance (epsilon) to adjust for floating point error

Return
bool

True if the vectors are equal; otherwise false

bool Equals(UnitVector3D other, double tolerance)

Returns a value to indicate if a pair of vectors are equal
Parameters
UnitVector3D other

The vector to compare against.

double tolerance

A tolerance (epsilon) to adjust for floating point error

Return
bool

True if the vectors are equal; otherwise false

int GetHashCode()

Type GetType()

Matrix<double> GetUnitTensorProduct()

Returns a dense Matrix with the unit tensor product
Return
Matrix<double>

a dense matrix

bool IsParallelTo(Vector3D otherVector, Angle angleTolerance)

Determine whether or not this vector is parallel to a unit vector within a given angle tolerance.
Parameters
Vector3D otherVector

The other UnitVector3D

Angle angleTolerance

The tolerance for when the vectors are considered parallel.

Return
bool

true if the vectors are parallel within the angle tolerance, false if they are not

bool IsParallelTo(UnitVector3D otherVector, Angle angleTolerance)

Determine whether or not this vector is parallel to another vector within a given angle tolerance.
Parameters
UnitVector3D otherVector

The other Vector3D

Angle angleTolerance

The tolerance for when the vectors are considered parallel.

Return
bool

true if the vectors are parallel within the angle tolerance, false if they are not

bool IsParallelTo(UnitVector3D otherVector, double tolerance)

Computes whether or not this vector is parallel to a unit vector using the dot product method and comparing it to within a specified tolerance.
Parameters
UnitVector3D otherVector

The other UnitVector3D

double tolerance

A tolerance value for the dot product method. Values below 2*Precision.DoublePrecision may cause issues.

Return
bool

true if the vector dot product is within the given tolerance of unity, false if not

bool IsParallelTo(Vector3D otherVector, double tolerance)

Computes whether or not this vector is parallel to another vector using the dot product method and comparing it to within a specified tolerance.
Parameters
Vector3D otherVector

The other Vector3D

double tolerance

A tolerance value for the dot product method. Values below 2*Precision.DoublePrecision may cause issues.

Return
bool

true if the vector dot product is within the given tolerance of unity, false if it is not

bool IsPerpendicularTo(Vector3D othervector, double tolerance)

Computes whether or not this vector is perpendicular to another vector using the dot product method and comparing it to within a specified tolerance
Parameters
Vector3D othervector

The other Vector3D

double tolerance

A tolerance value for the dot product method. Values below 2*Precision.DoublePrecision may cause issues.

Return
bool

true if the vector dot product is within the given tolerance of zero, false if not

bool IsPerpendicularTo(UnitVector3D othervector, double tolerance)

Computes whether or not this vector is perpendicular to another vector using the dot product method and comparing it to within a specified tolerance
Parameters
UnitVector3D othervector

The other UnitVector3D

double tolerance

A tolerance value for the dot product method. Values below 2*Precision.DoublePrecision may cause issues.

Return
bool

true if the vector dot product is within the given tolerance of zero, false if not

UnitVector3D Negate()

Inverses the direction of the vector, equivalent to multiplying by -1
Return
UnitVector3D

A Vector3D pointing in the opposite direction.

Ray3D ProjectOn(Plane plane)

Project this instance onto the plane
Parameters
Plane plane

The plane to project on.

Return
Ray3D

The projected Ray3D

Vector3D ProjectOn(UnitVector3D uv)

Returns the Dot product of the current vector and a unit vector
Parameters
UnitVector3D uv

A unit vector

Return
Vector3D

Returns a new vector

UnitVector3D Rotate(UnitVector3D about, Angle angle)

Returns a vector that is this vector rotated the signed angle around the about vector
Parameters
UnitVector3D about

The vector to rotate around.

Angle angle

The angle positive according to right hand rule.

Return
UnitVector3D

A rotated vector.

Vector3D ScaleBy(double factor)

Scale this instance by factor
Parameters
double factor

The plane to project on.

Return
Vector3D

The projected Ray3D

Angle SignedAngleTo(Vector3D v, UnitVector3D about)

Returns signed angle
Parameters
Vector3D v

The vector to calculate the signed angle to

UnitVector3D about

The vector around which to rotate to get the correct sign

Return
Angle

A signed Angle

Angle SignedAngleTo(UnitVector3D v, UnitVector3D about)

Returns signed angle
Parameters
UnitVector3D v

The vector to calculate the signed angle to

UnitVector3D about

The vector around which to rotate to get the correct sign

Return
Angle

A signed Angle

Point3D ToPoint3D()

Returns a point equivalent to the vector
Return
Point3D

A point

string ToString()

string ToString(IFormatProvider provider)

Returns a string representation of this instance using the provided IFormatProvider
Parameters
IFormatProvider provider

A IFormatProvider

Return
string

The string representation of this instance.

string ToString(string format, IFormatProvider provider)

Vector<double> ToVector()

Convert to a Math.NET Numerics dense vector of length 3.
Return
Vector<double>

A dense vector

Vector3D ToVector3D()

Returns a Vector3D equivalent to this unit vector
Return
Vector3D

A vector

Vector3D TransformBy(CoordinateSystem coordinateSystem)

Transforms the vector by a coordinate system and returns the transformed.
Parameters
CoordinateSystem coordinateSystem

A coordinate system

Return
Vector3D

A new transformed vector

Vector3D TransformBy(Matrix<double> m)

Transforms a vector by multiplying it against a provided matrix
Parameters
Matrix<double> m

The matrix to multiply

Return
Vector3D

A new transformed vector

Public Properties

double Length get;

Gets the length of the vector not the count of elements

UnitVector3D Orthogonal get;

Gets a vector orthogonal to this

UnitVector3D XAxis get;

Gets the X axis

UnitVector3D YAxis get;

Gets the Y axis

UnitVector3D ZAxis get;

Gets the z Axis

Public fields

double X

The x component.
return double

double Y

The y component.
return double

double Z

The z component.
return double