Skip to content

Matrix4

Namespace: Hex1b.Scene.Math

Assembly: Hex1b.dll

A 4x4 matrix for 3D transformations (position, rotation, scale, projection). Row-major layout: elements[row, col]

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

Implements

Constructors

Matrix4()

csharp
public Matrix4()

Matrix4(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)

Parameters:

csharp
public Matrix4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)

Matrix4(float[])

Parameters:

csharp
public Matrix4(float[] elements)

Properties

IdentityMatrix

Returns: Matrix4

csharp
public static Matrix4 IdentityMatrix { get; }

Methods

Determinant()

Returns: Single

csharp
public float Determinant()

Equals(Matrix4)

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

Parameters:

  • other (Matrix4): 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(Matrix4 other)

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)

Get(int, int)

Parameters:

Returns: Single

csharp
public float Get(int row, int col)

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()

Identity()

csharp
public void Identity()

Inverse()

Returns: Matrix4

csharp
public Matrix4 Inverse()

Orthographic(float, float, float, float, float, float)

Create an orthographic projection matrix.

Parameters:

Returns: Matrix4

csharp
public static Matrix4 Orthographic(float left, float right, float bottom, float top, float near, float far)

Perspective(float, float, float, float)

Create a perspective projection matrix.

Parameters:

Returns: Matrix4

csharp
public static Matrix4 Perspective(float fovRadians, float aspect, float near, float far)

RotationX(float)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 RotationX(float radians)

RotationY(float)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 RotationY(float radians)

RotationZ(float)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 RotationZ(float radians)

Scale(Vector3)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 Scale(Vector3 s)

Set(int, int, float)

Parameters:

csharp
public void Set(int row, int col, float value)

Translation(Vector3)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 Translation(Vector3 t)

Transposed()

Returns: Matrix4

csharp
public Matrix4 Transposed()

Members

operator *(Matrix4, Matrix4)

Parameters:

Returns: Matrix4

csharp
public static Matrix4 operator *(Matrix4 a, Matrix4 b)

operator *(Matrix4, Vector4)

Parameters:

Returns: Vector4

csharp
public static Vector4 operator *(Matrix4 m, Vector4 v)

Released under the MIT License.