Struct GlobalPosition
A vector3 representation that supports double precision.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[Serializable]
public struct GlobalPosition
Constructors
GlobalPosition(double, double, double, GlobalPosition)
Creates a new three dimensional double vector from the specified components, shifted by the specified shift offset.
Declaration
public GlobalPosition(double x, double y, double z, GlobalPosition offset)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x component of the vector. |
double | y | The y component of the vector. |
double | z | The z component of the vector. |
GlobalPosition | offset | The shift offset to apply in the conversion. |
GlobalPosition(double, double, double)
Initializes a new instance of the GlobalPosition class.
Declaration
public GlobalPosition(double x, double y, double z)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x-value. |
double | y | The y-value. |
double | z | The z-value. |
GlobalPosition(Vector3, GlobalPosition)
Creates a new three dimensional double vector from the specified float vector, shifted by the specified shift offset.
Declaration
public GlobalPosition(Vector3 value, GlobalPosition offset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The vector to convert to a double vector. |
GlobalPosition | offset | The shift offset to apply in the conversion. |
GlobalPosition(Vector3)
Creates a new three dimensional double vector from the specified float vector.
Declaration
public GlobalPosition(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The vector to convert to a double vector. |
Fields
ShiftOffset
The shift offset.
Declaration
public static GlobalPosition ShiftOffset
Field Value
Type | Description |
---|---|
GlobalPosition |
X
The x-value.
Declaration
public double X
Field Value
Type | Description |
---|---|
double |
Y
The y-value.
Declaration
public double Y
Field Value
Type | Description |
---|---|
double |
Z
The z-value.
Declaration
public double Z
Field Value
Type | Description |
---|---|
double |
Zero
The zero vector.
Declaration
public static readonly GlobalPosition Zero
Field Value
Type | Description |
---|---|
GlobalPosition |
Properties
Length
Gets the length.
Declaration
public double Length { get; }
Property Value
Type | Description |
---|---|
double |
SquaredLength
Gets the squared length.
Declaration
public double SquaredLength { get; }
Property Value
Type | Description |
---|---|
double |
Methods
Create(double, double, double)
Creates a new three dimensional double vector from the specified components.
Declaration
public static GlobalPosition Create(double x, double y, double z)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x component of the vector. |
double | y | The y component of the vector. |
double | z | The z component of the vector. |
Returns
Type | Description |
---|---|
GlobalPosition | A new double vector. |
Create(Vector3)
Creates a new three dimensional double vector from the specified float vector.
Declaration
public static GlobalPosition Create(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The vector to convert to a double vector. |
Returns
Type | Description |
---|---|
GlobalPosition | A new double vector. |
DeltaAsVector2XZ(GlobalPosition, GlobalPosition)
Computes the delta vector between two vectors and returns the resulting X and Z components in float precision.
Declaration
public static Vector2 DeltaAsVector2XZ(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The minuend. |
GlobalPosition | b | The subtrahend. |
Returns
Type | Description |
---|---|
Vector2 | The difference. |
DeltaAsVector3(GlobalPosition, GlobalPosition)
Computes the delta vector between two vectors and returns the result in float precision.
Declaration
public static Vector3 DeltaAsVector3(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The minuend. |
GlobalPosition | b | The subtrahend. |
Returns
Type | Description |
---|---|
Vector3 | The difference. |
Direction(GlobalPosition, GlobalPosition)
Computes the direction.
Declaration
public static Vector3 Direction(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector. |
GlobalPosition | b | The second vector. |
Returns
Type | Description |
---|---|
Vector3 | The direction vector with a length of 1. |
Distance(GlobalPosition, GlobalPosition)
Computes the distance between two vectors.
Declaration
public static double Distance(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first position. |
GlobalPosition | b | The second position. |
Returns
Type | Description |
---|---|
double | The distance. |
Dot(GlobalPosition, GlobalPosition)
The dot product of two Vector3Double.
Declaration
public static double Dot(GlobalPosition lhs, GlobalPosition rhs)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | lhs | Left hand side vector. |
GlobalPosition | rhs | Right hand side vector. |
Returns
Type | Description |
---|---|
double | The dot product. |
Equals(GlobalPosition)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GlobalPosition other)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
FromShifted(double, double, double, GlobalPosition)
Creates a new three dimensional double vector from the specified components, from shifted space defined by the specified shift offset.
Declaration
public static GlobalPosition FromShifted(double x, double y, double z, GlobalPosition offset)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x component of the vector. |
double | y | The y component of the vector. |
double | z | The z component of the vector. |
GlobalPosition | offset | The shift offset to apply in the conversion. |
Returns
Type | Description |
---|---|
GlobalPosition | A new un-shifted double vector. |
FromShifted(double, double, double)
Creates a new three dimensional double vector from the specified components, from shifted space defined by the global shift offset.
Declaration
public static GlobalPosition FromShifted(double x, double y, double z)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x component of the vector. |
double | y | The y component of the vector. |
double | z | The z component of the vector. |
Returns
Type | Description |
---|---|
GlobalPosition | A new un-shifted double vector. |
FromShifted(Vector3, GlobalPosition)
Creates a new three dimensional double vector from the specified float vector, from shifted space defined by the specified shift offset.
Declaration
public static GlobalPosition FromShifted(Vector3 value, GlobalPosition offset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The vector to convert to a double vector. |
GlobalPosition | offset | The shift offset to apply in the conversion. |
Returns
Type | Description |
---|---|
GlobalPosition | A new un-shifted double vector. |
FromShifted(Vector3)
Creates a new three dimensional double vector from the specified float vector, from shifted space defined by the global shift offset.
Declaration
public static GlobalPosition FromShifted(Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The vector to convert to a double vector. |
Returns
Type | Description |
---|---|
GlobalPosition | A new un-shifted double vector. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
Lerp(GlobalPosition, GlobalPosition, double)
Lerps between two Vector3Doubles.
Declaration
public static GlobalPosition Lerp(GlobalPosition a, GlobalPosition b, double t)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector. |
GlobalPosition | b | The second vector. |
double | t | The lerp ratio. |
Returns
Type | Description |
---|---|
GlobalPosition | The lerped Vector3Double. |
SqrDistance(GlobalPosition, GlobalPosition)
Computes the squared distance between two vectors. Squared distances are faster to compute than distances while still providing comparability.
Declaration
public static double SqrDistance(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first position. |
GlobalPosition | b | The second position. |
Returns
Type | Description |
---|---|
double | The squared distance. |
ToShiftedVector2XZ()
Converts this double precision vector to single point precision shifted space using the global shift offset.
Declaration
public Vector2 ToShiftedVector2XZ()
Returns
Type | Description |
---|---|
Vector2 | The shifted floating point precision vector. |
ToShiftedVector3()
Converts this double precision vector to single point precision shifted space using the global shift offset.
Declaration
public Vector3 ToShiftedVector3()
Returns
Type | Description |
---|---|
Vector3 | The shifted floating point precision vector. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
ToYMinusZX()
Converts the vector components.
- x -> y
- y -> -z
- z -> x
Declaration
public GlobalPosition ToYMinusZX()
Returns
Type | Description |
---|---|
GlobalPosition | The converted vector. |
ToZXMinusY()
Converts the vector components.
- x -> z
- y -> x
- z -> -y
Declaration
public GlobalPosition ToZXMinusY()
Returns
Type | Description |
---|---|
GlobalPosition | The converted vector. |
Operators
operator +(GlobalPosition, GlobalPosition)
Adds two Vector3Doubles.
Declaration
public static GlobalPosition operator +(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector. |
GlobalPosition | b | The second vector. |
Returns
Type | Description |
---|---|
GlobalPosition | The sum of a and b. |
operator +(GlobalPosition, Vector3)
Adds a Vector3 to a Vector3Double.
Declaration
public static GlobalPosition operator +(GlobalPosition a, Vector3 b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector as Vector3Double. |
Vector3 | b | The second vector as Vector3. |
Returns
Type | Description |
---|---|
GlobalPosition | The sum of a and b. |
operator /(GlobalPosition, double)
Scales a vector by a divisor.
Declaration
public static GlobalPosition operator /(GlobalPosition v, double divisor)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | v | The vector to scale. |
double | divisor | The scale divisor. |
Returns
Type | Description |
---|---|
GlobalPosition | The scaled vector. |
operator ==(GlobalPosition, GlobalPosition)
Declaration
public static bool operator ==(GlobalPosition left, GlobalPosition right)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | left | |
GlobalPosition | right |
Returns
Type | Description |
---|---|
bool |
operator !=(GlobalPosition, GlobalPosition)
Declaration
public static bool operator !=(GlobalPosition left, GlobalPosition right)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | left | |
GlobalPosition | right |
Returns
Type | Description |
---|---|
bool |
operator *(GlobalPosition, GlobalPosition)
Multiplies two Vector3Doubles.
Declaration
public static GlobalPosition operator *(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector. |
GlobalPosition | b | The second vector. |
Returns
Type | Description |
---|---|
GlobalPosition | The product of a multiplied by b. |
operator *(GlobalPosition, double)
Scales a vector by a factor.
Declaration
public static GlobalPosition operator *(GlobalPosition v, double factor)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | v | The vector to scale. |
double | factor | The scale factor. |
Returns
Type | Description |
---|---|
GlobalPosition | The scaled vector. |
operator -(GlobalPosition, GlobalPosition)
Subtracts two Vector3Doubles.
Declaration
public static GlobalPosition operator -(GlobalPosition a, GlobalPosition b)
Parameters
Type | Name | Description |
---|---|---|
GlobalPosition | a | The first vector. |
GlobalPosition | b | The second vector. |
Returns
Type | Description |
---|---|
GlobalPosition | The subtraction of a minus b. |