summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb')
-rw-r--r--qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
new file mode 100644
index 00000000..eedf69f9
--- /dev/null
+++ b/qtruby/rubylib/examples/ruboids/ruboids/Triangle.rb
@@ -0,0 +1,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