Skip to main content

Module math

Module math 

Source
Expand description

§game-gem Math

A comprehensive 2D/3D math library built on glam with game-specific extensions.

Re-exports all necessary glam types and adds:

  • Rect — axis-aligned rectangle with intersection/containment helpers
  • Transform — 2D transform (position, rotation, scale) with hierarchy support
  • Lerp trait — generic linear interpolation
  • Angle — type-safe angle wrapper (radians, degrees)

Modules§

consts
Common constants.

Structs§

Angle
A type-safe angle that stores radians internally but provides construction and conversion in both radians and degrees.
Mat4
A 4x4 column major matrix.
Quat
A quaternion representing an orientation.
Rect
An axis-aligned rectangle defined by its top-left corner, width, and height.
Transform
A 2D transform representing position, rotation, and scale.
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.

Traits§

FloatExt
Extension trait for f32 with game-oriented helpers.
Lerp
Types that can be linearly interpolated.
Vec2Ext
Extension trait for Vec2 with game-oriented helpers.

Functions§

ivec2
Shorthand: ivec2(x, y)
vec2
Shorthand: vec2(x, y)
vec3
Shorthand: vec3(x, y, z)