Skip to content

Commit 2487641

Browse files
committed
undo wrong rotator logic
1 parent 5f96184 commit 2487641

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

contributed/library/branch3D/rotator.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
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
86
module 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

contributed/recursive_pentagon.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# After an openprocessing sketch by C.Andrews
1+
# After an openprocessing sketch by
22
load_library :color_group
33
attr_reader :strut_factor, :renderer, :cols
44
PALETTE = %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
1414
end
1515

0 commit comments

Comments
 (0)