From 3c02a64729c788286d5491e289fcb8ea6ac08812 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg <guzba8@gmail.com> Date: Mon, 30 Nov 2020 01:30:17 -0600 Subject: [PATCH 1/3] formatting --- src/vmath.nim | 90 +++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/vmath.nim b/src/vmath.nim index 4126493..722f060 100644 --- a/src/vmath.nim +++ b/src/vmath.nim @@ -429,7 +429,7 @@ proc `/`*(a: Vec4, b: float32): Vec4 {.inline.} = result.z = a.z / b result.w = a.w / b -proc `/`*(a: float32, b: Vec4): Vec4 {.inline.}= +proc `/`*(a: float32, b: Vec4): Vec4 {.inline.} = result.x = a / b.x result.y = a / b.y result.z = a / b.z @@ -708,38 +708,38 @@ proc inverse*(a: Mat4): Mat4 = a33 = a[15] var - b00 = a00*a11 - a01*a10 - b01 = a00*a12 - a02*a10 - b02 = a00*a13 - a03*a10 - b03 = a01*a12 - a02*a11 - b04 = a01*a13 - a03*a11 - b05 = a02*a13 - a03*a12 - b06 = a20*a31 - a21*a30 - b07 = a20*a32 - a22*a30 - b08 = a20*a33 - a23*a30 - b09 = a21*a32 - a22*a31 - b10 = a21*a33 - a23*a31 - b11 = a22*a33 - a23*a32 + b00 = a00 * a11 - a01 * a10 + b01 = a00 * a12 - a02 * a10 + b02 = a00 * a13 - a03 * a10 + b03 = a01 * a12 - a02 * a11 + b04 = a01 * a13 - a03 * a11 + b05 = a02 * a13 - a03 * a12 + b06 = a20 * a31 - a21 * a30 + b07 = a20 * a32 - a22 * a30 + b08 = a20 * a33 - a23 * a30 + b09 = a21 * a32 - a22 * a31 + b10 = a21 * a33 - a23 * a31 + b11 = a22 * a33 - a23 * a32 # Calculate the inverse determinant. var invDet = 1.0/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06) - result[00] = (+a11*b11 - a12*b10 + a13*b09)*invDet - result[01] = (-a01*b11 + a02*b10 - a03*b09)*invDet - result[02] = (+a31*b05 - a32*b04 + a33*b03)*invDet - result[03] = (-a21*b05 + a22*b04 - a23*b03)*invDet - result[04] = (-a10*b11 + a12*b08 - a13*b07)*invDet - result[05] = (+a00*b11 - a02*b08 + a03*b07)*invDet - result[06] = (-a30*b05 + a32*b02 - a33*b01)*invDet - result[07] = (+a20*b05 - a22*b02 + a23*b01)*invDet - result[08] = (+a10*b10 - a11*b08 + a13*b06)*invDet - result[09] = (-a00*b10 + a01*b08 - a03*b06)*invDet - result[10] = (+a30*b04 - a31*b02 + a33*b00)*invDet - result[11] = (-a20*b04 + a21*b02 - a23*b00)*invDet - result[12] = (-a10*b09 + a11*b07 - a12*b06)*invDet - result[13] = (+a00*b09 - a01*b07 + a02*b06)*invDet - result[14] = (-a30*b03 + a31*b01 - a32*b00)*invDet - result[15] = (+a20*b03 - a21*b01 + a22*b00)*invDet + result[00] = (+a11 * b11 - a12 * b10 + a13 * b09) * invDet + result[01] = (-a01 * b11 + a02 * b10 - a03 * b09) * invDet + result[02] = (+a31 * b05 - a32 * b04 + a33 * b03) * invDet + result[03] = (-a21 * b05 + a22 * b04 - a23 * b03) * invDet + result[04] = (-a10 * b11 + a12 * b08 - a13 * b07) * invDet + result[05] = (+a00 * b11 - a02 * b08 + a03 * b07) * invDet + result[06] = (-a30 * b05 + a32 * b02 - a33 * b01) * invDet + result[07] = (+a20 * b05 - a22 * b02 + a23 * b01) * invDet + result[08] = (+a10 * b10 - a11 * b08 + a13 * b06) * invDet + result[09] = (-a00 * b10 + a01 * b08 - a03 * b06) * invDet + result[10] = (+a30 * b04 - a31 * b02 + a33 * b00) * invDet + result[11] = (-a20 * b04 + a21 * b02 - a23 * b00) * invDet + result[12] = (-a10 * b09 + a11 * b07 - a12 * b06) * invDet + result[13] = (+a00 * b09 - a01 * b07 + a02 * b06) * invDet + result[14] = (-a30 * b03 + a31 * b01 - a32 * b00) * invDet + result[15] = (+a20 * b03 - a21 * b01 + a22 * b00) * invDet proc `*`*(a, b: Mat4): Mat4 = var @@ -778,22 +778,22 @@ proc `*`*(a, b: Mat4): Mat4 = b32 = b[14] b33 = b[15] - result[00] = b00*a00 + b01*a10 + b02*a20 + b03*a30 - result[01] = b00*a01 + b01*a11 + b02*a21 + b03*a31 - result[02] = b00*a02 + b01*a12 + b02*a22 + b03*a32 - result[03] = b00*a03 + b01*a13 + b02*a23 + b03*a33 - result[04] = b10*a00 + b11*a10 + b12*a20 + b13*a30 - result[05] = b10*a01 + b11*a11 + b12*a21 + b13*a31 - result[06] = b10*a02 + b11*a12 + b12*a22 + b13*a32 - result[07] = b10*a03 + b11*a13 + b12*a23 + b13*a33 - result[08] = b20*a00 + b21*a10 + b22*a20 + b23*a30 - result[09] = b20*a01 + b21*a11 + b22*a21 + b23*a31 - result[10] = b20*a02 + b21*a12 + b22*a22 + b23*a32 - result[11] = b20*a03 + b21*a13 + b22*a23 + b23*a33 - result[12] = b30*a00 + b31*a10 + b32*a20 + b33*a30 - result[13] = b30*a01 + b31*a11 + b32*a21 + b33*a31 - result[14] = b30*a02 + b31*a12 + b32*a22 + b33*a32 - result[15] = b30*a03 + b31*a13 + b32*a23 + b33*a33 + result[00] = b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30 + result[01] = b00 * a01 + b01 * a11 + b02 * a21 + b03 * a31 + result[02] = b00 * a02 + b01 * a12 + b02 * a22 + b03 * a32 + result[03] = b00 * a03 + b01 * a13 + b02 * a23 + b03 * a33 + result[04] = b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30 + result[05] = b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31 + result[06] = b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32 + result[07] = b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33 + result[08] = b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30 + result[09] = b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31 + result[10] = b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32 + result[11] = b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33 + result[12] = b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30 + result[13] = b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31 + result[14] = b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32 + result[15] = b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33 proc `*`*(a: Mat4, b: Vec3): Vec3 = result.x = a[0] * b.x + a[4] * b.y + a[8] * b.z + a[12] From b50b5704475c79f3fd389a344595a704d832c2a4 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg <guzba8@gmail.com> Date: Mon, 30 Nov 2020 01:34:39 -0600 Subject: [PATCH 2/3] shorter --- src/vmath.nim | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/vmath.nim b/src/vmath.nim index 722f060..a4c1e9c 100644 --- a/src/vmath.nim +++ b/src/vmath.nim @@ -10,11 +10,11 @@ proc sign*(v: float32): float32 {.inline.} = ## Returns the sign of a number, -1 or 1. if v >= 0: 1.0 else: -1.0 -proc quantize*(v: float32, n: float32): float32 {.inline.} = +proc quantize*(v, n: float32): float32 {.inline.} = ## Makes v be multipe of n. Rounding to integer quantize by 1.0. sign(v) * floor(abs(v) / n) * n -proc lerp*(a: float32, b: float32, v: float32): float32 {.inline.} = +proc lerp*(a, b, v: float32): float32 {.inline.} = ## Interpolates value between a and b. ## * 0 -> a ## * 1 -> b @@ -63,11 +63,11 @@ proc vec2*(a: Vec2): Vec2 {.inline.} = result.x = a.x result.y = a.y -proc `+`*(a: Vec2, b: Vec2): Vec2 {.inline.} = +proc `+`*(a, b: Vec2): Vec2 {.inline.} = result.x = a.x + b.x result.y = a.y + b.y -proc `-`*(a: Vec2, b: Vec2): Vec2 {.inline.} = +proc `-`*(a, b: Vec2): Vec2 {.inline.} = result.x = a.x - b.x result.y = a.y - b.y @@ -121,29 +121,29 @@ proc `length=`*(a: var Vec2, b: float32) {.inline.} = proc normalize*(a: Vec2): Vec2 {.inline.} = a / a.length -proc dot*(a: Vec2, b: Vec2): float32 {.inline.} = +proc dot*(a, b: Vec2): float32 {.inline.} = a.x * b.x + a.y * b.y -proc dir*(at: Vec2, to: Vec2): Vec2 {.inline.} = +proc dir*(at, to: Vec2): Vec2 {.inline.} = (at - to).normalize() proc dir*(th: float32): Vec2 {.inline.} = vec2(cos(th), sin(th)) -proc dist*(at: Vec2, to: Vec2): float32 {.inline.} = +proc dist*(at, to: Vec2): float32 {.inline.} = (at - to).length -proc distSq*(at: Vec2, to: Vec2): float32 {.inline.} = +proc distSq*(at, to: Vec2): float32 {.inline.} = (at - to).lengthSq -proc lerp*(a: Vec2, b: Vec2, v: float32): Vec2 {.inline.} = +proc lerp*(a, b: Vec2, v: float32): Vec2 {.inline.} = a * (1.0 - v) + b * v proc quantize*(v: Vec2, n: float32): Vec2 {.inline.} = result.x = sign(v.x) * floor(abs(v.x) / n) * n result.y = sign(v.y) * floor(abs(v.y) / n) * n -proc inRect*(v: Vec2, a: Vec2, b: Vec2): bool {.inline.} = +proc inRect*(v, a, b: Vec2): bool {.inline.} = ## Check to see if v is inside a rectange formed by a and b. ## It does not matter how a and b are arranged. let @@ -204,12 +204,12 @@ const X_DIR* = vec3(1.0, 0.0, 0.0) const Y_DIR* = vec3(0.0, 1.0, 0.0) const Z_DIR* = vec3(0.0, 0.0, 1.0) -proc `+`*(a: Vec3, b: Vec3): Vec3 {.inline.} = +proc `+`*(a, b: Vec3): Vec3 {.inline.} = result.x = a.x + b.x result.y = a.y + b.y result.z = a.z + b.z -proc `-`*(a: Vec3, b: Vec3): Vec3 {.inline.} = +proc `-`*(a, b: Vec3): Vec3 {.inline.} = result.x = a.x - b.x result.y = a.y - b.y result.z = a.z - b.z @@ -291,7 +291,7 @@ proc ceil*(a: Vec3): Vec3 {.inline.} = proc normalize*(a: Vec3): Vec3 {.inline.} = a / sqrt(a.x * a.x + a.y * a.y + a.z * a.z) -proc cross*(a: Vec3, b: Vec3): Vec3 {.inline.} = +proc cross*(a, b: Vec3): Vec3 {.inline.} = result.x = a.y * b.z - a.z * b.y result.y = a.z * b.x - a.x * b.z result.z = a.x * b.y - a.y * b.x @@ -299,19 +299,19 @@ proc cross*(a: Vec3, b: Vec3): Vec3 {.inline.} = proc computeNormal*(a, b, c: Vec3): Vec3 = cross(c - b, b - a).normalize() -proc dot*(a: Vec3, b: Vec3): float32 {.inline.} = +proc dot*(a, b: Vec3): float32 {.inline.} = a.x * b.x + a.y * b.y + a.z * b.z -proc dir*(at: Vec3, to: Vec3): Vec3 {.inline.} = +proc dir*(at, to: Vec3): Vec3 {.inline.} = (at - to).normalize() -proc dist*(at: Vec3, to: Vec3): float32 {.inline.} = +proc dist*(at, to: Vec3): float32 {.inline.} = (at - to).length -proc distSq*(at: Vec3, to: Vec3): float32 {.inline.} = +proc distSq*(at, to: Vec3): float32 {.inline.} = (at - to).lengthSq -proc lerp*(a: Vec3, b: Vec3, v: float32): Vec3 {.inline.} = +proc lerp*(a, b: Vec3, v: float32): Vec3 {.inline.} = a * (1.0 - v) + b * v proc quantize*(v: Vec3, n: float32): Vec3 = @@ -396,13 +396,13 @@ proc vec4*(v: float32): Vec4 {.inline.} = result.z = v result.w = v -proc `+`*(a: Vec4, b: Vec4): Vec4 {.inline.} = +proc `+`*(a, b: Vec4): Vec4 {.inline.} = result.x = a.x + b.x result.y = a.y + b.y result.z = a.z + b.z result.w = a.w + b.w -proc `-`*(a: Vec4, b: Vec4): Vec4 {.inline.} = +proc `-`*(a, b: Vec4): Vec4 {.inline.} = result.x = a.x - b.x result.y = a.y - b.y result.z = a.z - b.z @@ -539,7 +539,7 @@ proc `$`*(a: Mat3): string = {a[3]:.4f}, {a[4]:.4f}, {a[5]:.4f}, {a[6]:.4f}, {a[7]:.4f}, {a[8]:.4f}]""" -proc `*`*(a: Mat3, b: Mat3): Mat3 = +proc `*`*(a, b: Mat3): Mat3 = result[0, 0] += b[0, 0] * a[0, 0] + b[0, 1] * a[1, 0] + b[0, 2] * a[2, 0] result[0, 1] += b[0, 0] * a[0, 1] + b[0, 1] * a[1, 1] + b[0, 2] * a[2, 1] result[0, 2] += b[0, 0] * a[0, 2] + b[0, 1] * a[1, 2] + b[0, 2] * a[2, 2] From 75dd88deb3dbbb3715eabb1531809ea33d60d01d Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg <guzba8@gmail.com> Date: Mon, 30 Nov 2020 01:35:46 -0600 Subject: [PATCH 3/3] update readme --- README.md | 849 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 439 insertions(+), 410 deletions(-) diff --git a/README.md b/README.md index 87fc075..7ad89d8 100644 --- a/README.md +++ b/README.md @@ -12,31 +12,31 @@ Has functions for Vec2, Vec3, Vec4, Mat3, Mat4 and Quat. import vmath ``` -## **func** between +## **proc** between Returns true if value is between min and max or equal to them. ```nim -func between(value, min, max: float32): bool +proc between(value, min, max: float32): bool {.inline.} ``` -## **func** sign +## **proc** sign Returns the sign of a number, -1 or 1. ```nim -func sign(v: float32): float32 +proc sign(v: float32): float32 {.inline.} ``` -## **func** quantize +## **proc** quantize Makes v be multipe of n. Rounding to integer quantize by 1.0. ```nim -func quantize(v: float32; n: float32): float32 +proc quantize(v, n: float32): float32 {.inline.} ``` -## **func** lerp +## **proc** lerp Interpolates value between a and b. * 0 -> a @@ -44,7 +44,31 @@ Interpolates value between a and b. * 0.5 -> between a and b ```nim -func lerp(a: float32; b: float32; v: float32): float32 +proc lerp(a, b, v: float32): float32 {.inline.} +``` + +## **proc** fixAngle + +Make angle be from -PI to PI radians. + +```nim +proc fixAngle(angle: float32): float32 +``` + +## **proc** angleBetween + +Angle between angle a and angle b. + +```nim +proc angleBetween(a, b: float32): float32 {.inline.} +``` + +## **proc** turnAngle + +Move from angle a to angle b with step of v. + +```nim +proc turnAngle(a, b, speed: float32): float32 ``` ## **type** Vec2 @@ -57,262 +81,238 @@ Vec2 = object y*: float32 ``` -## **func** vec2 +## **proc** vec2 ```nim -func vec2(x, y: float32): Vec2 +proc vec2(x, y: float32): Vec2 {.inline.} ``` -## **func** vec2 +## **proc** vec2 ```nim -func vec2(v: float32): Vec2 +proc vec2(v: float32): Vec2 {.inline.} ``` -## **func** vec2 +## **proc** vec2 ```nim -func vec2(a: Vec2): Vec2 +proc vec2(a: Vec2): Vec2 {.inline.} ``` -## **func** `+` +## **proc** `+` ```nim -func `+`(a: Vec2; b: Vec2): Vec2 +proc `+`(a, b: Vec2): Vec2 {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec2; b: Vec2): Vec2 +proc `-`(a, b: Vec2): Vec2 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Vec2; b: float32): Vec2 +proc `*`(a: Vec2; b: float32): Vec2 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: float32; b: Vec2): Vec2 +proc `*`(a: float32; b: Vec2): Vec2 {.inline.} ``` -## **func** `/` +## **proc** `/` ```nim -func `/`(a: Vec2; b: float32): Vec2 +proc `/`(a: Vec2; b: float32): Vec2 {.inline.} ``` -## **func** `+=` +## **proc** `+=` ```nim -func `+=`(a: var Vec2; b: Vec2) +proc `+=`(a: var Vec2; b: Vec2) {.inline.} ``` -## **func** `-=` +## **proc** `-=` ```nim -func `-=`(a: var Vec2; b: Vec2) +proc `-=`(a: var Vec2; b: Vec2) {.inline.} ``` -## **func** `*=` +## **proc** `*=` ```nim -func `*=`(a: var Vec2; b: float32) +proc `*=`(a: var Vec2; b: float32) {.inline.} ``` -## **func** `/=` +## **proc** `/=` ```nim -func `/=`(a: var Vec2; b: float32) +proc `/=`(a: var Vec2; b: float32) {.inline.} ``` -## **func** zero +## **proc** zero ```nim -func zero(a: var Vec2) +proc zero(a: var Vec2) {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec2): Vec2 +proc `-`(a: Vec2): Vec2 {.inline.} ``` -## **func** hash +## **proc** hash ```nim -func hash(a: Vec2): Hash +proc hash(a: Vec2): Hash {.inline.} ``` -## **func** lengthSq +## **proc** lengthSq ```nim -func lengthSq(a: Vec2): float32 +proc lengthSq(a: Vec2): float32 {.inline.} ``` -## **func** length +## **proc** length ```nim -func length(a: Vec2): float32 +proc length(a: Vec2): float32 {.inline.} ``` -## **func** length= +## **proc** length= ```nim -func length=(a: var Vec2; b: float32) +proc length=(a: var Vec2; b: float32) {.inline.} ``` -## **func** normalize +## **proc** normalize ```nim -func normalize(a: Vec2): Vec2 +proc normalize(a: Vec2): Vec2 {.inline.} ``` -## **func** dot +## **proc** dot ```nim -func dot(a: Vec2; b: Vec2): float32 +proc dot(a, b: Vec2): float32 {.inline.} ``` -## **func** dir +## **proc** dir ```nim -func dir(at: Vec2; to: Vec2): Vec2 +proc dir(at, to: Vec2): Vec2 {.inline.} ``` -## **func** dir +## **proc** dir ```nim -func dir(th: float32): Vec2 +proc dir(th: float32): Vec2 {.inline.} ``` -## **func** dist +## **proc** dist ```nim -func dist(at: Vec2; to: Vec2): float32 +proc dist(at, to: Vec2): float32 {.inline.} ``` -## **func** distSq +## **proc** distSq ```nim -func distSq(at: Vec2; to: Vec2): float32 +proc distSq(at, to: Vec2): float32 {.inline.} ``` -## **func** lerp +## **proc** lerp ```nim -func lerp(a: Vec2; b: Vec2; v: float32): Vec2 +proc lerp(a, b: Vec2; v: float32): Vec2 {.inline.} ``` -## **func** quantize +## **proc** quantize ```nim -func quantize(v: Vec2; n: float32): Vec2 +proc quantize(v: Vec2; n: float32): Vec2 {.inline.} ``` -## **func** inRect +## **proc** inRect Check to see if v is inside a rectange formed by a and b. It does not matter how a and b are arranged. ```nim -func inRect(v: Vec2; a: Vec2; b: Vec2): bool +proc inRect(v, a, b: Vec2): bool {.inline.} ``` -## **func** `[]` +## **proc** `[]` ```nim -func `[]`(a: Vec2; i: int): float32 +proc `[]`(a: Vec2; i: int): float32 ``` -## **func** `[]=` +## **proc** `[]=` ```nim -func `[]=`(a: var Vec2; i: int; b: float32) +proc `[]=`(a: var Vec2; i: int; b: float32) ``` ## **proc** randVec2 ```nim -proc randVec2(): Vec2 +proc randVec2(r: var Rand): Vec2 ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Vec2): string {.raises: [ValueError].} +proc `$`(a: Vec2): string {.raises: [ValueError].} ``` -## **func** fixAngle - -Make angle be from -PI to PI radians. - -```nim -func fixAngle(angle: float32): float32 -``` - -## **func** angle +## **proc** angle Angle of a Vec2. ```nim -func angle(a: Vec2): float32 +proc angle(a: Vec2): float32 {.inline.} ``` -## **func** angleBetween +## **proc** angleBetween Angle between 2 Vec2. ```nim -func angleBetween(a: Vec2; b: Vec2): float32 -``` - -## **func** angleBetween - -Angle between angle a and angle b. - -```nim -func angleBetween(a, b: float32): float32 -``` - -## **func** turnAngle - -Move from angle a to angle b with step of v. - -```nim -func turnAngle(a, b, speed: float32): float32 +proc angleBetween(a: Vec2; b: Vec2): float32 {.inline.} ``` ## **type** Vec3 @@ -326,25 +326,25 @@ Vec3 = object z*: float32 ``` -## **func** vec3 +## **proc** vec3 ```nim -func vec3(x, y, z: float32): Vec3 +proc vec3(x, y, z: float32): Vec3 {.inline.} ``` -## **func** vec3 +## **proc** vec3 ```nim -func vec3(v: float32): Vec3 +proc vec3(v: float32): Vec3 {.inline.} ``` -## **func** vec3 +## **proc** vec3 ```nim -func vec3(a: Vec3): Vec3 +proc vec3(a: Vec3): Vec3 {.inline.} ``` ## **const** X_DIR @@ -368,277 +368,277 @@ Y_DIR = (x: 0.0, y: 1.0, z: 0.0) Z_DIR = (x: 0.0, y: 0.0, z: 1.0) ``` -## **func** `+` +## **proc** `+` ```nim -func `+`(a: Vec3; b: Vec3): Vec3 +proc `+`(a, b: Vec3): Vec3 {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec3; b: Vec3): Vec3 +proc `-`(a, b: Vec3): Vec3 {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec3): Vec3 +proc `-`(a: Vec3): Vec3 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Vec3; b: float32): Vec3 +proc `*`(a: Vec3; b: float32): Vec3 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: float32; b: Vec3): Vec3 +proc `*`(a: float32; b: Vec3): Vec3 {.inline.} ``` -## **func** `/` +## **proc** `/` ```nim -func `/`(a: Vec3; b: float32): Vec3 +proc `/`(a: Vec3; b: float32): Vec3 {.inline.} ``` -## **func** `/` +## **proc** `/` ```nim -func `/`(a: float32; b: Vec3): Vec3 +proc `/`(a: float32; b: Vec3): Vec3 {.inline.} ``` -## **func** `+=` +## **proc** `+=` ```nim -func `+=`(a: var Vec3; b: Vec3) +proc `+=`(a: var Vec3; b: Vec3) {.inline.} ``` -## **func** `-=` +## **proc** `-=` ```nim -func `-=`(a: var Vec3; b: Vec3) +proc `-=`(a: var Vec3; b: Vec3) {.inline.} ``` -## **func** `*=` +## **proc** `*=` ```nim -func `*=`(a: var Vec3; b: float32) +proc `*=`(a: var Vec3; b: float32) {.inline.} ``` -## **func** `/=` +## **proc** `/=` ```nim -func `/=`(a: var Vec3; b: float32) +proc `/=`(a: var Vec3; b: float32) {.inline.} ``` -## **func** zero +## **proc** zero ```nim -func zero(a: var Vec3) +proc zero(a: var Vec3) {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: var Vec3): Vec3 +proc `-`(a: var Vec3): Vec3 {.inline.} ``` -## **func** hash +## **proc** hash ```nim -func hash(a: Vec3): Hash +proc hash(a: Vec3): Hash {.inline.} ``` -## **func** lengthSq +## **proc** lengthSq ```nim -func lengthSq(a: Vec3): float32 +proc lengthSq(a: Vec3): float32 {.inline.} ``` -## **func** length +## **proc** length ```nim -func length(a: Vec3): float32 +proc length(a: Vec3): float32 {.inline.} ``` -## **func** length= +## **proc** length= ```nim -func length=(a: var Vec3; b: float32) +proc length=(a: var Vec3; b: float32) {.inline.} ``` -## **func** floor +## **proc** floor ```nim -func floor(a: Vec3): Vec3 +proc floor(a: Vec3): Vec3 {.inline.} ``` -## **func** round +## **proc** round ```nim -func round(a: Vec3): Vec3 +proc round(a: Vec3): Vec3 {.inline.} ``` -## **func** ceil +## **proc** ceil ```nim -func ceil(a: Vec3): Vec3 +proc ceil(a: Vec3): Vec3 {.inline.} ``` -## **func** normalize +## **proc** normalize ```nim -func normalize(a: Vec3): Vec3 +proc normalize(a: Vec3): Vec3 {.inline.} ``` -## **func** cross +## **proc** cross ```nim -func cross(a: Vec3; b: Vec3): Vec3 +proc cross(a, b: Vec3): Vec3 {.inline.} ``` -## **func** computeNormal +## **proc** computeNormal ```nim -func computeNormal(a, b, c: Vec3): Vec3 +proc computeNormal(a, b, c: Vec3): Vec3 ``` -## **func** dot +## **proc** dot ```nim -func dot(a: Vec3; b: Vec3): float32 +proc dot(a, b: Vec3): float32 {.inline.} ``` -## **func** dir +## **proc** dir ```nim -func dir(at: Vec3; to: Vec3): Vec3 +proc dir(at, to: Vec3): Vec3 {.inline.} ``` -## **func** dist +## **proc** dist ```nim -func dist(at: Vec3; to: Vec3): float32 +proc dist(at, to: Vec3): float32 {.inline.} ``` -## **func** distSq +## **proc** distSq ```nim -func distSq(at: Vec3; to: Vec3): float32 +proc distSq(at, to: Vec3): float32 {.inline.} ``` -## **func** lerp +## **proc** lerp ```nim -func lerp(a: Vec3; b: Vec3; v: float32): Vec3 +proc lerp(a, b: Vec3; v: float32): Vec3 {.inline.} ``` -## **func** quantize +## **proc** quantize ```nim -func quantize(v: Vec3; n: float32): Vec3 +proc quantize(v: Vec3; n: float32): Vec3 ``` -## **func** angleBetween +## **proc** angleBetween ```nim -func angleBetween(a, b: Vec3): float32 +proc angleBetween(a, b: Vec3): float32 ``` -## **func** `[]` +## **proc** `[]` ```nim -func `[]`(a: Vec3; i: int): float32 +proc `[]`(a: Vec3; i: int): float32 ``` -## **func** `[]=` +## **proc** `[]=` ```nim -func `[]=`(a: var Vec3; i: int; b: float32) +proc `[]=`(a: var Vec3; i: int; b: float32) ``` -## **func** xy +## **proc** xy ```nim -func xy(a: Vec3): Vec2 +proc xy(a: Vec3): Vec2 {.inline.} ``` -## **func** xz +## **proc** xz ```nim -func xz(a: Vec3): Vec2 +proc xz(a: Vec3): Vec2 {.inline.} ``` -## **func** yx +## **proc** yx ```nim -func yx(a: Vec3): Vec2 +proc yx(a: Vec3): Vec2 {.inline.} ``` -## **func** yz +## **proc** yz ```nim -func yz(a: Vec3): Vec2 +proc yz(a: Vec3): Vec2 {.inline.} ``` -## **func** zx +## **proc** zx ```nim -func zx(a: Vec3): Vec2 +proc zx(a: Vec3): Vec2 {.inline.} ``` -## **func** zy +## **proc** zy ```nim -func zy(a: Vec3): Vec2 +proc zy(a: Vec3): Vec2 {.inline.} ``` -## **func** almostEquals +## **proc** almostEquals ```nim -func almostEquals(a, b: Vec3; precision = 1e-006): bool +proc almostEquals(a, b: Vec3; precision = 1e-006): bool {.inline, tags: [].} ``` ## **proc** randVec3 @@ -646,14 +646,14 @@ func almostEquals(a, b: Vec3; precision = 1e-006): bool Generates a random unit vector based on <a class="reference external" href="http://mathworld.wolfram.com/SpherePointPicking.html">http://mathworld.wolfram.com/SpherePointPicking.html</a> ```nim -proc randVec3(): Vec3 +proc randVec3(r: var Rand): Vec3 ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Vec3): string {.raises: [ValueError].} +proc `$`(a: Vec3): string {.raises: [ValueError].} ``` ## **type** Vec4 @@ -668,165 +668,165 @@ Vec4 = object w*: float32 ``` -## **func** vec4 +## **proc** vec4 ```nim -func vec4(x, y, z, w: float32): Vec4 +proc vec4(x, y, z, w: float32): Vec4 {.inline.} ``` -## **func** vec4 +## **proc** vec4 ```nim -func vec4(v: float32): Vec4 +proc vec4(v: float32): Vec4 {.inline.} ``` -## **func** `+` +## **proc** `+` ```nim -func `+`(a: Vec4; b: Vec4): Vec4 +proc `+`(a, b: Vec4): Vec4 {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec4; b: Vec4): Vec4 +proc `-`(a, b: Vec4): Vec4 {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: Vec4): Vec4 +proc `-`(a: Vec4): Vec4 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Vec4; b: float32): Vec4 +proc `*`(a: Vec4; b: float32): Vec4 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: float32; b: Vec4): Vec4 +proc `*`(a: float32; b: Vec4): Vec4 {.inline.} ``` -## **func** `/` +## **proc** `/` ```nim -func `/`(a: Vec4; b: float32): Vec4 +proc `/`(a: Vec4; b: float32): Vec4 {.inline.} ``` -## **func** `/` +## **proc** `/` ```nim -func `/`(a: float32; b: Vec4): Vec4 +proc `/`(a: float32; b: Vec4): Vec4 {.inline.} ``` -## **func** `+=` +## **proc** `+=` ```nim -func `+=`(a: var Vec4; b: Vec4) +proc `+=`(a: var Vec4; b: Vec4) {.inline.} ``` -## **func** `-=` +## **proc** `-=` ```nim -func `-=`(a: var Vec4; b: Vec4) +proc `-=`(a: var Vec4; b: Vec4) {.inline.} ``` -## **func** `*=` +## **proc** `*=` ```nim -func `*=`(a: var Vec4; b: float32) +proc `*=`(a: var Vec4; b: float32) {.inline.} ``` -## **func** `/=` +## **proc** `/=` ```nim -func `/=`(a: var Vec4; b: float32) +proc `/=`(a: var Vec4; b: float32) {.inline.} ``` -## **func** zero +## **proc** zero ```nim -func zero(a: var Vec4) +proc zero(a: var Vec4) {.inline.} ``` -## **func** hash +## **proc** hash ```nim -func hash(a: Vec4): Hash +proc hash(a: Vec4): Hash {.inline.} ``` -## **func** `[]` +## **proc** `[]` ```nim -func `[]`(a: Vec4; i: int): float32 +proc `[]`(a: Vec4; i: int): float32 ``` -## **func** `[]=` +## **proc** `[]=` ```nim -func `[]=`(a: var Vec4; i: int; b: float32) +proc `[]=`(a: var Vec4; i: int; b: float32) ``` -## **func** lerp +## **proc** lerp ```nim -func lerp(a: Vec4; b: Vec4; v: float32): Vec4 +proc lerp(a: Vec4; b: Vec4; v: float32): Vec4 {.inline.} ``` -## **func** xyz +## **proc** xyz ```nim -func xyz(a: Vec4): Vec3 +proc xyz(a: Vec4): Vec3 {.inline.} ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Vec4): string {.raises: [ValueError].} +proc `$`(a: Vec4): string {.raises: [ValueError].} ``` -## **func** vec3 +## **proc** vec3 ```nim -func vec3(a: Vec2; z = 0.0): Vec3 +proc vec3(a: Vec2; z = 0.0): Vec3 {.inline.} ``` -## **func** vec4 +## **proc** vec4 ```nim -func vec4(a: Vec3; w = 0.0): Vec4 +proc vec4(a: Vec3; w = 0.0): Vec4 {.inline.} ``` -## **func** vec4 +## **proc** vec4 ```nim -func vec4(a: Vec2; z = 0.0; w = 0.0): Vec4 +proc vec4(a: Vec2; z = 0.0; w = 0.0): Vec4 {.inline.} ``` ## **type** Mat3 @@ -851,116 +851,116 @@ template `[]`(a: Mat3; i, j: int): float32 template `[]=`(a: Mat3; i, j: int; v: float32) ``` -## **func** mat3 +## **proc** mat3 ```nim -func mat3(a, b, c, d, e, f, g, h, i: float32): Mat3 +proc mat3(a, b, c, d, e, f, g, h, i: float32): Mat3 {.inline, tags: [].} ``` -## **func** mat3 +## **proc** mat3 ```nim -func mat3(a: Mat3): Mat3 +proc mat3(a: Mat3): Mat3 {.inline.} ``` -## **func** identity +## **proc** identity ```nim -func identity(a: var Mat3) +proc identity(a: var Mat3) {.inline.} ``` -## **func** mat3 +## **proc** mat3 ```nim -func mat3(): Mat3 +proc mat3(): Mat3 {.inline.} ``` -## **func** transpose +## **proc** transpose ```nim -func transpose(a: Mat3): Mat3 +proc transpose(a: Mat3): Mat3 {.inline.} ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Mat3): string {.raises: [ValueError].} +proc `$`(a: Mat3): string {.raises: [ValueError].} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Mat3; b: Mat3): Mat3 +proc `*`(a, b: Mat3): Mat3 ``` -## **func** scale +## **proc** scale ```nim -func scale(a: Mat3; v: Vec2): Mat3 +proc scale(a: Mat3; v: Vec2): Mat3 {.inline.} ``` -## **func** scale +## **proc** scale ```nim -func scale(a: Mat3; v: Vec3): Mat3 +proc scale(a: Mat3; v: Vec3): Mat3 {.inline.} ``` -## **func** translate +## **proc** translate ```nim -func translate(v: Vec2): Mat3 +proc translate(v: Vec2): Mat3 {.inline.} ``` -## **func** scale +## **proc** scale ```nim -func scale(v: Vec2): Mat3 +proc scale(v: Vec2): Mat3 {.inline.} ``` -## **func** rotationMat3 +## **proc** rotationMat3 ```nim -func rotationMat3(angle: float32): Mat3 +proc rotationMat3(angle: float32): Mat3 {.inline.} ``` -## **func** rotate +## **proc** rotate ```nim -func rotate(a: Mat3; angle: float32): Mat3 +proc rotate(a: Mat3; angle: float32): Mat3 {.inline.} ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Mat3; b: Vec2): Vec2 +proc `*`(a: Mat3; b: Vec2): Vec2 ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Mat3; b: Vec3): Vec3 +proc `*`(a: Mat3; b: Vec3): Vec3 ``` -## **func** inverse +## **proc** inverse ```nim -func inverse(a: Mat3): Mat3 +proc inverse(a: Mat3): Mat3 ``` ## **type** Mat4 @@ -985,239 +985,239 @@ template `[]`(a: Mat4; i, j: int): float32 template `[]=`(a: Mat4; i, j: int; v: float32) ``` -## **func** mat4 +## **proc** mat4 ```nim -func mat4(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15: float32): Mat4 +proc mat4(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15: float32): Mat4 {. inline.} ``` -## **func** mat4 +## **proc** mat4 ```nim -func mat4(a: Mat4): Mat4 +proc mat4(a: Mat4): Mat4 {.inline.} ``` -## **func** identity +## **proc** identity ```nim -func identity(): Mat4 +proc identity(): Mat4 {.inline.} ``` -## **func** mat4 +## **proc** mat4 ```nim -func mat4(): Mat4 +proc mat4(): Mat4 {.inline.} ``` -## **func** transpose +## **proc** transpose ```nim -func transpose(a: Mat4): Mat4 +proc transpose(a: Mat4): Mat4 {.inline.} ``` -## **func** determinant +## **proc** determinant ```nim -func determinant(a: Mat4): float32 +proc determinant(a: Mat4): float32 ``` -## **func** inverse +## **proc** inverse ```nim -func inverse(a: Mat4): Mat4 +proc inverse(a: Mat4): Mat4 ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a, b: Mat4): Mat4 +proc `*`(a, b: Mat4): Mat4 ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Mat4; b: Vec3): Vec3 +proc `*`(a: Mat4; b: Vec3): Vec3 ``` -## **func** `*` +## **proc** `*` ```nim -func `*`(a: Mat4; b: Vec4): Vec4 +proc `*`(a: Mat4; b: Vec4): Vec4 ``` -## **func** right +## **proc** right ```nim -func right(a: Mat4): Vec3 +proc right(a: Mat4): Vec3 {.inline.} ``` -## **func** right= +## **proc** right= ```nim -func right=(a: var Mat4; b: Vec3) +proc right=(a: var Mat4; b: Vec3) {.inline.} ``` -## **func** up +## **proc** up ```nim -func up(a: Mat4): Vec3 +proc up(a: Mat4): Vec3 {.inline.} ``` -## **func** up= +## **proc** up= ```nim -func up=(a: var Mat4; b: Vec3) +proc up=(a: var Mat4; b: Vec3) {.inline.} ``` -## **func** forward +## **proc** forward ```nim -func forward(a: Mat4): Vec3 +proc forward(a: Mat4): Vec3 {.inline.} ``` -## **func** forward= +## **proc** forward= ```nim -func forward=(a: var Mat4; b: Vec3) +proc forward=(a: var Mat4; b: Vec3) {.inline.} ``` -## **func** pos +## **proc** pos ```nim -func pos(a: Mat4): Vec3 +proc pos(a: Mat4): Vec3 {.inline.} ``` -## **func** pos= +## **proc** pos= ```nim -func pos=(a: var Mat4; b: Vec3) +proc pos=(a: var Mat4; b: Vec3) {.inline.} ``` -## **func** rotationOnly +## **proc** rotationOnly ```nim -func rotationOnly(a: Mat4): Mat4 +proc rotationOnly(a: Mat4): Mat4 {.inline.} ``` -## **func** dist +## **proc** dist ```nim -func dist(a, b: Mat4): float32 +proc dist(a, b: Mat4): float32 {.inline.} ``` -## **func** translate +## **proc** translate ```nim -func translate(v: Vec3): Mat4 +proc translate(v: Vec3): Mat4 ``` -## **func** scale +## **proc** scale ```nim -func scale(v: Vec3): Mat4 +proc scale(v: Vec3): Mat4 ``` -## **func** close +## **proc** close ```nim -func close(a: Mat4; b: Mat4): bool +proc close(a: Mat4; b: Mat4): bool ``` -## **func** hrp +## **proc** hrp ```nim -func hrp(m: Mat4): Vec3 +proc hrp(m: Mat4): Vec3 ``` -## **func** frustum +## **proc** frustum ```nim -func frustum(left, right, bottom, top, near, far: float32): Mat4 +proc frustum(left, right, bottom, top, near, far: float32): Mat4 ``` -## **func** perspective +## **proc** perspective ```nim -func perspective(fovy, aspect, near, far: float32): Mat4 +proc perspective(fovy, aspect, near, far: float32): Mat4 ``` -## **func** ortho +## **proc** ortho ```nim -func ortho(left, right, bottom, top, near, far: float32): Mat4 +proc ortho(left, right, bottom, top, near, far: float32): Mat4 ``` -## **func** lookAt +## **proc** lookAt ```nim -func lookAt(eye, center, up: Vec3): Mat4 +proc lookAt(eye, center, up: Vec3): Mat4 ``` -## **func** mat3 +## **proc** mat3 Gets rotation and translation, ignoring z coordinates. ```nim -func mat3(m: Mat4): Mat3 +proc mat3(m: Mat4): Mat3 ``` -## **func** mat3Rotation +## **proc** mat3Rotation Gets the rotational part of the 4x4 matrix. ```nim -func mat3Rotation(m: Mat4): Mat3 +proc mat3Rotation(m: Mat4): Mat3 ``` -## **func** mat4 +## **proc** mat4 Takes a 2d Mat3 with position and converts to a 3d matrix. ```nim -func mat4(m: Mat3): Mat4 +proc mat4(m: Mat3): Mat4 ``` -## **func** mat4Rotation +## **proc** mat4Rotation Gets the rotational part of the 3x3 matrix into a 4x4 matrix. ```nim -func mat4Rotation(m: Mat3): Mat4 +proc mat4Rotation(m: Mat3): Mat4 ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Mat4): string {.raises: [ValueError].} +proc `$`(a: Mat4): string {.raises: [ValueError].} ``` ## **type** Quat @@ -1231,112 +1231,141 @@ Quat = object w*: float32 ``` -## **func** quat +## **proc** quat ```nim -func quat(x, y, z, w: float32): Quat +proc quat(x, y, z, w: float32): Quat {.inline.} ``` -## **func** conjugate +## **proc** conjugate ```nim -func conjugate(q: Quat): Quat +proc conjugate(q: Quat): Quat {.inline.} ``` -## **func** length +## **proc** length ```nim -func length(q: Quat): float32 +proc length(q: Quat): float32 {.inline.} ``` -## **func** normalize +## **proc** normalize ```nim -func normalize(q: Quat): Quat +proc normalize(q: Quat): Quat ``` -## **func** xyz +## **proc** xyz ```nim -func xyz(q: Quat): Vec3 +proc xyz(q: Quat): Vec3 {.inline.} ``` -## **func** xyz= +## **proc** xyz= ```nim -func xyz=(q: var Quat; v: Vec3) +proc xyz=(q: var Quat; v: Vec3) {.inline.} ``` -## **func** `-` +## **proc** `-` ```nim -func `-`(a: var Quat): Quat +proc `-`(a: var Quat): Quat {.inline.} ``` -## **func** `+` +## **proc** `+` ```nim -func `+`(a: Quat; b: Quat): Quat +proc `+`(a: Quat; b: Quat): Quat {.inline.} ``` -## **func** `*` +## **proc** `*` Multiply the quaternion by a quaternion. ```nim -func `*`(a, b: Quat): Quat +proc `*`(a, b: Quat): Quat ``` -## **func** `*` +## **proc** `*` Multiply the quaternion by a float32. ```nim -func `*`(q: Quat; v: float32): Quat +proc `*`(q: Quat; v: float32): Quat {.inline.} ``` -## **func** `*` +## **proc** `/` + +Divide the quaternion by a float32. + +```nim +proc `/`(q: Quat; v: float32): Quat {.inline.} +``` + +## **proc** `*=` + + +```nim +proc `*=`(a: var Quat; b: float32) {.inline.} +``` + +## **proc** `/=` + + +```nim +proc `/=`(a: var Quat; b: float32) {.inline.} +``` + +## **proc** `*` Multiply the quaternion by a vector. ```nim -func `*`(q: Quat; v: Vec3): Vec3 +proc `*`(q: Quat; v: Vec3): Vec3 ``` -## **func** `[]=` +## **proc** `[]` ```nim -func `[]=`(a: var Quat; i: int; b: float32) +proc `[]`(a: var Quat; i: int; b: float32) ``` -## **func** mat3 +## **proc** `[]=` ```nim -func mat3(q: Quat): Mat3 +proc `[]=`(a: var Quat; i: int; b: float32) ``` -## **func** mat4 +## **proc** mat3 ```nim -func mat4(q: Quat): Mat4 +proc mat3(q: Quat): Mat3 ``` -## **func** recifuncalSqrt +## **proc** mat4 ```nim -func recifuncalSqrt(x: float32): float32 +proc mat4(q: Quat): Mat4 +``` + +## **proc** recifuncalSqrt + + +```nim +proc recifuncalSqrt(x: float32): float32 {.inline.} ``` ## **proc** quat @@ -1346,102 +1375,102 @@ func recifuncalSqrt(x: float32): float32 proc quat(m: Mat4): Quat ``` -## **func** fromAxisAngle +## **proc** fromAxisAngle ```nim -func fromAxisAngle(axis: Vec3; angle: float32): Quat +proc fromAxisAngle(axis: Vec3; angle: float32): Quat ``` -## **func** toAxisAngle +## **proc** toAxisAngle ```nim -func toAxisAngle(q: Quat; axis: var Vec3; angle: var float32) +proc toAxisAngle(q: Quat; axis: var Vec3; angle: var float32) ``` -## **func** quat +## **proc** quat ```nim -func quat(heading, pitch, roll: float32): Quat +proc quat(heading, pitch, roll: float32): Quat ``` -## **func** quat +## **proc** quat ```nim -func quat(hpr: Vec3): Quat +proc quat(hpr: Vec3): Quat {.inline.} ``` -## **func** hrp +## **proc** hrp ```nim -func hrp(q: Quat): Vec3 +proc hrp(q: Quat): Vec3 ``` -## **func** dot +## **proc** dot ```nim -func dot(a: Quat; b: Quat): float32 +proc dot(a: Quat; b: Quat): float32 {.inline.} ``` -## **func** nlerp +## **proc** nlerp ```nim -func nlerp(a: Quat; b: Quat; v: float32): Quat +proc nlerp(a: Quat; b: Quat; v: float32): Quat ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Quat): string {.raises: [ValueError].} +proc `$`(a: Quat): string {.raises: [ValueError].} ``` -## **func** rotate +## **proc** rotate ```nim -func rotate(angle: float32; axis: Vec3): Mat4 +proc rotate(angle: float32; axis: Vec3): Mat4 {.inline.} ``` -## **func** rotateX +## **proc** rotateX ```nim -func rotateX(angle: float32): Mat4 +proc rotateX(angle: float32): Mat4 {.inline.} ``` -## **func** rotateY +## **proc** rotateY ```nim -func rotateY(angle: float32): Mat4 +proc rotateY(angle: float32): Mat4 {.inline.} ``` -## **func** rotateZ +## **proc** rotateZ ```nim -func rotateZ(angle: float32): Mat4 +proc rotateZ(angle: float32): Mat4 {.inline.} ``` -## **func** scaleMat +## **proc** scaleMat ```nim -func scaleMat(scale: Vec3): Mat4 +proc scaleMat(scale: Vec3): Mat4 {.inline.} ``` -## **func** scaleMat +## **proc** scaleMat ```nim -func scaleMat(scale: float32): Mat4 +proc scaleMat(scale: float32): Mat4 {.inline.} ``` ## **type** Rect @@ -1455,97 +1484,97 @@ Rect = object h*: float32 ``` -## **func** rect +## **proc** rect ```nim -func rect(x, y, w, h: float32): Rect +proc rect(x, y, w, h: float32): Rect ``` -## **func** rect +## **proc** rect ```nim -func rect(pos, size: Vec2): Rect +proc rect(pos, size: Vec2): Rect ``` -## **func** xy +## **proc** xy Gets the xy as a Vec2. ```nim -func xy(rect: Rect): Vec2 +proc xy(rect: Rect): Vec2 ``` -## **func** xy= +## **proc** xy= Sets the xy from Vec2. ```nim -func xy=(rect: var Rect; v: Vec2) +proc xy=(rect: var Rect; v: Vec2) ``` -## **func** wh +## **proc** wh Gets the wh as a Vec2. ```nim -func wh(rect: Rect): Vec2 +proc wh(rect: Rect): Vec2 ``` -## **func** wh= +## **proc** wh= Sets the wh from Vec2. ```nim -func wh=(rect: var Rect; v: Vec2) +proc wh=(rect: var Rect; v: Vec2) ``` -## **func** `*` +## **proc** `*` * all elements of a Rect. ```nim -func `*`(r: Rect; v: float): Rect +proc `*`(r: Rect; v: float): Rect ``` -## **func** `/` +## **proc** `/` / all elements of a Rect. ```nim -func `/`(r: Rect; v: float): Rect +proc `/`(r: Rect; v: float): Rect ``` -## **func** `+` +## **proc** `+` Add two boxes together. ```nim -func `+`(a, b: Rect): Rect +proc `+`(a, b: Rect): Rect ``` -## **func** `$` +## **proc** `$` ```nim -func `$`(a: Rect): string {.raises: [ValueError].} +proc `$`(a: Rect): string {.raises: [ValueError].} ``` -## **func** inside +## **proc** inside Checks if pos is inside rect. ```nim -func inside(pos: Vec2; rect: Rect): bool +proc inside(pos: Vec2; rect: Rect): bool ``` -## **func** overlap +## **proc** overlap Returns true if box a overlaps box b. ```nim -func overlap(a, b: Rect): bool +proc overlap(a, b: Rect): bool ``` ## **proc** `or`