Class: Cube

Inherits:
Object show all
Defined in:
lib/roby/state/shapes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length, width, height) ⇒ Cube

Returns a new instance of Cube.



30
31
32
# File 'lib/roby/state/shapes.rb', line 30

def initialize(length, width, height)
    @length, @width, @height = length.to_f, width.to_f, height.to_f
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



28
29
30
# File 'lib/roby/state/shapes.rb', line 28

def height
  @height
end

#lengthObject

Returns the value of attribute length.



28
29
30
# File 'lib/roby/state/shapes.rb', line 28

def length
  @length
end

#widthObject

Returns the value of attribute width.



28
29
30
# File 'lib/roby/state/shapes.rb', line 28

def width
  @width
end

Instance Method Details

#max_length(axis) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/roby/state/shapes.rb', line 34

def max_length(axis)
    if axis == :z
        [length, width].max
    else
        height
    end
end