File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 11# Rotator module is required because rotate is not implemented for
22# JRubyArt 3D. Here we use Vec2D.rotate! to do Euclid rotation about an
3- # axis (we can then apply the rotation to each axis in turn) we mimic Toxiclibs
4- # Vec3D implementation
3+ # axis (we can then apply the rotation to each axis in turn)
4+ # Does not take account of processing axis convention but works OK here
55# NB: we use quaternions in ArcBall (to avoid gimbal lock)
6- # See:
7- # https://medium.com/@behreajj/3d-rotations-in-processing-vectors-matrices-quaternions-10e2fed5f0a3
86module Rotate
97 def self . axis! ( axis , vec , theta )
108 array = vec . to_a
119 array . slice! axis
1210 other = Vec2D . new ( *array ) . rotate! theta
1311 case axis
1412 when 0 # xaxis
15- vec . y = other . y
16- vec . z = other . x
13+ vec . y = other . x
14+ vec . z = other . y
1715 when 1 # yaxis
1816 vec . x = other . x
1917 vec . z = other . y
Original file line number Diff line number Diff line change 1- # After an openprocessing sketch by C.Andrews
1+ # After an openprocessing sketch by
22load_library :color_group
33attr_reader :strut_factor , :renderer , :cols
44PALETTE = %w[ #fff0a5 #ffd500 #594a00 #9999ff #000059 ] . freeze
@@ -9,7 +9,7 @@ def setup
99 @renderer = AppRender . new self # so we can send Vec2D :to_vertex
1010 group = ColorGroup . from_web_array ( PALETTE . to_java ( :string ) )
1111 @cols = group . colors
12- background ( 0 )
12+ background ( cols . last )
1313 no_loop
1414end
1515
You can’t perform that action at this time.
0 commit comments