In: |
Geodesic.rb
|
Parent: | Object |
Represents a Geodesic dome/sphere; the object is comprised of an array of Face instances, each specified in counter-clockwise order.
SQRT2 | = | Math.sqrt(2) |
SQRT3 | = | Math.sqrt(3) |
TETRA_Q | = | SQRT2 / 3 |
TETRA_R | = | 1.0 / 3 |
TETRA_S | = | SQRT2 / SQRT3 |
TETRA_T | = | 2 * SQRT2 / 3 |
GOLDEN_MEAN | = | (Math.sqrt(5)+1)/2 |
PRIMITIVES | = | { :tetrahedron => { :points => { :a => Vector[ -TETRA_S, -TETRA_Q, -TETRA_R ], :b => Vector[ TETRA_S, -TETRA_Q, -TETRA_R ], :c => Vector[ 0, TETRA_T, -TETRA_R ], :d => Vector[ 0, 0, 1 ] |
Creates a new Geodesic dome/sphere of specified radius about the origin.
frequency: | The number of times to subdivide each face of the primitive; a frequency of 0 yields the primitive itself. Defaults to 1. |
primitive: | The type of primitive to use as a basis for the geodesic. May be one of :tetrahedron, :octahedron, or :icosahedron. Defaults to :octahedron. |
radius: | An initial radius for the geodesic. Defaults to 1. |
The number of faces in the Geodesic is (faces in primitive) * (frequency+1)^2:
freq tetra octa icosa 0 4 8 20 1 16 32 80 2 36 72 180 3 64 128 320 4 100 200 500 5 144 288 720 6 196 392 980 7 256 512 1280 8 324 648 1620 9 400 800 2000 10 484 968 2420 11 576 1152 2880 12 676 1352 3380 13 784 1568 3920 14 900 1800 4500 15 1024 2048 5120 16 1156 2312 5780 17 1296 2592 6480 18 1444 2888 7220 19 1600 3200 8000 : : : :
For this reason, you should take care not to specify an overly-large frequency value. The following graphic gives a visual depiction of the frequency value:
.