Last Updated: February 25, 2016
·
876
· otobrglez

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