Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 39 additions & 38 deletions dev/mathbox/examples/test/polar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,59 @@
{:transform-fn clerk/mark-presented
:render-fn
'(fn [{:keys [offset]}]
[mathbox/MathBox {:style {:height "400px" :width "100%"}
:init {:background-color 0xffffff
:focus 3}}
[box/Camera {:proxy true
:position [0 0 3]}]
[box/Polar
[mathbox.core/MathBox
{:container {:style {:height "400px" :width "100%"}}
:renderer {:background-color 0xffffff}
:focus 3}
[mathbox.primitives/Camera {:proxy true
:position [0 0 3]}]
[mathbox.primitives/Polar
{:bend 1
:range [[(* -2 Math/PI) (* 2 Math/PI)]
[0 1]
[-1 1]]
:scale [2 1 1]
:helix 0.1}
;; radius axis with ticks.
[box/Transform {:position [0 0.5 0]}
[box/Axis {:detail 256}]
[box/Scale {:divide 10 :unit Math/PI :base 2}]
[box/Ticks {:width 2
:classes ["foo", "bar"]}]
[box/Ticks {:opacity 0.5
:width 1
:size 50
:normal [0 1 0]
:classes ["foo", "bar"]}]]
[mathbox.primitives/Transform {:position [0 0.5 0]}
[mathbox.primitives/Axis {:detail 256}]
[mathbox.primitives/Scale {:divide 10 :unit Math/PI :base 2}]
[mathbox.primitives/Ticks {:width 2
:classes ["foo", "bar"]}]
[mathbox.primitives/Ticks {:opacity 0.5
:width 1
:size 50
:normal [0 1 0]
:classes ["foo", "bar"]}]]


;; The polar axes.
[box/Axis {:axis 2}]
[box/Transform {:position [(/ Math/PI 2) 0 0]}
[box/Axis {:axis 2}]]
[box/Transform {:position [(- (/ Math/PI 2)) 0 0]}
[box/Axis {:axis 2}]]
[mathbox.primitives/Axis {:axis 2}]
[mathbox.primitives/Transform {:position [(/ Math/PI 2) 0 0]}
[mathbox.primitives/Axis {:axis 2}]]
[mathbox.primitives/Transform {:position [(- (/ Math/PI 2)) 0 0]}
[mathbox.primitives/Axis {:axis 2}]]


;; This is the opaque surface where the grid lives.
[box/Area {:width 256
:height 2}]
[box/Surface {:color "#fff"
:opacity 0.75
:zBias -10}]
[mathbox.primitives/Area {:width 256
:height 2}]
[mathbox.primitives/Surface {:color "#fff"
:opacity 0.75
:zBias -10}]

;; This puts the grid on, but the opaque surface is already there.
[box/Grid {:divideX 5
:detailX 256
:width 1
:opacity 0.5
:unitX Math/PI
:baseX 2
:zBias -5
:zOrder -2}]
[mathbox.primitives/Grid {:divideX 5
:detailX 256
:width 1
:opacity 0.5
:unitX Math/PI
:baseX 2
:zBias -5
:zOrder -2}]

;; The function.
[box/Interval
[mathbox.primitives/Interval
{:width 256
:expr
(fn [emit theta _i t]
Expand All @@ -81,7 +82,7 @@
(* 3 (+ theta t)))))]
(emit theta r)))
:channels 2}]
[box/Line {:points "<"
:color 0x3090ff
:width 5}]]])}}
[mathbox.primitives/Line {:points "<"
:color 0x3090ff
:width 5}]]])}}
{:offset 0.5}
2 changes: 1 addition & 1 deletion src/deps.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
{"mathbox-react" "^0.2.2"
"mathbox" "^2.3.1"
"threestrap" "0.5.1"
"three" ">= 0.118.0 || <= 0.150.0"}}
"three" "<=0.150.0"}}