Skip to main content

euv_engine/math/
const.rs

1/// The mathematical constant pi (~3.14159).
2pub const PI: f64 = std::f64::consts::PI;
3
4/// Two times pi, the full circle angle in radians (~6.28318).
5pub const TWO_PI: f64 = std::f64::consts::TAU;
6
7/// Half of pi, a quarter circle angle in radians (~1.57079).
8pub const HALF_PI: f64 = std::f64::consts::FRAC_PI_2;
9
10/// Conversion factor from degrees to radians.
11pub const DEG_TO_RAD: f64 = PI / 180.0;
12
13/// Conversion factor from radians to degrees.
14pub const RAD_TO_DEG: f64 = 180.0 / PI;
15
16/// A small epsilon value used for floating-point comparisons.
17pub const EPSILON: f64 = 1e-6;
18
19/// The default gravity acceleration in pixels per second squared.
20pub(crate) const DEFAULT_GRAVITY: f64 = 980.0;
21
22/// The default linear damping coefficient applied per second.
23pub(crate) const DEFAULT_LINEAR_DAMPING: f64 = 0.0;
24
25/// The default angular damping coefficient applied per second.
26pub(crate) const DEFAULT_ANGULAR_DAMPING: f64 = 0.0;
27
28/// The default restitution (bounciness) for rigid body collisions.
29pub(crate) const DEFAULT_RESTITUTION: f64 = 0.3;
30
31/// The default friction coefficient for rigid body surface contact.
32pub(crate) const DEFAULT_FRICTION: f64 = 0.7;
33
34/// The fixed timestep duration in seconds for the game loop (60 FPS).
35pub(crate) const DEFAULT_FIXED_TIMESTEP: f64 = 1.0 / 60.0;
36
37/// The maximum accumulated time in seconds before the game loop drops frames.
38pub(crate) const DEFAULT_MAX_FRAME_TIME: f64 = 0.25;
39
40/// The default 3D gravity acceleration in meters per second squared (pointing down on the y axis).
41pub(crate) const DEFAULT_GRAVITY_3D: f64 = -9.81;
42
43/// The default near clipping plane distance for a 3D perspective camera.
44pub(crate) const DEFAULT_CAMERA_NEAR: f64 = 0.1;
45
46/// The default far clipping plane distance for a 3D perspective camera.
47pub(crate) const DEFAULT_CAMERA_FAR: f64 = 1000.0;
48
49/// The default vertical field of view in radians for a 3D perspective camera (~60 degrees).
50pub(crate) const DEFAULT_CAMERA_FOV: f64 = 1.0471975511965976;