RMath.clamp(value, min, max: Float32) -> Float32
Clamp value to [min, max].
val c = RMath.clamp(x, Float32(0.0), Float32(1.0))
All 143 raymath functions as idiomatic Iron methods on Vector2/3/4, Matrix, Quaternion + scalar helpers.
All 143 raymath functions bound as idiomatic Iron methods on Vector2 / Vector3 / Vector4, Matrix, Quaternion, plus RMath.* scalar helpers.
RMath.clamp(value, min, max: Float32) -> Float32Clamp value to [min, max].
val c = RMath.clamp(x, Float32(0.0), Float32(1.0))
RMath.lerp(start, end, amount: Float32) -> Float32Linear interpolation: start + (end - start) * amount.
val mid = RMath.lerp(Float32(0.0), Float32(10.0), Float32(0.5))
RMath.normalize(value, start, end: Float32) -> Float32Inverse lerp — map value in [start, end] to [0, 1].
val t = RMath.normalize(x, Float32(0.0), Float32(10.0))
RMath.wrap(value, min, max: Float32) -> Float32 / remap(value, in_start, in_end, out_start, out_end) / float_equals(x, y)Wrap around a range; remap between ranges; epsilon-aware equality.
val w = RMath.wrap(angle, Float32(-3.14159), Float32(3.14159))
Vector2.zero() / Vector2.one() -> Vector2Origin / ones vectors.
val o = Vector2.zero()
Vector2.add / subtract / multiply / divide(v, other) -> Vector2Component-wise arithmetic.
val sum = Vector2.add(a, b)
Vector2.add_value / subtract_value(v, scalar: Float32) -> Vector2Scalar broadcast add/subtract.
val shifted = Vector2.add_value(v, Float32(1.0))
Vector2.scale(v, scale: Float32) / negate(v) / invert(v) -> Vector2Scalar multiply, component negate, reciprocal.
val s = Vector2.scale(v, Float32(2.0))
Vector2.length(v) / length_sqr(v) -> Float32Euclidean magnitude + squared magnitude (cheaper for comparisons).
val len = Vector2.length(v)
Vector2.dot_product(v, other) / distance(v, other) / distance_sqr(v, other) -> Float32Dot product, Euclidean distance between points.
val d = Vector2.dot_product(a, b)
Vector2.angle(v, other) / line_angle(start, end) -> Float32Angle between two vectors; angle of a line (radians).
val a = Vector2.angle(v1, v2)
Vector2.normalize(v) / transform(v, mat: Matrix) -> Vector2Unit-length version; affine-transform a Vector2 by a Matrix.
val unit = Vector2.normalize(direction)
Vector2.lerp(v, other, amount) / move_towards(v, target, max_distance) / reflect(v, normal)Linear interpolate; step toward target with distance cap; bounce vector off a normal.
val mid = Vector2.lerp(a, b, Float32(0.5))
Vector2.min / max / clamp(v, min, max: Vector2) / clamp_value(v, min, max: Float32) / equals(v, other) / refract(v, n, r)Component-wise min/max/clamp, scalar-range clamp, epsilon equals, Snell-law refraction.
val clamped = Vector2.clamp(v, Vector2.zero(), Vector2.one())
Vector2.rotate(v, angle: Float32) -> Vector2Rotate vector by angle (radians).
val r = Vector2.rotate(v, Float32(0.5))
Vector3.zero() / one() -> Vector3Origin / ones vectors.
val o = Vector3.zero()
Vector3.add / subtract / multiply / divide(v, other) -> Vector3Component-wise arithmetic.
val sum = Vector3.add(a, b)
Vector3.add_value / subtract_value(v, scalar) / scale(v, scalar) / negate / invertScalar ops.
val s = Vector3.scale(v, Float32(2.0))
Vector3.cross_product(v, other) / perpendicular(v) -> Vector3Cross product; arbitrary perpendicular.
val n = Vector3.cross_product(u, v)
Vector3.length(v) / length_sqr(v) / distance(v, other) / distance_sqr(v, other) / dot_product(v, other) -> Float32Metric scalars.
val d = Vector3.distance(player, enemy)
Vector3.angle(v, other) -> Float32Angle between two 3D vectors (radians).
val a = Vector3.angle(forward, target_dir)
Vector3.normalize(v) / project(v, other) / reject(v, other) -> Vector3Unit vector; projection onto line; orthogonal-component rejection.
val unit = Vector3.normalize(dir)
Vector3.ortho_normalize(v, other) -> (Vector3, Vector3)Gram-Schmidt orthonormalization of two vectors — returns mutually-perpendicular unit vectors.
val (u, v) = Vector3.ortho_normalize(a, b)
Vector3.transform(v, mat: Matrix) / rotate_by_quaternion(v, q: Quaternion) / rotate_by_axis_angle(v, axis, angle)Affine-transform by Matrix; rotate by quaternion or axis-angle.
val r = Vector3.rotate_by_axis_angle(forward, up, Float32(0.1))
Vector3.lerp(v, other, amount) / move_towards(v, target, max_distance) / cubic_hermite(v1, tangent1, v2, tangent2, t) / reflect(v, normal) / refract(v, n, r)Interpolation family.
val mid = Vector3.lerp(a, b, Float32(0.5))
Vector3.min / max / clamp / clamp_value / equals / barycenter / unprojectComponent min/max/clamp; barycentric coords in triangle; unproject from screen back to world.
val bary = Vector3.barycenter(p, a, b, c)
Vector3.to_float_v(v: Vector3) -> Float3Pack into a 3-float struct for shader uniform upload.
val packed = Vector3.to_float_v(v)
Vector4.zero() / one() -> Vector4Constant constructors.
val o = Vector4.zero()
Vector4.add / subtract / multiply / divide / scale / negateComponent-wise arithmetic.
val s = Vector4.scale(v, Float32(0.5))
Vector4.length / length_sqr / dot_product / distance / distance_sqrMetric scalars.
val len = Vector4.length(v)
Vector4.normalize / min / max / lerp / move_towards / invert / equalsUnit vector + clamp family + interpolation.
val unit = Vector4.normalize(v)
Matrix.identity() -> Matrix4x4 identity.
val I = Matrix.identity()
Matrix.determinant(m) / trace(m) -> Float32Scalar summaries of a matrix.
val d = Matrix.determinant(m)
Matrix.transpose(m) / invert(m) -> MatrixTranspose + inverse.
val inv = Matrix.invert(view)
Matrix.add / subtract / multiply(m, other) -> MatrixElement-wise add/subtract, matrix-matrix multiply (composition).
val mvp = Matrix.multiply(view, proj)
Matrix.translate(x, y, z: Float32) / scale(x, y, z) -> MatrixBuild translation / scale matrices.
val t = Matrix.translate(Float32(1.0), Float32(0.0), Float32(0.0))
Matrix.rotate(axis: Vector3, angle: Float32) / rotate_x / rotate_y / rotate_z(angle) / rotate_xyz(angle: Vector3) / rotate_zyx(angle)Rotation matrices.
val r = Matrix.rotate_y(Float32(0.5))
Matrix.frustum(left, right, bottom, top, near, far) / perspective(fovy, aspect, near, far) / ortho(left, right, bottom, top, near, far)Projection matrices — frustum, perspective, orthographic.
val proj = Matrix.perspective(Float32(45.0), Float32(1.333), Float32(0.1), Float32(1000.0))
Matrix.look_at(eye, target, up: Vector3) -> MatrixRight-handed view matrix pointing camera from eye toward target.
val view = Matrix.look_at(eye, Vector3.zero(), Vector3.of(0.0, 1.0, 0.0))
Matrix.to_float_v(m: Matrix) -> Float16 / Matrix.decompose(m) -> (Vector3, Quaternion, Vector3)Pack to 16-float buffer; decompose into translation, rotation, scale.
val (t, r, s) = Matrix.decompose(world)
Quaternion.identity() -> QuaternionIdentity quaternion (no rotation).
val q = Quaternion.identity()
Quaternion.add / subtract / multiply / divide / scale / add_value / subtract_valueComponent-wise arithmetic + quaternion composition (multiply).
val combined = Quaternion.multiply(q1, q2)
Quaternion.length(q) -> Float32 / normalize(q) / invert(q) -> QuaternionMagnitude / unit / conjugate.
val unit = Quaternion.normalize(q)
Quaternion.lerp(q, other, amount) / nlerp(q, other, amount) / slerp(q, other, amount) / cubic_hermite_spline(q1, out_tangent1, q2, in_tangent2, t)Interpolation family — slerp is the classic spherical lerp for camera / bone interp.
val mid = Quaternion.slerp(q1, q2, Float32(0.5))
Quaternion.from_axis_angle(axis: Vector3, angle: Float32) -> QuaternionBuild quaternion from axis-angle.
val q = Quaternion.from_axis_angle(Vector3.of(0.0, 1.0, 0.0), Float32(1.57))
Quaternion.to_axis_angle(q) -> (Vector3, Float32)Decompose quaternion into axis-angle.
val (axis, angle) = Quaternion.to_axis_angle(q)
Quaternion.from_euler(pitch, yaw, roll: Float32) -> Quaternion / to_euler(q) -> Vector3Euler angle ↔ quaternion conversion.
val q = Quaternion.from_euler(Float32(0.1), Float32(0.2), Float32(0.3))
Quaternion.to_matrix(q) -> Matrix / from_matrix(mat: Matrix) -> Quaternion4x4 rotation matrix ↔ quaternion roundtrip.
val m = Quaternion.to_matrix(q)
Quaternion.from_vector3_to_vector3(from, to: Vector3) -> QuaternionMinimum-arc rotation from one vector to another.
val q = Quaternion.from_vector3_to_vector3(forward, target)
Quaternion.transform(q, mat: Matrix) / equals(q, other) -> BoolMatrix-transform; epsilon-aware equality.
if Quaternion.equals(q1, q2) { }
Every method above is exercised in tests/manual/raymath_smoke.iron with reproducible numeric assertions covering normalized vectors, identity matrices, and axis-aligned rotations.
All scalar parameters are Float32 — byte-identical to raylib's C float at the FFI boundary. Int32 is used for indices/counts; Bool for predicates.