Convert to radians/degrees using Rust methods (#516)

use to_radians and to_degrees
This commit is contained in:
Adam Chalmers
2023-09-13 22:25:41 -06:00
committed by GitHub
parent 0eeff8cb45
commit 760a180f56
4 changed files with 17 additions and 17 deletions

View File

@ -491,7 +491,7 @@ pub fn leg_angle_x(args: &mut Args) -> Result<MemoryItem, KclError> {
name = "legAngX",
}]
fn inner_leg_angle_x(hypotenuse: f64, leg: f64) -> f64 {
(leg.min(hypotenuse) / hypotenuse).acos() * 180.0 / std::f64::consts::PI
(leg.min(hypotenuse) / hypotenuse).acos().to_degrees()
}
/// Returns the angle of the given leg for y.
@ -506,7 +506,7 @@ pub fn leg_angle_y(args: &mut Args) -> Result<MemoryItem, KclError> {
name = "legAngY",
}]
fn inner_leg_angle_y(hypotenuse: f64, leg: f64) -> f64 {
(leg.min(hypotenuse) / hypotenuse).asin() * 180.0 / std::f64::consts::PI
(leg.min(hypotenuse) / hypotenuse).asin().to_degrees()
}
/// The primitive types that can be used in a KCL file.