Vector4
public struct Vector4 : IEquatable<Vector4>, IFormattableNamespace NodeWorld.Flux.
Four values, as Unity's Vector4: a point with w, a plane, shader data.
Constants
kEpsilon
public const float kEpsilon = 0.00001fThe tolerance of == and of normalized (0.00001).
Fields
x
public float xThe x component.
y
public float yThe y component.
z
public float zThe z component.
w
public float wThe w component.
Constructors
Vector4
public Vector4(float x, float y, float z, float w)A vector of these components.
public Vector4(float x, float y, float z)A vector of x, y and z, w at 0.
Properties
this[]
public float this[int index] { get; set; }x, y, z, w by index 0 to 3.
zero
public static Vector4 zero { get; }(0, 0, 0, 0).
one
public static Vector4 one { get; }(1, 1, 1, 1).
magnitude
public float magnitude { get; }Length of the vector.
sqrMagnitude
public float sqrMagnitude { get; }Squared length.
normalized
public Vector4 normalized { get; }The vector at length 1 (zero when it is too short).
Methods
Dot
public static float Dot(Vector4 a, Vector4 b)Dot product.
Lerp
public static Vector4 Lerp(Vector4 a, Vector4 b, float t)From a (t = 0) to b (t = 1); t is kept between 0 and 1.
Scale
public static Vector4 Scale(Vector4 a, Vector4 b)a and b multiplied component by component.
Equals
public bool Equals(Vector4 other)The components are exactly equal.
public override bool Equals(object other)other is a Vector4 with exactly the same components.
GetHashCode
public override int GetHashCode()A hash of the components.
ToString
public override string ToString()"(x, y, z, w)" with 2 decimals.
public string ToString(string format)The same text with the numbers in format.
public string ToString(string format, IFormatProvider formatProvider)The same text with the numbers in format (F2 when empty) and formatProvider (the invariant culture when null).
Operators
operator +
public static Vector4 operator +(Vector4 a, Vector4 b)Sum.
operator -
public static Vector4 operator -(Vector4 a, Vector4 b)Difference.
public static Vector4 operator -(Vector4 a)The opposite vector.
operator *
public static Vector4 operator *(Vector4 a, float d)Each component times d.
public static Vector4 operator *(float d, Vector4 a)Each component times d.
operator /
public static Vector4 operator /(Vector4 a, float d)Each component divided by d.
operator ==
public static bool operator ==(Vector4 lhs, Vector4 rhs)Approximately equal: the squared distance is below 1e-10.
operator !=
public static bool operator !=(Vector4 lhs, Vector4 rhs)Not approximately equal (see ==).
implicit operator Vector4
public static implicit operator Vector4(Vector3 v)x, y, z of the vector, w at 0.
implicit operator Vector3
public static implicit operator Vector3(Vector4 v)x, y, z of the vector.
