kanoko 0.3.1

A library for generative art (initially) based off of a traditional Japanese tie-dye pattern
Documentation
use std::f64::consts::PI;

#[derive(Debug, Clone, Copy)]
pub enum Angle {
    Degree(f64),
    Radian(f64),
}

impl Default for Angle {
    fn default() -> Self {
        Self::Radian(0.0)
    }
}

impl Angle {
    #[inline]
    pub fn to_degree(self) -> f64 {
        match self {
            Angle::Degree(theta) => theta,
            Angle::Radian(theta) => theta * 180.0 / PI,
        }
    }

    #[inline]
    pub fn to_radian(self) -> f64 {
        match self {
            Angle::Degree(theta) => theta * PI / 180.0,
            Angle::Radian(theta) => theta,
        }
    }
}