summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
blob: eedf69f9132cc58035554040bf25dfbbdd0c0960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2001 by Jim Menard <jimm@io.com>
#
# Released under the same license as Ruby. See
# http://www.ruby-lang.org/en/LICENSE.txt.
#

require 'Point'

class Triangle
    attr_accessor :points

    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
end