class SolidRuby::Primitives::Sphere

Public Class Methods

new(args={}) click to toggle source
Calls superclass method SolidRuby::SolidRubyObject::new
# File lib/solidruby/primitives/sphere.rb, line 21
def initialize(args={})
  d = args[:diameter] || args[:d]
  @r = args[:radius] || args[:r] || d/2.0
  super(args)
end

Public Instance Methods

get_point_on(args = {}) click to toggle source
# File lib/solidruby/primitives/sphere.rb, line 27
def get_point_on(args = {})
  #approximate a cube the size of this sphere
  args[:x] = @r*Math.sqrt(2)
  args[:y] = @r*Math.sqrt(2)
  args[:z] = @r*Math.sqrt(2)
  args[:centered] = true
  args[:centered_z] = true
  args[:transformations] = @transformations
  calculate_point_on(args)
end
to_rubyscad() click to toggle source
# File lib/solidruby/primitives/sphere.rb, line 38
def to_rubyscad
  RubyScadBridge.new.sphere(@attributes)
end