lib/geomotion/cg_point.rb in geomotion-0.7.0 vs lib/geomotion/cg_point.rb in geomotion-0.10.0

- old
+ new

@@ -35,9 +35,21 @@ def inside?(rect) CGRectContainsPoint(rect, self) end + def distance_to(point) + dx = self.x - point.x + dy = self.y - point.y + return Math.sqrt(dx**2 + dy**2) + end + + def angle_to(point) + dx = point.x - self.x + dy = point.y - self.y + return Math.atan2(dy, dx) + end + # operator def +(other) case other when CGSize return self.rect_of_size(other)