Vector3d

struct in Clatter.Core

A partial implementation of a non-Unity Vector3 that uses doubles. Source: Vector3d.cs

Properties

Name Type Description Get/Set
X double The x coordinate. get set
Y double The y coordinate. get set
Z double The z coordinate. get set
Magnitude double The magnitude of the vector. get
SqrMagnitude double The square root magnitude. get
Zero Vector3d Vector (0, 0, 0). get

Static Methods

Distance

public static double Distance(Vector3d a, Vector3d b)

Returns the distance between two vectors.

Name Type Description
a Vector3d The first vector.
b Vector3d The second vector.

operator+

public static void operator+(Vector3d a, Vector3d b)

Vector addition.

Name Type Description
a Vector3d The first vector.
b Vector3d The second vector.

operator-

public static void operator-(Vector3d a, Vector3d b)

Vector subtraction.

Name Type Description
a Vector3d The first vector.
b Vector3d The second vector.

operator-

public static void operator-(Vector3d v)

Vector negation.

Name Type Description
v Vector3d The vector.

operator*

public static void operator*(Vector3d v, double d)

Vector multiplication.

Name Type Description
v Vector3d The vector.
d double The scalar.

operator*

public static void operator*(double d, Vector3d v)

Vector multiplication.

Name Type Description
d double The scalar.
v Vector3d The vector.

operator/

public static void operator/(Vector3d v, double d)

Vector division.

Name Type Description
v Vector3d The vector.
d double The scalar.

operator==

public static bool operator==(Vector3d a, Vector3d b)

Vector equality.

Name Type Description
a Vector3d The first vector.
b Vector3d The second vector.

operator!=

public static bool operator!=(Vector3d a, Vector3d b)

Vector inequality.

Name Type Description
a Vector3d The first vector.
b Vector3d The second vector.

Methods

Vector3d

public Vector3d(double x, double y, double z)

Name Type Description
x double The x coordinate.
y double The y coordinate.
z double The z coordinate.

Vector3d

public Vector3d(double[] vector)

Name Type Description
vector double[] The vector. We assume this has exactly 3 elements.

ToString

public override string ToString()

Stringifies this vector.

Normalize

public void Normalize()

Normalize this vector.

CopyTo

public void CopyTo(Vector3d v)

Copy another Vector3d into this one. This is faster than using the = operator to set a new value.

Name Type Description
v Vector3d The other Vector3d.

Equals

public override bool Equals(object other)

Equality comparison.

Name Type Description
other object The other object.

GetHashCode

public override int GetHashCode()

Returns the hashcode.