Class: Triangle
- Inherits:
-
Object
- Object
- Triangle
- Defined in:
- lib/r2d/triangle.rb
Overview
triangle.rb
Instance Attribute Summary collapse
-
#c1 ⇒ Object
Returns the value of attribute c1.
-
#c2 ⇒ Object
Returns the value of attribute c2.
-
#c3 ⇒ Object
Returns the value of attribute c3.
-
#color ⇒ Object
Returns the value of attribute color.
-
#x1 ⇒ Object
Returns the value of attribute x1.
-
#x2 ⇒ Object
Returns the value of attribute x2.
-
#x3 ⇒ Object
Returns the value of attribute x3.
-
#y1 ⇒ Object
Returns the value of attribute y1.
-
#y2 ⇒ Object
Returns the value of attribute y2.
-
#y3 ⇒ Object
Returns the value of attribute y3.
Instance Method Summary collapse
- #add ⇒ Object
-
#initialize(x1, y1, x2, y2, x3, y3, c = "white", visible = true) ⇒ Triangle
constructor
A new instance of Triangle.
- #remove ⇒ Object
Constructor Details
#initialize(x1, y1, x2, y2, x3, y3, c = "white", visible = true) ⇒ Triangle
Returns a new instance of Triangle.
10 11 12 13 14 15 16 17 |
# File 'lib/r2d/triangle.rb', line 10 def initialize(x1, y1, x2, y2, x3, y3, c="white", visible=true) @x1, @y1 = x1, y1 @x2, @y2 = x2, y2 @x3, @y3 = x3, y3 @color = c update_color(c) if visible then add end end |
Instance Attribute Details
#c1 ⇒ Object
Returns the value of attribute c1.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def c1 @c1 end |
#c2 ⇒ Object
Returns the value of attribute c2.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def c2 @c2 end |
#c3 ⇒ Object
Returns the value of attribute c3.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def c3 @c3 end |
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/r2d/triangle.rb', line 8 def color @color end |
#x1 ⇒ Object
Returns the value of attribute x1.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def x2 @x2 end |
#x3 ⇒ Object
Returns the value of attribute x3.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def x3 @x3 end |
#y1 ⇒ Object
Returns the value of attribute y1.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def y2 @y2 end |
#y3 ⇒ Object
Returns the value of attribute y3.
5 6 7 |
# File 'lib/r2d/triangle.rb', line 5 def y3 @y3 end |