README.md in geomotion-0.7.0 vs README.md in geomotion-0.10.0
- old
+ new
@@ -136,11 +136,11 @@
Any of the location methods (`up, down, left, right, beside, before, above, below`)
will return a frame that is in the same coordinate system of the receiver, and
this behavior cannot be changed.
```ruby
-frame = CGRect.new(x: 10, y: 10, width:10, height: 10)
+frame = CGRect.make(x: 10, y: 10, width:10, height: 10)
frame.beside
# => [[20, 10], [10, 10]]
frame.right(30).down(5).taller(100)
# => [[10+30, 10+5], [10, 10+100]]
@@ -171,22 +171,22 @@
the width or height is negative, these methods will always return positive
numbers. If you specify absolute coordinates, the values might be negative, but
they will also be sorted (x == min, min < mid, mid < max, x + width == max).
```ruby
-frame = CGRect.new(x: 10, y: 10, width:10, height: 10)
+frame = CGRect.make(x: 10, y: 10, width:10, height: 10)
frame.top_left # => [0, 0]
frame.top_center # => [5, 0]
frame.bottom_right # => [10, 10]
# use absolute coordinates
frame.top_left(true) # => [10, 10]
frame.top_center(true) # => [15, 10]
frame.bottom_right(true) # => [20, 20]
# negative widths and heights are "corrected" when using absolute coordinates
-frame = CGRect.new(x: 20, y: 20, width:-10, height: -10)
+frame = CGRect.make(x: 20, y: 20, width:-10, height: -10)
frame.top_center(true) # => [15, 10]
frame.bottom_right(true) # => [20, 20]
```
### CGSize
@@ -241,12 +241,21 @@
# Combine with CGSize
point.rect_of_size CGSize.make(width: 50, height: 20)
=> CGRect(10, 100, 50, 20)
-# Combine with CGRect
+# Compare with CGRect
point.inside? CGRect.make(x: 0, y: 0, width: 20, height: 110)
=> true
+
+# Distance to point
+point.distance_to(CGPoint.make(x: 13, y:104))
+=> 5
+
+# Angle between target and receiver
+# (up 10, over 10)
+point.angle_to(CGPoint.make(x: 20, y:110))
+=> 0.785398163397 (pi/4)
```
## Install
1. `gem install geomotion`