Module: PointVector::PointOps

Included in:
PointVector
Defined in:
lib/geo_vectors/point_vector/point_ops.rb

Instance Method Summary collapse

Instance Method Details

#add_to_point(point) ⇒ Object

return new point from adding vector to point



4
5
6
# File 'lib/geo_vectors/point_vector/point_ops.rb', line 4

def add_to_point point
  add_to_point! point.dup
end

#add_to_point!(point) ⇒ Object

add vector directly to point (destructive update)



9
10
11
12
13
# File 'lib/geo_vectors/point_vector/point_ops.rb', line 9

def add_to_point! point
  point.lat = lat + point.lat 
  point.lng = lng + point.lng
  point
end

#sub_from_point(point) ⇒ Object



15
16
17
# File 'lib/geo_vectors/point_vector/point_ops.rb', line 15

def sub_from_point point
  reverse.add_to_point point    
end

#sub_from_point!(point) ⇒ Object



19
20
21
# File 'lib/geo_vectors/point_vector/point_ops.rb', line 19

def sub_from_point! point
  reverse.add_to_point! point
end