Add tags to Rust std lib functions (#6701)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -353,7 +353,7 @@ pub async fn leg_length(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
|
||||
/// Compute the length of the given leg.
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```kcl,no_run
|
||||
/// legLen(hypotenuse = 5, leg = 3)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
@ -364,7 +364,7 @@ pub async fn leg_length(exec_state: &mut ExecState, args: Args) -> Result<KclVal
|
||||
hypotenuse = { docs = "The length of the triangle's hypotenuse" },
|
||||
leg = { docs = "The length of one of the triangle's legs (i.e. non-hypotenuse side)" },
|
||||
},
|
||||
tags = ["utilities"],
|
||||
tags = ["math"],
|
||||
}]
|
||||
fn inner_leg_length(hypotenuse: f64, leg: f64) -> f64 {
|
||||
(hypotenuse.powi(2) - f64::min(hypotenuse.abs(), leg.abs()).powi(2)).sqrt()
|
||||
@ -385,7 +385,7 @@ pub async fn leg_angle_x(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
|
||||
/// Compute the angle of the given leg for x.
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```kcl,no_run
|
||||
/// legAngX(hypotenuse = 5, leg = 3)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
@ -396,7 +396,7 @@ pub async fn leg_angle_x(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
hypotenuse = { docs = "The length of the triangle's hypotenuse" },
|
||||
leg = { docs = "The length of one of the triangle's legs (i.e. non-hypotenuse side)" },
|
||||
},
|
||||
tags = ["utilities"],
|
||||
tags = ["math"],
|
||||
}]
|
||||
fn inner_leg_angle_x(hypotenuse: f64, leg: f64) -> f64 {
|
||||
(leg.min(hypotenuse) / hypotenuse).acos().to_degrees()
|
||||
@ -417,7 +417,7 @@ pub async fn leg_angle_y(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
|
||||
/// Compute the angle of the given leg for y.
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```kcl,no_run
|
||||
/// legAngY(hypotenuse = 5, leg = 3)
|
||||
/// ```
|
||||
#[stdlib {
|
||||
@ -428,7 +428,7 @@ pub async fn leg_angle_y(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
||||
hypotenuse = { docs = "The length of the triangle's hypotenuse" },
|
||||
leg = { docs = "The length of one of the triangle's legs (i.e. non-hypotenuse side)" },
|
||||
},
|
||||
tags = ["utilities"],
|
||||
tags = ["math"],
|
||||
}]
|
||||
fn inner_leg_angle_y(hypotenuse: f64, leg: f64) -> f64 {
|
||||
(leg.min(hypotenuse) / hypotenuse).asin().to_degrees()
|
||||
|
Reference in New Issue
Block a user