From 7845e7ec025403a0141736829855ae3b72bc4ba0 Mon Sep 17 00:00:00 2001 From: tomara_x <86204514+tomara-x@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:35:52 +0300 Subject: [PATCH] cartesian and polar nodes --- README.md | 2 ++ src/functions.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 8ea2ad4..b5facf6 100644 --- a/README.md +++ b/README.md @@ -750,6 +750,8 @@ math - `atanh()` - `atan2()` - `hypot()` +- `pol()` +- `car()` - `squared()` - `cubed()` - `dissonance()` diff --git a/src/functions.rs b/src/functions.rs index 081cef4..a867c85 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -882,6 +882,8 @@ pub fn str_to_net(op: &str) -> Net32 { }))); } } + "pol" => { return Net32::wrap(Box::new(map(|i: &Frame| (i[0].hypot(i[1]), i[1].atan2(i[0])) ))); } + "car" => { return Net32::wrap(Box::new(map(|i: &Frame| (i[0]*i[1].cos(), i[0]*i[1].sin()) ))); } _ => {} } Net32::wrap(Box::new(dc(0.)))