Class: Ruby2D::Triangle
- Inherits:
-
Object
- Object
- Ruby2D::Triangle
- Defined in:
- lib/ruby2d/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
-
#initialize(x1 = 50, y1 = 0, x2 = 100, y2 = 100, x3 = 0, y3 = 100, c = 'white') ⇒ Triangle
constructor
A new instance of Triangle.
- #remove ⇒ Object
Constructor Details
#initialize(x1 = 50, y1 = 0, x2 = 100, y2 = 100, x3 = 0, y3 = 100, c = 'white') ⇒ Triangle
Returns a new instance of Triangle.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby2d/triangle.rb', line 11 def initialize(x1=50, y1=0, x2=100, y2=100, x3=0, y3=100, c='white') @type_id = 1 @x1, @y1 = x1, y1 @x2, @y2 = x2, y2 @x3, @y3 = x3, y3 @color = c update_color(c) if defined? Ruby2D::DSL Ruby2D::Application.add(self) end end |
Instance Attribute Details
#c1 ⇒ Object
Returns the value of attribute c1.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def c1 @c1 end |
#c2 ⇒ Object
Returns the value of attribute c2.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def c2 @c2 end |
#c3 ⇒ Object
Returns the value of attribute c3.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def c3 @c3 end |
#color ⇒ Object
Returns the value of attribute color.
9 10 11 |
# File 'lib/ruby2d/triangle.rb', line 9 def color @color end |
#x1 ⇒ Object
Returns the value of attribute x1.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def x2 @x2 end |
#x3 ⇒ Object
Returns the value of attribute x3.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def x3 @x3 end |
#y1 ⇒ Object
Returns the value of attribute y1.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def y2 @y2 end |
#y3 ⇒ Object
Returns the value of attribute y3.
6 7 8 |
# File 'lib/ruby2d/triangle.rb', line 6 def y3 @y3 end |
Instance Method Details
#remove ⇒ Object
29 30 31 32 33 |
# File 'lib/ruby2d/triangle.rb', line 29 def remove if defined? Ruby2D::DSL Ruby2D::Application.remove(self) end end |