polar_angle

Function polar_angle 

Source
pub fn polar_angle(reference: [f64; 2], point: [f64; 2]) -> f64
Expand description

Calculate polar angle from a reference point

§Arguments

  • reference - Reference point [x, y]
  • point - Target point [x, y]

§Returns

  • Polar angle in radians

§Examples

use scirs2_spatial::convex_hull::geometry::calculations_2d::polar_angle;

let origin = [0.0, 0.0];
let point = [1.0, 1.0];

let angle = polar_angle(origin, point);
assert!((angle - std::f64::consts::PI / 4.0).abs() < 1e-10);