From 0b1384a7e0f8b2dd322ac8fec9bad69308aa487c Mon Sep 17 00:00:00 2001 From: gabsi26 Date: Mon, 23 May 2022 15:54:10 +0200 Subject: [PATCH] Use `Angle` type in star model --- models/star/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/models/star/src/lib.rs b/models/star/src/lib.rs index e17caa3513..371da98c31 100644 --- a/models/star/src/lib.rs +++ b/models/star/src/lib.rs @@ -1,3 +1,4 @@ +use fj::Angle; use std::{collections::HashMap, f64::consts::PI}; #[no_mangle] @@ -31,7 +32,7 @@ pub extern "C" fn model(args: &HashMap) -> fj::Shape { // gives us the angle and radius for each vertex. let num_vertices = num_points * 2; let vertex_iter = (0..num_vertices).map(|i| { - let angle = 2. * PI / num_vertices as f64 * i as f64; + let angle = Angle::from_rad(2. * PI / num_vertices as f64 * i as f64); let radius = if i % 2 == 0 { r1 } else { r2 }; (angle, radius) }); @@ -41,7 +42,7 @@ pub extern "C" fn model(args: &HashMap) -> fj::Shape { let mut outer = Vec::new(); let mut inner = Vec::new(); for (angle, radius) in vertex_iter { - let (sin, cos) = angle.sin_cos(); + let (sin, cos) = angle.rad().sin_cos(); let x = cos * radius; let y = sin * radius;