class CrystalScad::Square

2d primitives

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/crystalscad/CrystalScad.rb, line 170
def initialize(*args)
  super(args)
              if args[0][:size].kind_of? Array
          @x,@y = args[0][:size].map{|l| l.to_f}
              else
                      @x = args[0][:size].to_f
                      @y = @x
              end          
end

Public Instance Methods

center()
Alias for: center_xy
center_x() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 190
def center_x
        @transformations << Translate.new({x:-@x/2})
        self
end
center_xy() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 184
def center_xy
        @transformations << Translate.new({x:-@x/2,y:-@y/2})
        self
end
Also aliased as: center
center_y() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 195
def center_y
        @transformations << Translate.new({y:-@y/2})
        self
end
to_rubyscad() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 180
def to_rubyscad
        return RubyScadBridge.new.square(@args)              
end