Calculating new coordinates from point w/ distance and angle.
def new_position point, length_degree=10, direction_degree=0
[
point[0]+length_degree*Math.cos(
direction_degree*Math::PI/180),
point[1]+length_degree*Math.sin(
direction_degree*Math::PI/180)
]
end
Written by Oto Brglez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#