Struct Vector4D
- Namespace
- Cobilas.GodotEngine.Utility.Numerics
- Assembly
- com.cobilas.godot.utility.dll
Represents a four-dimensional vector.(Four-axis vector)
[Serializable]
public struct Vector4D : IVectorGeneric<Vector4D>, IEquatable<Vector4D>, IVector, IFormattable
- Implements
- Inherited Members
Constructors
Vector4D(Quaternion)
Starts a new instance of the object.
public Vector4D(Quaternion vector)
Parameters
vector
Quaternion
Vector4D(Vector4D)
Starts a new instance of the object.
public Vector4D(Vector4D vector)
Parameters
vector
Vector4D
Vector4D(float, float)
Starts a new instance of the object.
public Vector4D(float x, float y)
Parameters
Vector4D(float, float, float)
Starts a new instance of the object.
public Vector4D(float x, float y, float z)
Parameters
Vector4D(float, float, float, float)
Starts a new instance of the object.
public Vector4D(float x, float y, float z, float w)
Parameters
Fields
w
W component of the vector.
public float w
Field Value
x
X component of the vector.
public float x
Field Value
y
Y component of the vector.
public float y
Field Value
z
Z component of the vector.
public float z
Field Value
Properties
AxisCount
Number of axles.
public readonly int AxisCount { get; }
Property Value
- int
Returns the number of axes a vector has.
this[int]
Allows you to access the axes of a vector through an index.
public float this[int index] { readonly get; set; }
Parameters
index
intThe axis index.
Property Value
- float
Sets the value of an axis by specifying its index.
Normalized
Returns the vector scaled to unit length. Equivalent to v / v.Length()
.
public readonly Vector4D Normalized { get; }
Property Value
- Vector4D
A normalized version of the vector.
One
Shorthand for writing Vector4(1,1,1,1).
public static Vector4D One { get; }
Property Value
Zero
Shorthand for writing Vector4(0,0,0,0).
public static Vector4D Zero { get; }
Property Value
aspect
public readonly float aspect { get; }
Property Value
ceil
Returns a new vector with all components rounded up (towards positive infinity).
public readonly Vector4D ceil { get; }
Property Value
- Vector4D
A vector with Ceil(float) called on each component.
floor
Returns a new vector with all components rounded down (towards negative infinity).
public readonly Vector4D floor { get; }
Property Value
- Vector4D
A vector with Floor(float) called on each component.
magnitude
Returns the length (magnitude) of this vector.
public readonly float magnitude { get; }
Property Value
- float
The length of this vector.
- See Also
-
LengthSquared()
sqrMagnitude
Returns the squared length (squared magnitude) of this vector. This method runs faster than magnitude, so prefer it if you need to compare vectors or need the squared length for some formula.
public readonly float sqrMagnitude { get; }
Property Value
- float
The squared length of this vector.
Methods
Abs(in Vector4D)
Returns an absolute value of the vector.
public static Vector4D Abs(in Vector4D a)
Parameters
a
Vector4DThe vector to become absolute.
Returns
- Vector4D
Returns the vector with its absolute value axes.
Abs(bool, bool, bool, bool)
Returns an absolute value of the vector.
public readonly Vector4D Abs(bool absX = true, bool absY = true, bool absZ = true, bool absW = true)
Parameters
absX
boolThe X axis becomes absolute.
absY
boolThe Y axis becomes absolute.
absZ
boolThe Z axis becomes absolute.
absW
boolThe W axis becomes absolute.
Returns
- Vector4D
Returns the vector with its absolute value axes.
Ceil(in Vector4D)
Returns a new vector with all components rounded up (towards positive infinity).
public static Vector4D Ceil(in Vector4D a)
Parameters
a
Vector4DThe vector that will be the ceiling.
Returns
- Vector4D
A vector with Ceil(float) called on each component.
Distance(in Vector4D, Vector4D)
Returns the distance between a and b.
public static float Distance(in Vector4D a, Vector4D b)
Parameters
Returns
- float
The distance between two vectors.
Dot(in Vector4D, in Vector4D)
Dot Product of two vectors.
public static float Dot(in Vector4D a, in Vector4D b)
Parameters
Returns
- float
returns the result of the dot product.
Equals(Vector4D)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(Vector4D other)
Parameters
other
Vector4DAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Floor(in Vector4D)
Returns a new vector with all components rounded down (towards negative infinity).
public static Vector4D Floor(in Vector4D a)
Parameters
a
Vector4DThe vector that will be the floor.
Returns
- Vector4D
A vector with Floor(float) called on each component.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
IsNormalized(in IVector)
Checks if the vector is normalized.
public static bool IsNormalized(in IVector a)
Parameters
a
IVectorThe vector to be checked.
Returns
- bool
Returns
true
when vector is normalized.
Magnitude(in Vector4D)
Returns the length of this vector
public static float Magnitude(in Vector4D a)
Parameters
a
Vector4DOne of the values.
Returns
- float
vector length.
Max(in Vector4D, in Vector4D)
Returns a vector that is made from the largest components of two vectors.
public static Vector4D Max(in Vector4D lhs, in Vector4D rhs)
Parameters
Returns
- Vector4D
Whichever of the two values is higher.
Min(in Vector4D, in Vector4D)
Returns a vector that is made from the smallest components of two vectors.
public static Vector4D Min(in Vector4D lhs, in Vector4D rhs)
Parameters
Returns
- Vector4D
Whichever of the two values is lower.
Neg(in Vector4D)
Inverts the values of a vector.
public static Vector4D Neg(in Vector4D a)
Parameters
a
Vector4DThe vector to be inverted.
Returns
- Vector4D
Returns the axes of an inverted vector.
Neg(bool, bool, bool, bool)
Inverts the values of a vector.
public readonly Vector4D Neg(bool negX = true, bool negY = true, bool negZ = true, bool negW = true)
Parameters
negX
boolThe X axis becomes inverted.
negY
boolThe Y axis becomes inverted.
negZ
boolThe Z axis becomes inverted.
negW
boolThe W axis becomes inverted.
Returns
- Vector4D
Returns the axes of an inverted vector.
Normalize(in Vector4D)
Makes this vector have a magnitude of 1.
public static Vector4D Normalize(in Vector4D a)
Parameters
a
Vector4DThe vector to be normalized.
Returns
- Vector4D
Returns the already normalized vector.
Round()
Returns this vector with all components rounded to the nearest integer, with halfway cases rounded towards the nearest multiple of two.
public readonly Vector4D Round()
Returns
- Vector4D
The rounded vector.
Round(in Vector4D)
Returns this vector with all components rounded to the nearest integer, with halfway cases rounded towards the nearest multiple of two.
public static Vector4D Round(in Vector4D a)
Parameters
a
Vector4Dthe vector to be rounded
Returns
- Vector4D
The rounded vector.
SqrMagnitude(in Vector4D)
Returns the squared length of this vector
public static float SqrMagnitude(in Vector4D a)
Parameters
a
Vector4DOne of the values.
Returns
- float
square length of the vector.
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
ToString(string)
Formats the value of the current instance using the specified format.
public readonly string ToString(string format)
Parameters
format
stringThe format to use.-or- A null reference (
Nothing
in Visual Basic) to use the default format defined for the type of the IFormattable implementation.
Returns
- string
The value of the current instance in the specified format.
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringThe format to use.-or- A null reference (
Nothing
in Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProvider
IFormatProviderThe provider to use to format the value.-or- A null reference (
Nothing
in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
Operators
operator +(Vector4D, Vector4D)
public static Vector4D operator +(Vector4D a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the addition.
operator /(Vector4D, Vector4D)
public static Vector4D operator /(Vector4D a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the division.
operator /(Vector4D, float)
public static Vector4D operator /(Vector4D a, float b)
Parameters
Returns
- Vector4D
The result of the division.
operator /(float, Vector4D)
public static Vector4D operator /(float a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the division.
operator ==(Vector4D, Vector4D)
Indicates whether this instance is equal to another instance of the same type.
public static bool operator ==(Vector4D A, Vector4D B)
Parameters
Returns
- bool
Returns the result of the comparison.
implicit operator Quaternion(Vector4D)
Implicit conversion operator.(Vector4D to Quaternion)
public static implicit operator Quaternion(Vector4D v)
Parameters
v
Vector4DObject to be converted.
Returns
implicit operator Vector2D(Vector4D)
public static implicit operator Vector2D(Vector4D v)
Parameters
v
Vector4DObject to be converted.
Returns
implicit operator Vector3D(Vector4D)
public static implicit operator Vector3D(Vector4D v)
Parameters
v
Vector4DObject to be converted.
Returns
implicit operator Vector2(Vector4D)
Implicit conversion operator.(Vector4D to Godot.Vector2)
public static implicit operator Vector2(Vector4D v)
Parameters
v
Vector4DObject to be converted.
Returns
- Vector2
implicit operator Vector3(Vector4D)
Implicit conversion operator.(Vector4D to Godot.Vector3)
public static implicit operator Vector3(Vector4D v)
Parameters
v
Vector4DObject to be converted.
Returns
- Vector3
implicit operator Vector4D(Vector2)
Implicit conversion operator.(Godot.Vector2 to Vector4D)
public static implicit operator Vector4D(Vector2 v)
Parameters
v
Vector2Object to be converted.
Returns
implicit operator Vector4D(Vector3)
Implicit conversion operator.(Godot.Vector3 to Vector4D)
public static implicit operator Vector4D(Vector3 v)
Parameters
v
Vector3Object to be converted.
Returns
operator !=(Vector4D, Vector4D)
Indicates whether this instance is different from another instance of the same type.
public static bool operator !=(Vector4D A, Vector4D B)
Parameters
Returns
- bool
Returns the result of the comparison.
operator *(Vector4D, Vector4D)
public static Vector4D operator *(Vector4D a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the multiplication.
operator *(Vector4D, float)
public static Vector4D operator *(Vector4D a, float b)
Parameters
Returns
- Vector4D
The result of the multiplication.
operator *(float, Vector4D)
public static Vector4D operator *(float a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the multiplication.
operator -(Vector4D, Vector4D)
public static Vector4D operator -(Vector4D a, Vector4D b)
Parameters
Returns
- Vector4D
The result of the subtraction.
operator -(Vector4D)
The operator allows us to reverse the value.
public static Vector4D operator -(Vector4D a)
Parameters
a
Vector4DOr value that will be invested.
Returns
- Vector4D
Returns the result of the inversion.