sine_box_spheres
— How big do we want our waves?
amplitude = 20
— Hard variables, cannot be changed
hiFreqFactor = 1.33333333333333 –the long segments must have a different frequency to match up
hiFreqShifter = 67.5 — each long segment completes the unit circle in 3/4 time of the short segment
shifter = 90
— Dimensions for spheres
.radius = 23
nsides = 20
— Functions to calculate wave slices that specify what chunk of wave
— we want in relation to a unit circle. These are necessary to ensure
— that our waves flow together smoothly at corners.
to calcLongHorizontalSlice i = amplitude * cos(hiFreqFactor * (i – hiFreqShifter))
to calcLongVerticalSlice i = amplitude * sin(hiFreqFactor * i)
to calcShortHorizontalSlice i = amplitude * cos(i-shifter)
to calcShortVerticalSlice i = -amplitude * sin(i)
–horizontal through 0, 0
for x in 0, 10..180
z = calcShortHorizontalSlice x
moveto x-shifter, 0, z
end
–central bottom horizontal
for x in 0, 10..180
z = calcShortHorizontalSlice x
moveto x, y-shifter, z
end
–central top horizontal
for x in 0, 10..180
z = calcShortHorizontalSlice x
moveto x – 2 * shifter, y + shifter, z
end
–upper horizontal
for x in 0, 10..270
z = calcLongHorizontalSlice x
moveto x – shifter, y + 2 * shifter, z
end
–lower horizontal
for x in 0, 10..270
z = -1 * calcLongHorizontalSlice x
moveto x – 2 * shifter, y – 2 * shifter, z
end
–right-most vertical
for y in 0, 10..270
z = -1 * calcLongVerticalSlice y
moveto 2 * shifter, y – shifter, z
end
— left-most vertical
for y in 0, 10..270
z = calcLongVerticalSlice y
moveto -2 * shifter, y – 2 * shifter, z
end
–central right vertical
for y in 0, 10..180
z = calcShortVerticalSlice y
moveto shifter, y – 2 * shifter, z
end
–central left vertical
for y in 0, 10..180
z = calcShortVerticalSlice y
moveto -1 * shifter, y, z
end
–vertical through 0, 0
for y in 0, 10..180
z = calcShortVerticalSlice y
moveto 0, y – shifter, z
end
spheres