class SolidRuby::Primitives::Cylinder

Public Class Methods

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

Public Instance Methods

get_point_on(args = {}) click to toggle source
# File lib/solidruby/primitives/cylinder.rb, line 33
def get_point_on(args = {})
  # a cube the same size as the cylinder
  args[:x] = @r*Math.sqrt(2)
  args[:y] = @r*Math.sqrt(2)
  args[:z] = @h
  args[:centered] = true
  args[:centered_z] = false
  args[:transformations] = @transformations
  calculate_point_on(args)
end
to_rubyscad() click to toggle source
# File lib/solidruby/primitives/cylinder.rb, line 29
def to_rubyscad
  RubyScadBridge.new.cylinder(@attributes)
end