diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-08-01 15:58:23 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-08-01 16:06:44 -0400 |
commit | 8da5b88f09b12dd5fbecdcc65d6e02888ace31f9 (patch) | |
tree | 109c4024f9c704cf8cc7aa61747bf9e9e657c120 | |
parent | 9394b9f1a100cc7ecdf024c0c525e535b0301cd3 (diff) |
math: matrix: Fix shear implementation in matrix4-2d-transform!
First of all, it's "shear", not "skew". Second, the math was wrong.
Good job!
-rw-r--r-- | chickadee/math/matrix.scm | 12 | ||||
-rw-r--r-- | doc/api.texi | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/chickadee/math/matrix.scm b/chickadee/math/matrix.scm index 355562a..db05dd6 100644 --- a/chickadee/math/matrix.scm +++ b/chickadee/math/matrix.scm @@ -762,10 +762,10 @@ position EYE, with the top of the viewport facing UP." (position null-vec2) (rotation 0.0) (scale default-scale) - (skew null-vec2)) + (shear null-vec2)) "Store in MATRIX the transformation described by POSITION, a 2D vector or rect, ROTATION, a scalar representing a rotation about the Z -axis, SCALE, a 2D vector, and SKEW, a 2D vector. The transformation +axis, SCALE, a 2D vector, and SHEAR, a 2D vector. The transformation happens with respect to ORIGIN, a 2D vector." (let* ((bv (matrix4-bv matrix)) (x (vec2-x position)) @@ -774,14 +774,14 @@ happens with respect to ORIGIN, a 2D vector." (oy (vec2-y origin)) (sx (vec2-x scale)) (sy (vec2-y scale)) - (kx (vec2-x skew)) - (ky (vec2-y skew)) + (kx (vec2-x shear)) + (ky (vec2-y shear)) (c (cos rotation)) (s (sin rotation)) - (q (- (* c sx) (* s sy ky))) + (q (* c sx)) (r (+ (* s sx) (* c sy ky))) (s (- (* c sx kx) (* s sy))) - (t (+ (* s sx kx) (* c sy)))) + (t (* c sy))) (bytevector-fill! bv 0) (f32vector-set! bv 10 1.0) (f32vector-set! bv 15 1.0) diff --git a/doc/api.texi b/doc/api.texi index 6d14cd6..469c5d7 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -1203,12 +1203,12 @@ Modify @var{matrix} in-place to contain a rotation about the Z axis by @deffn {Procedure} matrix4-2d-transform! matrix [#:origin] @ [#:position] [#:rotation] @ - [#:scale] [#:skew] + [#:scale] [#:shear] Modify @var{matrix} in-place to contain the transformation described by @var{position}, a 2D vector or rectangle, @var{rotation}, a scalar representing a rotation about the Z axis, @var{scale}, a 2D vector, -and @var{skew}, a 2D vector. The transformation happens with respect +and @var{shear}, a 2D vector. The transformation happens with respect to @var{origin}, a 2D vector. If an argument is not provided, that particular transformation will not be included in the result. @end deffn |