Skip to content

Commit 8ff5e92

Browse files
committed
Add math constants (closes #128)
1 parent 41af34f commit 8ff5e92

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • crates/processing_pyo3/src

crates/processing_pyo3/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,15 @@ mod mewnala {
757757
}
758758

759759

760+
// ── Processing math constants (issue #128) ──────────────────────────────
761+
#[pyfunction] fn PI() -> f32 { std::f32::consts::PI }
762+
#[pyfunction] fn TWO_PI() -> f32 { std::f32::consts::TAU }
763+
#[pyfunction] fn TAU() -> f32 { std::f32::consts::TAU }
764+
#[pyfunction] fn HALF_PI() -> f32 { std::f32::consts::FRAC_PI_2 }
765+
#[pyfunction] fn QUARTER_PI() -> f32 { std::f32::consts::FRAC_PI_4 }
766+
#[pyfunction] fn DEG_TO_RAD() -> f32 { std::f32::consts::PI / 180.0 }
767+
#[pyfunction] fn RAD_TO_DEG() -> f32 { 180.0 / std::f32::consts::PI }
768+
760769
// ── Processing-specific math functions (issues #135, #140) ─────────────
761770
// Note: stdlib duplicates (sin, cos, abs, min, max, floor, etc.) are
762771
// intentionally omitted -- users should use Python's math module instead.

0 commit comments

Comments
 (0)