Struct Vector3
Three element vector, typically used to describe
a position, normal or euler rotation.
Assembly: ABB.Robotics.Math.dll
Syntax
Constructors
View Source
Vector3(Axis)
Creates a unit vector from an axis
Declaration
public Vector3(Axis axis)
Parameters
| Type |
Name |
Description |
| Axis |
axis |
axis
|
Exceptions
View Source
Vector3(Vector4)
Creates a vector from a 4-vector, truncating the last element.
Declaration
public Vector3(Vector4 vec)
Parameters
View Source
Vector3(Vector4, bool)
Creates a vector from a homogenous 4-vector.
Declaration
public Vector3(Vector4 vec, bool scale)
Parameters
| Type |
Name |
Description |
| Vector4 |
vec |
|
| bool |
scale |
Rescale from homegenous coordinates
|
View Source
Vector3(double, double, double)
Creates a vector from three doubles.
Declaration
public Vector3(double x0, double y0, double z0)
Parameters
View Source
Vector3(double[])
Creates a vector from an array of doubles.
Declaration
public Vector3(double[] vec)
Parameters
| Type |
Name |
Description |
| double[] |
vec |
|
Fields
View Source
XVector
Unit vector in the x direction.
Declaration
public static readonly Vector3 XVector
Field Value
View Source
YVector
Unit vector in the y direction.
Declaration
public static readonly Vector3 YVector
Field Value
View Source
ZVector
Unit vector in the z direction.
Declaration
public static readonly Vector3 ZVector
Field Value
View Source
ZeroVector
Declaration
public static readonly Vector3 ZeroVector
Field Value
View Source
x
Declaration
Field Value
View Source
y
Declaration
Field Value
View Source
z
Declaration
Field Value
Properties
View Source
IsNaN
Returns a value indicating whether any elements evaluates to a value that is not a number (NaN).
Declaration
public bool IsNaN { get; }
Property Value
View Source
this[int]
Declaration
public double this[int index] { get; set; }
Parameters
| Type |
Name |
Description |
| int |
index |
|
Property Value
Methods
View Source
Add(Vector3)
Element-wise addition method.
Declaration
public Vector3 Add(Vector3 rhs)
Parameters
Returns
View Source
AlmostEquals(Vector3)
Comparison method for vectors with tolerance (EPS)
Declaration
public bool AlmostEquals(Vector3 vec)
Parameters
| Type |
Name |
Description |
| Vector3 |
vec |
Vector to compare with
|
Returns
| Type |
Description |
| bool |
true if equals within tolerance
|
View Source
AlmostEquals(Vector3, double)
Comparison method for vectors with tolerance
Declaration
public bool AlmostEquals(Vector3 vec, double tolerance)
Parameters
| Type |
Name |
Description |
| Vector3 |
vec |
Vector to compare with
|
| double |
tolerance |
Tolerance to use in the comparison
|
Returns
| Type |
Description |
| bool |
true if equals within tolerance
|
View Source
Angle(Vector3)
Angle between this and a vector.
Declaration
public double Angle(Vector3 vec)
Parameters
Returns
| Type |
Description |
| double |
radians
|
View Source
Angle(Vector3, Vector3)
Angle betsween this and a vector signed depending on rotation direction.
Declaration
public double Angle(Vector3 vec, Vector3 refVec)
Parameters
Returns
| Type |
Description |
| double |
radians
|
View Source
Cross(Vector3)
Declaration
public Vector3 Cross(Vector3 vec)
Parameters
Returns
View Source
Distance(Vector3)
Returns the distance between this and a vector.
Declaration
public double Distance(Vector3 vec)
Parameters
Returns
View Source
Divide(double)
Vector scalar division method.
Declaration
public Vector3 Divide(double rhs)
Parameters
| Type |
Name |
Description |
| double |
rhs |
|
Returns
View Source
Dot(Vector3)
Declaration
public double Dot(Vector3 vec)
Parameters
Returns
View Source
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
View Source
Length()
Returns the length of this.
Declaration
Returns
View Source
LinearInterpolate(Vector3, double)
Linear interpolation between this and a vector.
Declaration
public Vector3 LinearInterpolate(Vector3 vec, double lerp)
Parameters
| Type |
Name |
Description |
| Vector3 |
vec |
Second vector
|
| double |
lerp |
Interpolation parameter
|
Returns
| Type |
Description |
| Vector3 |
Interpolated vector
|
View Source
Multiply(double)
Vector-scalar multiplication method.
Declaration
public Vector3 Multiply(double rhs)
Parameters
| Type |
Name |
Description |
| double |
rhs |
|
Returns
View Source
Normal()
Returns a unit vector normal to this
Declaration
Returns
View Source
Normalize()
Ensures that the length of this is 1.
Declaration
View Source
Normalized()
Returns a vector with the same direction as this, but with length 1
Declaration
public Vector3 Normalized()
Returns
View Source
Parse(string)
Converts the string representation to its Vector3 equivalent.
Declaration
public static Vector3 Parse(string value)
Parameters
| Type |
Name |
Description |
| string |
value |
|
Returns
View Source
Converts the string representation to its Vector3 equivalent.
Declaration
public static Vector3 Parse(string value, IFormatProvider formatProvider)
Parameters
Returns
View Source
Rotate(Vector3, double)
Returns a vector that is this vector rotated around an axis.
Declaration
public Vector3 Rotate(Vector3 axis, double angle)
Parameters
| Type |
Name |
Description |
| Vector3 |
axis |
Rotation axis
|
| double |
angle |
Rotation angle
|
Returns
| Type |
Description |
| Vector3 |
Rotated vector
|
View Source
SphericalInterpolate(Vector3, double)
Spherical interpolation between this and a vector.
Declaration
public Vector3 SphericalInterpolate(Vector3 vec, double lerp)
Parameters
| Type |
Name |
Description |
| Vector3 |
vec |
Second vector
|
| double |
lerp |
Interpolation parameter
|
Returns
| Type |
Description |
| Vector3 |
Interpolated vector
|
View Source
SquareDistance(Vector3)
Returns the squared distance between this and a vector.
Declaration
public double SquareDistance(Vector3 vec)
Parameters
Returns
View Source
SquareLength()
Returns the squared length of this.
Declaration
public double SquareLength()
Returns
View Source
Subtract(Vector3)
Element-wise subtraction method.
Declaration
public Vector3 Subtract(Vector3 rhs)
Parameters
Returns
View Source
ToArray()
Returns the elements (x,y,z) as an array
Declaration
public double[] ToArray()
Returns
View Source
ToString()
Returns a string in the format
[x y z]
Declaration
public override string ToString()
Returns
Overrides
View Source
Returns a string in the format
[x y z]
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Returns
View Source
ToString(int, string)
Returns a string in the format x y z with a specified number of decimals
and separator between the elements.
Declaration
public string ToString(int numDecimals, string separator)
Parameters
| Type |
Name |
Description |
| int |
numDecimals |
|
| string |
separator |
|
Returns
View Source
Returns a string in the format x y z with a specified number of decimals
and separator between the elements.
Declaration
public string ToString(int numDecimals, string separator, IFormatProvider formatProvider)
Parameters
Returns
View Source
Transforms a point between coordinate systems.
Declaration
public Vector3 TransformPoint(Matrix4 from, Matrix4 to)
Parameters
Returns
| Type |
Description |
| Vector3 |
Point in the "to" system
|
View Source
Transforms a vector between coordinate systems.
Declaration
public Vector3 TransformVector(Matrix4 from, Matrix4 to)
Parameters
Returns
| Type |
Description |
| Vector3 |
Vector in the "to" system
|
View Source
TryParse(string, out Vector3)
Converts the string representation to its Vector3 equivalent.
Declaration
public static bool TryParse(string value, out Vector3 result)
Parameters
Returns
| Type |
Description |
| bool |
A value indicating whether the conversion succeeded
|
View Source
Converts the string representation to its Vector3 equivalent.
Declaration
public static bool TryParse(string value, IFormatProvider formatProvider, out Vector3 result)
Parameters
Returns
| Type |
Description |
| bool |
A value indicating whether the conversion succeeded
|
View Source
Converts the string representation to its Vector3 equivalent
for a string with a specified separator between the elements.
Declaration
public static bool TryParse(string value, IFormatProvider formatProvider, string separator, out Vector3 result)
Parameters
Returns
| Type |
Description |
| bool |
A value indicating whether the conversion succeeded
|
View Source
WithX(double)
Creates a new vector from this with the x element set to a new value.
Declaration
public Vector3 WithX(double value)
Parameters
| Type |
Name |
Description |
| double |
value |
|
Returns
View Source
WithY(double)
Creates a new vector from this with the x element set to a new value.
Declaration
public Vector3 WithY(double value)
Parameters
| Type |
Name |
Description |
| double |
value |
|
Returns
View Source
WithZ(double)
Creates a new vector from this with the x element set to a new value.
Declaration
public Vector3 WithZ(double value)
Parameters
| Type |
Name |
Description |
| double |
value |
|
Returns
Operators
View Source
operator +(Vector3, Vector3)
Element-wise addition operator.
Declaration
public static Vector3 operator +(Vector3 lhs, Vector3 rhs)
Parameters
Returns
View Source
operator /(Vector3, double)
Vector-scalar division operator.
Declaration
public static Vector3 operator /(Vector3 lhs, double rhs)
Parameters
Returns
View Source
operator ==(Vector3, Vector3)
Declaration
public static bool operator ==(Vector3 lhs, Vector3 rhs)
Parameters
Returns
View Source
explicit operator Vector3(double[])
Array to vector conversion.
Declaration
public static explicit operator Vector3(double[] arg)
Parameters
| Type |
Name |
Description |
| double[] |
arg |
|
Returns
View Source
operator !=(Vector3, Vector3)
Declaration
public static bool operator !=(Vector3 lhs, Vector3 rhs)
Parameters
Returns
View Source
operator *(Vector3, double)
Vector-scalar multiplication operator.
Declaration
public static Vector3 operator *(Vector3 lhs, double rhs)
Parameters
Returns
View Source
operator *(double, Vector3)
Scalar-Vector multiplication operator.
Declaration
public static Vector3 operator *(double lhs, Vector3 rhs)
Parameters
Returns
View Source
operator -(Vector3, Vector3)
Element-wise subtraction operator.
Declaration
public static Vector3 operator -(Vector3 lhs, Vector3 rhs)
Parameters
Returns
View Source
operator -(Vector3)
Declaration
public static Vector3 operator -(Vector3 arg)
Parameters
Returns