math

package
v0.2.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mat4

type Mat4 [16]float32

Mat4 represents a 4x4 matrix in column-major order.

func Identity

func Identity() Mat4

Identity returns an identity matrix.

func Orthographic

func Orthographic(left, right, bottom, top, near, far float32) Mat4

Orthographic returns an orthographic projection matrix.

func Perspective

func Perspective(fovY, aspect, near, far float32) Mat4

Perspective returns a perspective projection matrix.

func Scale

func Scale(v Vec3) Mat4

Scale returns a scaling matrix for v.

func Translation

func Translation(v Vec3) Mat4

Translation returns a matrix translating by v.

func (Mat4) Mul

func (m Mat4) Mul(n Mat4) Mat4

Mul multiplies m by n and returns the result.

type Vec2

type Vec2 struct{ X, Y float32 }

Vec2 represents a 2D vector.

func (Vec2) Add

func (v Vec2) Add(o Vec2) Vec2

Add adds two vectors component-wise.

func (Vec2) Normalize

func (v Vec2) Normalize() Vec2

Normalize returns the unit vector in the same direction.

type Vec3

type Vec3 struct{ X, Y, Z float32 }

Vec3 represents a 3D vector.

func (Vec3) Add

func (v Vec3) Add(o Vec3) Vec3

Add adds two Vec3 values component-wise.

func (Vec3) Normalize

func (v Vec3) Normalize() Vec3

Normalize returns the unit vector of v.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL