lib/gui_geometry/point.rb in gui_geometry-0.2.2 vs lib/gui_geometry/point.rb in gui_geometry-0.3.0
- old
+ new
@@ -5,10 +5,19 @@
def initialize(*args)
self.x = self.y = 0
super if args.length!=0
end
+ alias :w :x
+ alias :width :x
+ alias :col :x
+ alias :column :x
+
+ alias :h :y
+ alias :height :y
+ alias :line :y
+
def min(b); point(Tools::min(x, b.x), Tools::min(y, b.y)); end
def max(b); point(Tools::max(x, b.x), Tools::max(y, b.y)); end
def bound(a, b); point(Tools::bound(a.x, x, b.x), Tools::bound(a.y, y, b.y)); end
def clone; point(clone_value(x), clone_value(y)); end
@@ -23,7 +32,9 @@
def +(b) b.kind_of?(Point) ? point(x+b.x, y+b.y) : point(x+b, y+b) end
def -(b) b.kind_of?(Point) ? point(x-b.x, y-b.y) : point(x-b, y-b) end
def *(b) b.kind_of?(Point) ? point(x*b.x, y*b.y) : point(x*b, y*b) end
def /(b) b.kind_of?(Point) ? point(x/b.x, y/b.y) : point(x/b, y/b) end
+
+ def area; x*y; end
end
end