Class: Triangle

Inherits:
Object show all
Defined in:
ext/ruby/qtruby/examples/ruboids/ruboids/Triangle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p0 = Point::ORIGIN, p1 = Point::ORIGIN, p2 = Point::ORIGIN) ⇒ Triangle

Returns a new instance of Triangle.



13
14
15
16
17
18
19
20
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Triangle.rb', line 13

def initialize(p0 = Point::ORIGIN,
 p1 = Point::ORIGIN,
 p2 = Point::ORIGIN)
	@points = []
	@points << p0 ? p0 : Point::ORIGIN.dup()
	@points << p1 ? p1 : Point::ORIGIN.dup()
	@points << p2 ? p2 : Point::ORIGIN.dup()
end

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



11
12
13
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Triangle.rb', line 11

def points
  @points
end