NodeWorld

Vector4

La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.

csharp
public struct Vector4 : IEquatable<Vector4>, IFormattable

Namespace NodeWorld.Flux.

Four values, as Unity's Vector4: a point with w, a plane, shader data.

Constants

kEpsilon

csharp
public const float kEpsilon = 0.00001f

The tolerance of == and of normalized (0.00001).

Fields

x

csharp
public float x

The x component.

y

csharp
public float y

The y component.

z

csharp
public float z

The z component.

w

csharp
public float w

The w component.

Constructors

Vector4

csharp
public Vector4(float x, float y, float z, float w)

A vector of these components.

csharp
public Vector4(float x, float y, float z)

A vector of x, y and z, w at 0.

Properties

this[]

csharp
public float this[int index] { get; set; }

x, y, z, w by index 0 to 3.

zero

csharp
public static Vector4 zero { get; }

(0, 0, 0, 0).

one

csharp
public static Vector4 one { get; }

(1, 1, 1, 1).

magnitude

csharp
public float magnitude { get; }

Length of the vector.

sqrMagnitude

csharp
public float sqrMagnitude { get; }

Squared length.

normalized

csharp
public Vector4 normalized { get; }

The vector at length 1 (zero when it is too short).

Methods

Dot

csharp
public static float Dot(Vector4 a, Vector4 b)

Dot product.

Lerp

csharp
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

csharp
public static Vector4 Scale(Vector4 a, Vector4 b)

a and b multiplied component by component.

Equals

csharp
public bool Equals(Vector4 other)

The components are exactly equal.

csharp
public override bool Equals(object other)

other is a Vector4 with exactly the same components.

GetHashCode

csharp
public override int GetHashCode()

A hash of the components.

ToString

csharp
public override string ToString()

"(x, y, z, w)" with 2 decimals.

csharp
public string ToString(string format)

The same text with the numbers in format.

csharp
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 +

csharp
public static Vector4 operator +(Vector4 a, Vector4 b)

Sum.

operator -

csharp
public static Vector4 operator -(Vector4 a, Vector4 b)

Difference.

csharp
public static Vector4 operator -(Vector4 a)

The opposite vector.

operator *

csharp
public static Vector4 operator *(Vector4 a, float d)

Each component times d.

csharp
public static Vector4 operator *(float d, Vector4 a)

Each component times d.

operator /

csharp
public static Vector4 operator /(Vector4 a, float d)

Each component divided by d.

operator ==

csharp
public static bool operator ==(Vector4 lhs, Vector4 rhs)

Approximately equal: the squared distance is below 1e-10.

operator !=

csharp
public static bool operator !=(Vector4 lhs, Vector4 rhs)

Not approximately equal (see ==).

implicit operator Vector4

csharp
public static implicit operator Vector4(Vector3 v)

x, y, z of the vector, w at 0.

implicit operator Vector3

csharp
public static implicit operator Vector3(Vector4 v)

x, y, z of the vector.