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.



20
21
22
# File 'lib/roby/state/shapes.rb', line 20

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.



19
20
21
# File 'lib/roby/state/shapes.rb', line 19

def height
  @height
end

#lengthObject

Returns the value of attribute length.



19
20
21
# File 'lib/roby/state/shapes.rb', line 19

def length
  @length
end

#widthObject

Returns the value of attribute width.



19
20
21
# File 'lib/roby/state/shapes.rb', line 19

def width
  @width
end

Instance Method Details

#max_length(axis) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/roby/state/shapes.rb', line 24

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