File tree 2 files changed +6
-8
lines changed
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
1
# Rotator module is required because rotate is not implemented for
2
2
# 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
5
5
# 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
8
6
module Rotate
9
7
def self . axis! ( axis , vec , theta )
10
8
array = vec . to_a
11
9
array . slice! axis
12
10
other = Vec2D . new ( *array ) . rotate! theta
13
11
case axis
14
12
when 0 # xaxis
15
- vec . y = other . y
16
- vec . z = other . x
13
+ vec . y = other . x
14
+ vec . z = other . y
17
15
when 1 # yaxis
18
16
vec . x = other . x
19
17
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
2
2
load_library :color_group
3
3
attr_reader :strut_factor , :renderer , :cols
4
4
PALETTE = %w[ #fff0a5 #ffd500 #594a00 #9999ff #000059 ] . freeze
@@ -9,7 +9,7 @@ def setup
9
9
@renderer = AppRender . new self # so we can send Vec2D :to_vertex
10
10
group = ColorGroup . from_web_array ( PALETTE . to_java ( :string ) )
11
11
@cols = group . colors
12
- background ( 0 )
12
+ background ( cols . last )
13
13
no_loop
14
14
end
15
15
You can’t perform that action at this time.
0 commit comments