propane 0.8.0-java → 0.9.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/lib/propane/app.rb +56 -55
- data/lib/propane/creators/sketch_writer.rb +7 -3
- data/lib/propane/helper_methods.rb +40 -29
- data/lib/propane/runner.rb +3 -2
- data/lib/propane/version.rb +1 -1
- data/pom.rb +1 -1
- data/pom.xml +1 -1
- data/vendors/Rakefile +31 -1
- metadata +2 -59
- data/examples/data_path/Rakefile +0 -32
- data/examples/data_path/bw_shader.rb +0 -47
- data/examples/data_path/data/Texture01.jpg +0 -0
- data/examples/data_path/data/Texture02.jpg +0 -0
- data/examples/data_path/data/Univers45.vlw +0 -0
- data/examples/data_path/data/bwfrag.glsl +0 -23
- data/examples/data_path/data/displaceFrag.glsl +0 -8
- data/examples/data_path/data/displaceVert.glsl +0 -201
- data/examples/data_path/data/lachoy.jpg +0 -0
- data/examples/data_path/data/landscape.glsl +0 -352
- data/examples/data_path/data/monjori.glsl +0 -30
- data/examples/data_path/data/moon.jpg +0 -0
- data/examples/data_path/data/sea.jpg +0 -0
- data/examples/data_path/edge_detection.rb +0 -49
- data/examples/data_path/glsl_heightmap_noise.rb +0 -125
- data/examples/data_path/kinetic_type.rb +0 -79
- data/examples/data_path/landscape.rb +0 -34
- data/examples/data_path/linear_image.rb +0 -51
- data/examples/data_path/monjori.rb +0 -35
- data/examples/regular/Rakefile +0 -30
- data/examples/regular/arcball_box.rb +0 -28
- data/examples/regular/arcball_constrain.rb +0 -29
- data/examples/regular/bezier_playground.rb +0 -206
- data/examples/regular/circle_collision.rb +0 -118
- data/examples/regular/colors_two.rb +0 -60
- data/examples/regular/creating_colors.rb +0 -64
- data/examples/regular/drawolver.rb +0 -93
- data/examples/regular/elegant_ball.rb +0 -159
- data/examples/regular/empathy.rb +0 -80
- data/examples/regular/fern.rb +0 -57
- data/examples/regular/fibonacci_sphere.rb +0 -91
- data/examples/regular/flight_patterns.rb +0 -64
- data/examples/regular/fractions.rb +0 -32
- data/examples/regular/grapher.rb +0 -40
- data/examples/regular/gravity.rb +0 -120
- data/examples/regular/grey_circles.rb +0 -28
- data/examples/regular/jwishy.rb +0 -99
- data/examples/regular/letters.rb +0 -42
- data/examples/regular/lib/boundary.rb +0 -38
- data/examples/regular/lib/particle.rb +0 -77
- data/examples/regular/lib/particle_system.rb +0 -111
- data/examples/regular/lib/rain_drops.rb +0 -54
- data/examples/regular/liquidy.rb +0 -41
- data/examples/regular/mouse_button_demo.rb +0 -32
- data/examples/regular/polyhedrons.rb +0 -249
- data/examples/regular/raining.rb +0 -60
- data/examples/regular/ribbon_doodle.rb +0 -89
- data/examples/regular/select_file.rb +0 -32
- data/examples/regular/select_image.rb +0 -40
- data/examples/regular/slider_demo.rb +0 -61
- data/examples/regular/slider_example.rb +0 -53
- data/examples/regular/slider_simple.rb +0 -47
- data/examples/regular/tree.rb +0 -76
- data/examples/regular/vector_math.rb +0 -37
- data/examples/regular/words.rb +0 -41
- data/lib/propane/helpers/string_extra.rb +0 -45
- data/lib/propane/underscorer.rb +0 -19
@@ -1,77 +0,0 @@
|
|
1
|
-
# Note the particle class change method is use to change color to red
|
2
|
-
# when two particles collide (no change just hitting boundary)
|
3
|
-
class Particle
|
4
|
-
extend Forwardable
|
5
|
-
def_delegators(:@app, :box2d, :begin_shape, :color, :end_shape, :line,
|
6
|
-
:pop_matrix, :ellipse, :translate, :rotate, :stroke,
|
7
|
-
:push_matrix, :fill, :no_fill, :stroke_weight)
|
8
|
-
attr_accessor :body
|
9
|
-
attr_reader :radius, :col
|
10
|
-
|
11
|
-
def initialize(app, x, y, r)
|
12
|
-
@app, @x, @y, @radius = app, x, y, r
|
13
|
-
# This function puts the particle in the Box2d world
|
14
|
-
make_body(x, y, radius)
|
15
|
-
@col = color('#c0c0c0') # silvergrey
|
16
|
-
body.setUserData(self)
|
17
|
-
end
|
18
|
-
|
19
|
-
# This function removes the particle from the box2d world
|
20
|
-
def kill_body
|
21
|
-
box2d.destroy_body(body)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Change color when hit
|
25
|
-
def change
|
26
|
-
@col = color('#cc0000') # red
|
27
|
-
end
|
28
|
-
|
29
|
-
# Is the particle ready for deletion?
|
30
|
-
def done
|
31
|
-
# Let's find the screen position of the particle
|
32
|
-
pos = box2d.body_coord(body)
|
33
|
-
# Is it off the bottom of the screen?
|
34
|
-
return false unless pos.y > (box2d.height + radius * 2)
|
35
|
-
kill_body
|
36
|
-
true
|
37
|
-
end
|
38
|
-
|
39
|
-
def display
|
40
|
-
# We look at each body and get its screen position
|
41
|
-
pos = box2d.body_coord(body)
|
42
|
-
# Get its angle of rotation
|
43
|
-
a = body.get_angle
|
44
|
-
push_matrix
|
45
|
-
translate(pos.x, pos.y)
|
46
|
-
rotate(a)
|
47
|
-
fill(col)
|
48
|
-
stroke(0)
|
49
|
-
stroke_weight(1)
|
50
|
-
ellipse(0, 0, radius * 2, radius * 2)
|
51
|
-
# Let's add a line so we can see the rotation
|
52
|
-
line(0, 0, radius, 0)
|
53
|
-
pop_matrix
|
54
|
-
end
|
55
|
-
|
56
|
-
# Here's our function that adds the particle to the Box2D world
|
57
|
-
def make_body(x, y, r)
|
58
|
-
# Define a body
|
59
|
-
bd = BodyDef.new
|
60
|
-
# Set its position
|
61
|
-
bd.position = box2d.processing_to_world(x, y)
|
62
|
-
bd.type = BodyType::DYNAMIC
|
63
|
-
@body = box2d.create_body(bd)
|
64
|
-
# Make the body's shape a circle
|
65
|
-
cs = CircleShape.new
|
66
|
-
cs.m_radius = box2d.scale_to_world(r)
|
67
|
-
fd = FixtureDef.new
|
68
|
-
fd.shape = cs
|
69
|
-
# Parameters that affect physics
|
70
|
-
fd.density = 1
|
71
|
-
fd.friction = 0.01
|
72
|
-
fd.restitution = 0.3
|
73
|
-
# Attach fixture to body
|
74
|
-
body.create_fixture(fd)
|
75
|
-
body.set_angular_velocity(rand(-10.0..10))
|
76
|
-
end
|
77
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
module Runnable
|
4
|
-
def run
|
5
|
-
reject!(&:done)
|
6
|
-
each(&:display)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
# Not be confused with the jbox2d ParticleSystem
|
11
|
-
class ParticleSystem
|
12
|
-
include Enumerable, Runnable
|
13
|
-
extend Forwardable
|
14
|
-
def_delegators(:@particles, :each, :reject!, :<<, :empty?)
|
15
|
-
def_delegator(:@particles, :empty?, :dead?)
|
16
|
-
|
17
|
-
attr_reader :x, :y
|
18
|
-
|
19
|
-
def initialize(bd, num, x, y)
|
20
|
-
@particles = [] # Initialize the Array
|
21
|
-
@x, @y = x, y # Store the origin point
|
22
|
-
num.times do
|
23
|
-
self << Particle.new(bd, x, y)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def add_particles(bd, n)
|
28
|
-
n.times do
|
29
|
-
self << Particle.new(bd, x, y)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# A Particle
|
35
|
-
require 'pbox2d'
|
36
|
-
|
37
|
-
class Particle
|
38
|
-
include Propane::Proxy
|
39
|
-
TRAIL_SIZE = 6
|
40
|
-
# We need to keep track of a Body
|
41
|
-
|
42
|
-
attr_reader :trail, :body, :box2d
|
43
|
-
|
44
|
-
# Constructor
|
45
|
-
def initialize(b2d, x, y)
|
46
|
-
@box2d = b2d
|
47
|
-
@trail = Array.new(TRAIL_SIZE, [x, y])
|
48
|
-
# Add the box to the box2d world
|
49
|
-
# Here's a little trick, let's make a tiny tiny radius
|
50
|
-
# This way we have collisions, but they don't overwhelm the system
|
51
|
-
make_body(x, y, 0.2)
|
52
|
-
end
|
53
|
-
|
54
|
-
# This function removes the particle from the box2d world
|
55
|
-
def kill_body
|
56
|
-
box2d.destroy_body(body)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Is the particle ready for deletion?
|
60
|
-
def done
|
61
|
-
# Let's find the screen position of the particle
|
62
|
-
pos = box2d.body_coord(body)
|
63
|
-
# Is it off the bottom of the screen?
|
64
|
-
return false unless pos.y > box2d.height + 20
|
65
|
-
kill_body
|
66
|
-
true
|
67
|
-
end
|
68
|
-
|
69
|
-
# Drawing the box
|
70
|
-
def display
|
71
|
-
# We look at each body and get its screen position
|
72
|
-
pos = box2d.body_coord(body)
|
73
|
-
# Keep track of a history of screen positions in an array
|
74
|
-
(TRAIL_SIZE - 1).times do |i|
|
75
|
-
trail[i] = trail[i + 1]
|
76
|
-
end
|
77
|
-
trail[TRAIL_SIZE - 1] = [pos.x, pos.y]
|
78
|
-
# Draw particle as a trail
|
79
|
-
begin_shape
|
80
|
-
no_fill
|
81
|
-
stroke_weight(2)
|
82
|
-
stroke(0, 150)
|
83
|
-
trail.each do |v|
|
84
|
-
vertex(v[0], v[1])
|
85
|
-
end
|
86
|
-
end_shape
|
87
|
-
end
|
88
|
-
|
89
|
-
# This function adds the rectangle to the box2d world
|
90
|
-
def make_body(x, y, r)
|
91
|
-
# Define and create the body
|
92
|
-
bd = BodyDef.new
|
93
|
-
bd.type = BodyType::DYNAMIC
|
94
|
-
bd.position.set(box2d.processing_to_world(x, y))
|
95
|
-
@body = box2d.create_body(bd)
|
96
|
-
# Give it some initial random velocity
|
97
|
-
body.set_linear_velocity(Vec2.new(rand(-1.0..1), rand(-1.0..1)))
|
98
|
-
# Make the body's shape a circle
|
99
|
-
cs = CircleShape.new
|
100
|
-
cs.m_radius = box2d.scale_to_world(r)
|
101
|
-
fd = FixtureDef.new
|
102
|
-
fd.shape = cs
|
103
|
-
fd.density = 1
|
104
|
-
fd.friction = 0 # Slippery when wet!
|
105
|
-
fd.restitution = 0.5
|
106
|
-
# We could use this if we want to turn collisions off
|
107
|
-
# cd.filter.groupIndex = -10
|
108
|
-
# Attach fixture to body
|
109
|
-
body.create_fixture(fd)
|
110
|
-
end
|
111
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
module Runnable
|
4
|
-
def run
|
5
|
-
reject!(&:dead?)
|
6
|
-
each(&:display)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class RainDrops
|
11
|
-
include Enumerable, Runnable
|
12
|
-
extend Forwardable
|
13
|
-
|
14
|
-
def_delegators(:@drops, :<<, :each, :reject!, :size)
|
15
|
-
|
16
|
-
attr_reader :drops, :width, :height #, :weight
|
17
|
-
|
18
|
-
def initialize(width, height)
|
19
|
-
@drops = []
|
20
|
-
@width = width
|
21
|
-
@height = height
|
22
|
-
end
|
23
|
-
|
24
|
-
def fill_up(weight)
|
25
|
-
# @weight = weight
|
26
|
-
drops << Drop.new(rand(width), rand(height / 2) - height / 2, weight)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class Drop
|
31
|
-
include Propane::Proxy
|
32
|
-
attr_reader :weight, :x, :y
|
33
|
-
|
34
|
-
def initialize(x, y, weight = nil)
|
35
|
-
@weight = weight || 10
|
36
|
-
@x, @y = x, y
|
37
|
-
end
|
38
|
-
|
39
|
-
def render
|
40
|
-
fill(100, 100, 200)
|
41
|
-
no_stroke
|
42
|
-
bezier(x, y, x - (weight / 2), y + weight, x + (weight / 2), y + weight, x, y)
|
43
|
-
end
|
44
|
-
|
45
|
-
def dead?
|
46
|
-
@y > height
|
47
|
-
end
|
48
|
-
|
49
|
-
def display
|
50
|
-
@y = y + weight
|
51
|
-
@x = x - rand(-3..3)
|
52
|
-
render
|
53
|
-
end
|
54
|
-
end
|
data/examples/regular/liquidy.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby -v -W2
|
2
|
-
require 'propane'
|
3
|
-
require 'pbox2d'
|
4
|
-
require_relative 'lib/particle_system'
|
5
|
-
require_relative 'lib/boundary'
|
6
|
-
|
7
|
-
Vect = Struct.new(:x, :y)
|
8
|
-
|
9
|
-
class Liquidy < Propane::App
|
10
|
-
attr_reader :box2d, :boundaries, :systems
|
11
|
-
|
12
|
-
def setup
|
13
|
-
size(400, 300)
|
14
|
-
@box2d = WorldBuilder.build(app: self, gravity: [0, -20])
|
15
|
-
@systems = []
|
16
|
-
@boundaries = [
|
17
|
-
Boundary.new(box2d, Vect.new(50, 100), Vect.new(300, 5), -0.3),
|
18
|
-
Boundary.new(box2d, Vect.new(250, 175), Vect.new(300, 5), 0.5)
|
19
|
-
]
|
20
|
-
end
|
21
|
-
|
22
|
-
def draw
|
23
|
-
background(255)
|
24
|
-
# Run all the particle systems
|
25
|
-
if systems.size > 0
|
26
|
-
systems.each do |system|
|
27
|
-
system.run
|
28
|
-
system.add_particles(box2d, rand(0..2))
|
29
|
-
end
|
30
|
-
end
|
31
|
-
# Display all the boundaries
|
32
|
-
boundaries.each(&:display)
|
33
|
-
end
|
34
|
-
|
35
|
-
def mouse_pressed
|
36
|
-
# Add a new Particle System whenever the mouse is clicked
|
37
|
-
systems << ParticleSystem.new(box2d, 0, mouse_x, mouse_y)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
Liquidy.new title: 'Liquidy'
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby -v -W2
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require_relative 'propane'
|
5
|
-
# Demo of Mouse Button
|
6
|
-
class MouseButtonDemo < Propane::App
|
7
|
-
# Click within the image and press
|
8
|
-
# the left and right mouse buttons to
|
9
|
-
# change the value of the rectangle
|
10
|
-
def setup
|
11
|
-
size 300, 200
|
12
|
-
end
|
13
|
-
|
14
|
-
def draw
|
15
|
-
rect(25, 25, 150, 80)
|
16
|
-
end
|
17
|
-
|
18
|
-
def mouse_pressed
|
19
|
-
case mouse_button
|
20
|
-
when LEFT
|
21
|
-
fill 0
|
22
|
-
when RIGHT
|
23
|
-
fill 255
|
24
|
-
when CENTER
|
25
|
-
fill 125
|
26
|
-
else
|
27
|
-
fill 200, 0, 0
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
MouseButtonDemo.new title: 'Mouse Button Demo'
|
@@ -1,249 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby -v -W2
|
2
|
-
###
|
3
|
-
# Polyhedrons after sketch by Chinchbug on openprocessing.org
|
4
|
-
###
|
5
|
-
Vert = Struct.new(:x, :y, :z) do
|
6
|
-
def dist_sq(v)
|
7
|
-
(x - v.x) * (x - v.x) + (y - v.y) * (y - v.y) + (z - v.z) * (z - v.z)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.permutations(x, y, z)
|
11
|
-
[new(x, y, z), new(z, x, y), new(y, z, x)]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
PHI = (1 + Math.sqrt(5)) / 2
|
16
|
-
PHI_SQ = PHI * PHI
|
17
|
-
PHI_CU = PHI * PHI * PHI
|
18
|
-
ROOT2 = Math.sqrt(2)
|
19
|
-
TYPE = "Type Archimedian\nFaces: "
|
20
|
-
|
21
|
-
require 'propane'
|
22
|
-
|
23
|
-
class Polyhedrons < Propane::App
|
24
|
-
|
25
|
-
attr_reader :verts, :curr_id, :scayl, :ang, :spd, :name, :notes, :off_x, :off_y
|
26
|
-
attr_reader :off_z, :len_edge
|
27
|
-
|
28
|
-
def setup
|
29
|
-
size(1020, 576, P3D)
|
30
|
-
smooth 4
|
31
|
-
text_size(14)
|
32
|
-
# some positional variables for translation
|
33
|
-
@off_y = height / 2
|
34
|
-
@off_x = width / 2 - 100
|
35
|
-
@off_z = -off_y / 8
|
36
|
-
# angle and speed for rotation
|
37
|
-
@ang = 0.0
|
38
|
-
@spd = 0.015
|
39
|
-
# set up initial polyhedron
|
40
|
-
@verts = []
|
41
|
-
@curr_id = 0
|
42
|
-
create_poly(curr_id)
|
43
|
-
end
|
44
|
-
|
45
|
-
def draw
|
46
|
-
# setup the view
|
47
|
-
background(200)
|
48
|
-
push_matrix
|
49
|
-
translate(off_x, off_y, off_z)
|
50
|
-
rotate_x(Math.sin(-ang * 0.3) * 0.5)
|
51
|
-
rotate_y(ang)
|
52
|
-
draw_axis
|
53
|
-
# draw the polyhedron
|
54
|
-
stroke_weight(0.75)
|
55
|
-
stroke(0)
|
56
|
-
(0...verts.size).each do |i|
|
57
|
-
(i...verts.size).each do |j|
|
58
|
-
draw_line(verts[i], verts[j]) if edge?(verts[i], verts[j])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
pop_matrix
|
62
|
-
hint(DISABLE_DEPTH_TEST)
|
63
|
-
# show some notes
|
64
|
-
fill(80, 50, 20)
|
65
|
-
text(name, width - 360, 50)
|
66
|
-
text(notes, width - 340, 70)
|
67
|
-
text('Click to view next polyhedron...', width - 360, height - 50)
|
68
|
-
hint(ENABLE_DEPTH_TEST)
|
69
|
-
# bump up the angle for the spin
|
70
|
-
@ang += spd
|
71
|
-
end
|
72
|
-
|
73
|
-
def mouse_released
|
74
|
-
# change the polyhedron
|
75
|
-
create_poly(@curr_id += 1)
|
76
|
-
end
|
77
|
-
|
78
|
-
def draw_line(v1, v2)
|
79
|
-
# Draws an edge line
|
80
|
-
line(v1.x * scayl, v1.y * scayl, v1.z * scayl, v2.x * scayl, v2.y * scayl, v2.z * scayl)
|
81
|
-
end
|
82
|
-
|
83
|
-
def edge?(v1, v2)
|
84
|
-
# had some rounding errors, now a bit more forgiving...
|
85
|
-
pres = 1000
|
86
|
-
d = v1.dist_sq(v2) + 0.00001
|
87
|
-
((d * pres).round == (len_edge * len_edge * pres).round)
|
88
|
-
end
|
89
|
-
|
90
|
-
def add_verts(x, y, z)
|
91
|
-
# adds the requested vert and all 'mirrored' verts
|
92
|
-
verts << Vert.new(x, y, z)
|
93
|
-
verts << Vert.new(x, y, -z) unless (z == 0.0)
|
94
|
-
verts << Vert.new(x, -y, z) unless (y == 0.0)
|
95
|
-
verts << Vert.new(x, -y, -z) unless (z == 0.0)
|
96
|
-
verts << Vert.new(-x, y, z) unless (x == 0.0)
|
97
|
-
verts << Vert.new(-x, y, -z) unless (z == 0.0)
|
98
|
-
verts << Vert.new(-x, -y, z) unless (y == 0.0)
|
99
|
-
verts << Vert.new(-x, -y, -z) unless (z == 0.0)
|
100
|
-
end
|
101
|
-
|
102
|
-
def permutations(x, y, z)
|
103
|
-
# adds vertices for all three permutations of x, y, and z
|
104
|
-
Vert.permutations(x, y, z).each { |v| add_verts(v.x, v.y, v.z) }
|
105
|
-
end
|
106
|
-
|
107
|
-
def draw_axis
|
108
|
-
# based off how Sketchup handles their axis
|
109
|
-
stroke_weight(0.5)
|
110
|
-
stroke(0, 128, 0)
|
111
|
-
line(-300, 0, 0, 0, 0, 0)
|
112
|
-
stroke(0, 0, 128)
|
113
|
-
line(0, -300, 0, 0, 0, 0)
|
114
|
-
stroke(128, 0, 0)
|
115
|
-
line(0, 0, -300, 0, 0, 0)
|
116
|
-
stroke_weight(0.25)
|
117
|
-
stroke(0, 128, 0)
|
118
|
-
line(300, 0, 0, 0, 0, 0)
|
119
|
-
stroke(0, 0, 128)
|
120
|
-
line(0, 300, 0, 0, 0, 0)
|
121
|
-
stroke(128, 0, 0)
|
122
|
-
line(0, 0, 300, 0, 0, 0)
|
123
|
-
end
|
124
|
-
|
125
|
-
def create_poly(id)
|
126
|
-
# This is where the actual defining of the polyhedrons takes place
|
127
|
-
verts.clear # clear out whatever verts are currently defined
|
128
|
-
case (id)
|
129
|
-
when 0
|
130
|
-
@name = 'Cube:'
|
131
|
-
@notes = "Type platonic\nFaces: 6 squares\nVertices 8\nEdges 12"
|
132
|
-
add_verts(1, 1, 1)
|
133
|
-
@len_edge = 2
|
134
|
-
@scayl = 140
|
135
|
-
when 1
|
136
|
-
@name = 'Octohedron:'
|
137
|
-
@notes = "Type platonic\nFaces: 8 triangles\nVertices 6\nEdges 12"
|
138
|
-
permutations(1, 0, 0)
|
139
|
-
@len_edge = ROOT2
|
140
|
-
@scayl = 220
|
141
|
-
when 2
|
142
|
-
@name = 'Dodecahedron:'
|
143
|
-
@notes = "Type platonic\nFaces: 12 pentagons\nVertices 20\nEdges 30"
|
144
|
-
add_verts(1, 1, 1)
|
145
|
-
permutations(0, 1 / PHI, PHI)
|
146
|
-
@len_edge = 2 / PHI
|
147
|
-
@scayl = 130
|
148
|
-
when 3
|
149
|
-
@name = 'Icosahedron:'
|
150
|
-
@notes = "Type platonic\nFaces: 20 triangles\nVertices 12\nEdges 30"
|
151
|
-
permutations(0, 1, PHI)
|
152
|
-
@len_edge = 2.0
|
153
|
-
@scayl = 120
|
154
|
-
when 4
|
155
|
-
@name = 'Rhombic Dodecahedron:'
|
156
|
-
@notes = "Type Catalan\nFaces: 12 rhombuses\nVertices 14\nEdges 24"
|
157
|
-
add_verts(1, 1, 1)
|
158
|
-
permutations(0, 0, 2)
|
159
|
-
@len_edge = Math.sqrt(3)
|
160
|
-
@scayl = 110
|
161
|
-
when 5
|
162
|
-
@name = 'Rhombic Triacontahedron:'
|
163
|
-
@notes = "Type Catalan\nFaces: 30 rhombuses\nVertices 32\nEdges 60"
|
164
|
-
add_verts(PHI_SQ, PHI_SQ, PHI_SQ)
|
165
|
-
permutations(PHI_SQ, 0, PHI_CU)
|
166
|
-
permutations(0, PHI, PHI_CU)
|
167
|
-
@len_edge = PHI * Math.sqrt(PHI + 2)
|
168
|
-
@scayl = 46
|
169
|
-
when 6
|
170
|
-
@name = 'Cuboctahedron:'
|
171
|
-
@notes = format("%s %d triangles, 6 squares\nVertices 12\nEdges 24", TYPE, 8)
|
172
|
-
permutations(1, 0, 1)
|
173
|
-
@len_edge = ROOT2
|
174
|
-
@scayl = 170
|
175
|
-
when 7
|
176
|
-
@name = 'Truncated Cube:'
|
177
|
-
@notes = format("%s %d triangles, 6 octogons\nVertices 24\nEdges 36", TYPE, 8)
|
178
|
-
permutations(ROOT2 - 1, 1, 1)
|
179
|
-
@len_edge = 2 * (ROOT2 - 1)
|
180
|
-
@scayl = 155
|
181
|
-
when 8
|
182
|
-
@name = 'Truncated Octahedron:'
|
183
|
-
@notes = format("%s %d squares, 8 hexagons\nVertices 24\nEdges 36", TYPE, 6)
|
184
|
-
permutations(0, 1, 2)
|
185
|
-
permutations(2, 1, 0)
|
186
|
-
@len_edge = ROOT2
|
187
|
-
@scayl = 100
|
188
|
-
when 9
|
189
|
-
@name = 'Rhombicuboctahedron:'
|
190
|
-
@notes = format("%s %d triangles, 18 squares\nVertices 24\nEdges 48", TYPE, 8)
|
191
|
-
permutations(ROOT2 + 1, 1, 1)
|
192
|
-
@len_edge = 2
|
193
|
-
@scayl = 80
|
194
|
-
when 10
|
195
|
-
@name = 'Truncated Cuboctahedron:'
|
196
|
-
@notes = format("%s %d squares, 8 hexagons, 6 octogons\nVertices 48\nEdges 72", TYPE, 12)
|
197
|
-
permutations(ROOT2 + 1, 2 * ROOT2 + 1, 1)
|
198
|
-
permutations(ROOT2 + 1, 1, 2 * ROOT2 + 1)
|
199
|
-
@len_edge = 2
|
200
|
-
@scayl = 50
|
201
|
-
when 11
|
202
|
-
@name = 'Icosidodecahedron:'
|
203
|
-
@notes = format("%s %d triangles, 12 pentagons\nVertices 30\nEdges 60", TYPE, 20)
|
204
|
-
permutations(0, 0, 2 * PHI)
|
205
|
-
permutations(1, PHI, PHI_SQ)
|
206
|
-
@len_edge = 2
|
207
|
-
@scayl = 70
|
208
|
-
when 12
|
209
|
-
@name = 'Truncated Dodecahedron:'
|
210
|
-
@notes = format("%s %d triangles, 12 decagons\nVertices 60\nEdges 90", TYPE, 20)
|
211
|
-
permutations(0, 1 / PHI, PHI + 2)
|
212
|
-
permutations(1 / PHI, PHI, 2 * PHI)
|
213
|
-
permutations(PHI, 2, PHI_SQ)
|
214
|
-
@len_edge = 2 * (PHI - 1)
|
215
|
-
@scayl = 60
|
216
|
-
when 13
|
217
|
-
@name = 'Truncated Icosahedron:'
|
218
|
-
@notes = format("%s %d pentagons, 20 hexagons\nVertices 60\nEdges 90", TYPE, 12)
|
219
|
-
permutations(0, 1, 3 * PHI)
|
220
|
-
permutations(2, 2 * PHI + 1, PHI)
|
221
|
-
permutations(1, PHI + 2, 2 * PHI)
|
222
|
-
@len_edge = 2
|
223
|
-
@scayl = 45
|
224
|
-
when 14
|
225
|
-
@name = 'Small Rhombicosidodecahedron:'
|
226
|
-
@notes = format("%s %d triangles, 30 squares, 12 pentagons\nVertices 60\nEdges 120", TYPE, 20)
|
227
|
-
permutations(1, 1, PHI_CU)
|
228
|
-
permutations(PHI_SQ, PHI, 2 * PHI)
|
229
|
-
permutations(PHI + 2, 0, PHI_SQ)
|
230
|
-
@len_edge = 2
|
231
|
-
@scayl = 50
|
232
|
-
when 15
|
233
|
-
@name = 'Great Rhombicosidodecahedron:'
|
234
|
-
@notes = format("%s %d squares, 20 hexagons, 12 decagons\nVertices 120\nEdges 180", TYPE, 30)
|
235
|
-
permutations(1 / PHI, 1 / PHI, PHI + 3)
|
236
|
-
permutations(2 / PHI, PHI, 2 * PHI + 1)
|
237
|
-
permutations(1 / PHI, PHI_SQ, 3 * PHI - 1)
|
238
|
-
permutations(2 * PHI - 1, 2, PHI + 2)
|
239
|
-
permutations(PHI, 3, 2 * PHI)
|
240
|
-
@len_edge = 2 * PHI - 2
|
241
|
-
@scayl = 48
|
242
|
-
else # start again
|
243
|
-
@curr_id = 0
|
244
|
-
create_poly(curr_id)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
Polyhedrons.new title: 'Polyhedrons'
|