@hatch:math v0.1.3
Vector + matrix + quaternion math — Vec2 / Vec3 / Vec4 / Mat4 / Quat, easings, and scalar helpers. Built for interactive apps and games.
$
hatch add @hatch:math
Vector + matrix + quaternion math — Vec2 / Vec3 / Vec4 / Mat4 / Quat, easings, and scalar helpers. Built for interactive apps and games.
Math.static PI
Math.static TAU
Math.static HALF_PI
Math.static DEG_TO_RAD
Math.static RAD_TO_DEG
Math.static EPSILON
Math.static radians(deg)
Math.static degrees(rad)
Math.static lerp(a, b, t)
Math.static clampedLerp(a, b, t)
Math.static inverseLerp(a, b, v)
Math.static clamp(v, lo, hi)
Math.static saturate(v)
Math.static smoothstep(a, b, v)
Math.static smootherstep(a, b, v)
Math.static min(a, b)
Math.static max(a, b)
Math.static sign(v)
Math.static approxEq(a, b)
Math.static approxEq(a, b, eps)
Math.static wrap(v, lo, hi)
Ease.static linear(t)
Ease.static inQuad(t)
Ease.static outQuad(t)
Ease.static inOutQuad(t)
Ease.static inCubic(t)
Ease.static outCubic(t)
Ease.static inOutCubic(t)
Ease.static inBack(t)
Ease.static outBack(t)
Ease.static inExpo(t)
Ease.static outExpo(t)
Vec2.new(x, y)
Vec2.x
Vec2.y
Vec2.x=(v)
Vec2.y=(v)
Vec2.lengthSq
Vec2.length
Vec2.normalized
Vec2.toList
Vec2.data
Vec2.toString
Vec2.static zero
Vec2.static one
Vec2.static unitX
Vec2.static unitY
Vec2.+(other)
Vec2.-(other)
Vec2.*(other)
Vec2./(other)
Vec2.-
Vec2.dot(other)
Vec2.distanceSq(other)
Vec2.distance(other)
Vec2.cross(other)
Vec2.static lerp(a, b, t)
Vec2.addInto(a, b)
Vec2.subInto(a, b)
Vec2.mulIntoScalar(a, s)
Vec2.copyFrom(v)
Vec2.approxEq(other)
Vec2.approxEq(other, eps)
Vec2.==(other)
Vec2.!=(other)
Vec3.new(x, y, z)
Vec3.x
Vec3.y
Vec3.z
Vec3.x=(v)
Vec3.y=(v)
Vec3.z=(v)
Vec3.lengthSq
Vec3.length
Vec3.normalized
Vec3.toList
Vec3.data
Vec3.toString
Vec3.static zero
Vec3.static one
Vec3.static unitX
Vec3.static unitY
Vec3.static unitZ
Vec3.+(o)
Vec3.-(o)
Vec3.*(o)
Vec3./(o)
Vec3.-
Vec3.dot(o)
Vec3.distanceSq(o)
Vec3.distance(o)
Vec3.cross(o)
Vec3.static lerp(a, b, t)
Vec3.reflect(n)
Vec3.addInto(a, b)
Vec3.subInto(a, b)
Vec3.mulIntoScalar(a, s)
Vec3.copyFrom(v)
Vec3.approxEq(o)
Vec3.approxEq(o, eps)
Vec3.==(o)
Vec3.!=(o)
Vec4.new(x, y, z, w)
Vec4.x
Vec4.y
Vec4.z
Vec4.w
Vec4.r
Vec4.g
Vec4.b
Vec4.a
Vec4.x=(v)
Vec4.y=(v)
Vec4.z=(v)
Vec4.w=(v)
Vec4.lengthSq
Vec4.length
Vec4.xyz
Vec4.toList
Vec4.data
Vec4.toString
Vec4.static zero
Vec4.static one
Vec4.static rgba(r, g, b, a)
Vec4.+(o)
Vec4.-(o)
Vec4.*(o)
Vec4./(o)
Vec4.-
Vec4.dot(o)
Vec4.static lerp(a, b, t)
Vec4.approxEq(o)
Vec4.approxEq(o, eps)
Vec4.==(o)
Vec4.!=(o)
Mat4.new()
Mat4.fromList(list)
Mat4.toList
Mat4.data
Mat4.transpose
Mat4.toString
Mat4.static zero
Mat4.static identity
Mat4.static translation(x, y, z)
Mat4.static scale(x, y, z)
Mat4.static rotationX(angle)
Mat4.static rotationY(angle)
Mat4.static rotationZ(angle)
Mat4.static perspective(fovY, aspect, near, far)
Mat4.static ortho(left, right, bottom, top, near, far)
Mat4.static lookAt(eye, target, up)
Mat4.at(r, c)
Mat4.set(r, c, v)
Mat4.*(o)
Mat4.setRaw_(i, v)
Mat4.transformPoint(v)
Mat4.transformDir(v)
Mat4.transformVec4(v)
Mat4.approxEq(other)
Mat4.approxEq(other, eps)
Quat.new(w, x, y, z)
Quat.w
Quat.x
Quat.y
Quat.z
Quat.lengthSq
Quat.length
Quat.normalized
Quat.conjugate
Quat.toMat4
Quat.data
Quat.toString
Quat.static identity
Quat.static fromAxisAngle(axis, angle)
Quat.static fromEuler(yaw, pitch, roll)
Quat.*(o)
Quat.dot(o)
Quat.static slerp(a, b, t)
Quat.rotateVec3(v)
Quat.approxEq(o)
Quat.approxEq(o, eps)
Quat.==(o)
Quat.!=(o)