roast2d_internal 0.3.3

Roast2D internal crate
Documentation
use std::f32::consts::PI;

use glam::Vec2;

/// Round a number to the nearest even number
pub fn round_to_even(v: Vec2) -> Vec2 {
    (v * 0.5).round() * 2.0
}

/// Rotate angle in radian
pub fn rot(mut ang: f32, dt: f32) -> f32 {
    ang += dt;
    while ang > PI {
        ang -= 2.0 * PI;
    }
    while ang < -PI {
        ang += 2.0 * PI;
    }
    ang
}