Skip to content

Vector3

Namespace: Hex1b.Scene.Math

Assembly: Hex1b.dll

A 3D vector with x, y, z components for 3D coordinate space.

csharp
[Experimental("HEX1B_SCENE", UrlFormat = "https://github.com/hex1b/hex1b/blob/main/docs/experimental/scene.md")]
public struct Vector3 : IEquatable<Vector3>

Implements

Constructors

Vector3(float, float, float)

Parameters:

csharp
public Vector3(float x = 0, float y = 0, float z = 0)

Properties

Magnitude

Returns: Single

csharp
public float Magnitude { get; }

Normalized

Returns: Vector3

csharp
public Vector3 Normalized { get; }

One

Returns: Vector3

csharp
public static Vector3 One { get; }

SqrMagnitude

Returns: Single

csharp
public float SqrMagnitude { get; }

UnitX

Returns: Vector3

csharp
public static Vector3 UnitX { get; }

UnitY

Returns: Vector3

csharp
public static Vector3 UnitY { get; }

UnitZ

Returns: Vector3

csharp
public static Vector3 UnitZ { get; }

X

Returns: Single

csharp
public float X { readonly get; set; }

Y

Returns: Single

csharp
public float Y { readonly get; set; }

Z

Returns: Single

csharp
public float Z { readonly get; set; }

Zero

Returns: Vector3

csharp
public static Vector3 Zero { get; }

Methods

Cross(Vector3, Vector3)

Cross product of two vectors (right-hand rule).

Parameters:

Returns: Vector3

csharp
public static Vector3 Cross(Vector3 a, Vector3 b)

Distance(Vector3, Vector3)

Euclidean distance between two points.

Parameters:

Returns: Single

csharp
public static float Distance(Vector3 a, Vector3 b)

Dot(Vector3, Vector3)

Dot product of two vectors.

Parameters:

Returns: Single

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

Equals(object?)

Indicates whether this instance and a specified object are equal.

Parameters:

  • obj (Object): The object to compare with the current instance.

Returns: Boolean

true if obj and this instance are the same type and represent the same value; otherwise, false.

csharp
public override bool Equals(object? obj)

Equals(Vector3)

Indicates whether the current object is equal to another object of the same type.

Parameters:

  • other (Vector3): An object to compare with this object.

Returns: Boolean

true if the current object is equal to the other parameter; otherwise, false.

csharp
public bool Equals(Vector3 other)

GetHashCode()

Returns the hash code for this instance.

Returns: Int32

A 32-bit signed integer that is the hash code for this instance.

csharp
public override int GetHashCode()

Lerp(Vector3, Vector3, float)

Linear interpolation between two vectors.

Parameters:

Returns: Vector3

csharp
public static Vector3 Lerp(Vector3 a, Vector3 b, float t)

ToString()

Returns the fully qualified type name of this instance.

Returns: String

The fully qualified type name.

csharp
public override string ToString()

Members

operator -(Vector3, Vector3)

Parameters:

Returns: Vector3

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

operator -(Vector3)

Parameters:

Returns: Vector3

csharp
public static Vector3 operator -(Vector3 v)

operator *(float, Vector3)

Parameters:

Returns: Vector3

csharp
public static Vector3 operator *(float scalar, Vector3 v)

operator *(Vector3, float)

Parameters:

Returns: Vector3

csharp
public static Vector3 operator *(Vector3 v, float scalar)

operator /(Vector3, float)

Parameters:

Returns: Vector3

csharp
public static Vector3 operator /(Vector3 v, float scalar)

operator +(Vector3, Vector3)

Parameters:

Returns: Vector3

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

Released under the MIT License.