Skip to content

Commit 5bceba5

Browse files
authored
Add math constants (#138)
1 parent 323a7dd commit 5bceba5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • crates/processing_pyo3/src

crates/processing_pyo3/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,22 @@ mod mewnala {
602602
#[pymodule_export]
603603
const F12: u32 = 301;
604604

605+
// Math constants
606+
#[pymodule_export]
607+
const PI: f32 = std::f32::consts::PI;
608+
#[pymodule_export]
609+
const TWO_PI: f32 = std::f32::consts::TAU;
610+
#[pymodule_export]
611+
const HALF_PI: f32 = std::f32::consts::FRAC_PI_2;
612+
#[pymodule_export]
613+
const QUARTER_PI: f32 = std::f32::consts::FRAC_PI_4;
614+
#[pymodule_export]
615+
const TAU: f32 = std::f32::consts::TAU;
616+
#[pymodule_export]
617+
const DEG_TO_RAD: f32 = std::f32::consts::PI / 180.0;
618+
#[pymodule_export]
619+
const RAD_TO_DEG: f32 = 180.0 / std::f32::consts::PI;
620+
605621
// color space constants for color_mode()
606622
#[pymodule_export]
607623
const SRGB: u8 = 0;

0 commit comments

Comments
 (0)