Skip to content

Commit

Permalink
added view/projection matrix fxs to ortho. and a missing export
Browse files Browse the repository at this point in the history
  • Loading branch information
inconvergent committed Jun 18, 2024
1 parent 5f746c6 commit f2df07b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 10 deletions.
4 changes: 2 additions & 2 deletions auxin.asd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

(asdf:defsystem #:auxin
:description "Auxiliary Utilities for Generative Art"
:version "2.2.0"
:version "2.2.1"
:author "anders hoff/inconvergent"
:licence "MIT"
:in-order-to ((asdf:test-op (asdf:test-op #:auxin/tests)))
Expand Down Expand Up @@ -39,7 +39,7 @@

(asdf:defsystem #:auxin/tests
:depends-on (#:auxin #:prove #:asdf #:uiop)
:version "2.2.0"
:version "2.2.1"
:perform (asdf:test-op (o s) (uiop:symbol-call ':auxin-tests '#:run-tests))
:pathname "test/"
:serial t
Expand Down
44 changes: 44 additions & 0 deletions docs/ortho.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
; Source file: /data/x/auxin/src/draw/ortho.lisp
```

## `@S`
```
:missing:
; ORTHO:@S
; [symbol]
;
; @S names a compiled function:
; Lambda-list: (PROJ)
; Derived type: (FUNCTION (T) (VALUES SINGLE-FLOAT &OPTIONAL))
; Inline proclamation: INLINE (inline expansion available)
; Source file: /data/x/auxin/src/draw/ortho.lisp
```

## `@UP`
```
:missing:
Expand Down Expand Up @@ -146,6 +160,21 @@
; [symbol]
```

## `PM`
```
; ORTHO:PM
; [symbol]
;
; PM names a compiled function:
; Lambda-list: (P S &OPTIONAL (NEAR 0.1) (FAR 50) &AUX (S (/ S)))
; Derived type: (FUNCTION
; (ORTHO::ORTHO SINGLE-FLOAT &OPTIONAL SINGLE-FLOAT T)
; (VALUES (SIMPLE-ARRAY SINGLE-FLOAT (16)) &OPTIONAL))
; Documentation:
; projection matrix. compatible with gmsh/scene
; Source file: /data/x/auxin/src/draw/ortho.lisp
```

## `PROJECT`
```
; ORTHO:PROJECT
Expand Down Expand Up @@ -225,6 +254,21 @@
; Source file: /data/x/auxin/src/draw/ortho.lisp
```

## `VM`
```
; ORTHO:VM
; [symbol]
;
; VM names a macro:
; Lambda-list: (&REST REST)
; Documentation:
; WRAPS: %VM
; ARGS: (P (VA 3 LOOK))
; DOCSTRING: view matrix, compatible with gmsh/scene
; defined via veq:FVDEF*
; Source file: /data/x/auxin/src/draw/ortho.lisp
```

## `ZOOM`
```
:missing:
Expand Down
18 changes: 11 additions & 7 deletions src/draw/ortho.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ view plane offset (xy) and scaling (s).
(u (veq:f3rot v vpn veq:fpi5)))
(veq:~ u v (f3!@*. u s) (f3!@*. v s)))))


(veq:fvdef -look (cam look)
(declare #.*opt* (veq:fvec cam look))
(veq:f3$point (veq:f3norm (f3!@- (veq:f3$ cam) (veq:f3$ look)))))
Expand Down Expand Up @@ -106,12 +105,9 @@ view plane offset (xy) and scaling (s).
(vpn* (if vpn vpn (-look cam look))))
(auxin:mvb ((:va 3 u v su sv)) (-get-u-v up vpn* s)
(declare (veq:ff u v su sv))
(let ((res (make-ortho :vpn vpn* :up up :cam cam
:s s :xy xy :raylen raylen
:u (veq:f3$point u)
:v (veq:f3$point v)
:su (veq:f3$point su)
:sv (veq:f3$point sv))))
(let ((res (make-ortho :vpn vpn* :up up :cam cam :s s :xy xy :raylen raylen
:u (veq:f3$point u) :v (veq:f3$point v)
:su (veq:f3$point su) :sv (veq:f3$point sv))))
(setf (ortho-dstfx res) (make-dstfx res)
(ortho-projfx res) (make-projfx res)
(ortho-rayfx res) (make-rayfx res))
Expand Down Expand Up @@ -170,6 +166,14 @@ view plane offset (xy) and scaling (s).
(:roll (update c :up (veq:f3$point
(veq:f3rot (veq:f3$s c ortho- :up :vpn val))))))))

(veq:fvdef* vm (p (:va 3 look))
(declare #.*opt* (ortho p) (veq:ff look)) "view matrix, compatible with gmsh/scene"
(veq:fmake-view-matrix (veq:f3$ (ortho::ortho-cam p)) look
(veq:f3$ (ortho::ortho-up p))))

(veq:fvdef pm (p s &optional (near 0.1) (far 50) &aux (s (/ s)))
(declare #.*opt* (ortho p) (veq:ff s near)) "projection matrix. compatible with gmsh/scene"
(veq:fmake-ortho-proj-matrix s s near far))

(veq:fvdef* project (proj (:va 3 pt))
(declare #.*opt* (ortho proj) (veq:ff pt))
Expand Down
3 changes: 2 additions & 1 deletion src/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
(:export #:export-data #:import-data #:make #:make-rayfx #:pan-cam #:pan-xy
#:project #:project* #:project-offset #:project-offset* #:rotate
#:update #:zoom
#:@cam #:@vpn #:@xy #:@up)
#:vm #:pm
#:@cam #:@vpn #:@xy #:@up #:@s)
(:import-from #:auxin #:*opt* #:with-struct))

(defpackage #:math
Expand Down

0 comments on commit f2df07b

Please sign in to comment.