lib/aixm/xy.rb in aixm-1.4.2 vs lib/aixm/xy.rb in aixm-1.4.3
- old
+ new
@@ -105,10 +105,11 @@
AIXM.point(xy: self)
end
# Distance to another point as calculated by the Haversine formula
#
+ # @param other [AIXM::XY] other point
# @return [AIXM::D]
def distance(other)
if self == other
AIXM.d(0, :m)
else
@@ -123,10 +124,11 @@
end
end
# Bearing to another point
#
+ # @param other [AIXM::XY] other point
# @return [AIXM::A]
def bearing(other)
fail "cannot calculate bearing to identical point" if self == other
delta_long = other.long.to_rad - long.to_rad
AIXM.a(
@@ -139,9 +141,11 @@
)
end
# Calculate a new point by adding the distance in the given bearing
#
+ # @param distance [AIXM::D]
+ # @param bearing [AIXM::A]
# @return [AIXM::XY]
def add_distance(distance, bearing)
angular_dist = distance.to_m.dim / EARTH_RADIUS
dest_lat = Math.asin(
Math.sin(lat.to_rad) * Math.cos(angular_dist) +