Sketchup::Geodesic (Class)

In: Geodesic_SketchUp.rb
Parent: Object

The Sketchup::Geodesic class cannot be instantiated; it is a wrapper for the Sketchup::Geodesic.create method. See that method for more details.

Methods

Constants

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 => Geom::Vector3d.new( -TETRA_S, -TETRA_Q, -TETRA_R ), :b => Geom::Vector3d.new( TETRA_S, -TETRA_Q, -TETRA_R ), :c => Geom::Vector3d.new( 0, TETRA_T, -TETRA_R ), :d => Geom::Vector3d.new( 0, 0, 1 )

Public Class methods

Adds a new geodesic dome/sphere to SketchUp inside a group.

frequency:The number of times to subdivide each face of the primitive; a frequency of 0 yields the primitive itself.
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, in inches. Defaults to 11.

If frequency is not supplied, a prompt will be shown to the user, asking for the value of the frequency and radius parameters. The number of faces in the geodesic is (faces in primitive) * 4^frequency. Note how quickly the number of faces grows:

  frequency  tetrahedron  octahedron  icosahedron
      0           4           8            20
      1          16          32            80
      2          64         128           320
      3         256         512          1280
      4        1024        2048          5120
      5        4096        8192         20480
      6       16384       32678         81920

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:

.

A frequency of 3 for an octahedron passes pretty well as a sphere (512 faces) and even a value of 2 for an icosahedron (320 faces).

Returns the new Sketchup::Group instance holding the geodesic.

Examples:

  Sketchup::Geodesic.create( 2 )                # Add an octahedron-based geodesic with radius of 36" and frequency 2
  Sketchup::Geodesic.create( 0, :tetrahedron )  # Add a tetrahedron of radius 36"
  Sketchup::Geodesic.create                     # Prompts the user for primitive, radius and frequency

Used by the Sketchup::Geodesic.create method; takes a ‘face’ (array of 3 Vector3d points), and recursively subdivides it the number of times specified by frequency; if frequency is 0, pushes the points out to a specific radius and then adds the face to entities.

[Validate]