added antialiasing
This commit is contained in:
26
src/rtweekend.rs
Normal file
26
src/rtweekend.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use rand::prelude::*;
|
||||
|
||||
// Constants
|
||||
pub const INFINITY: f64 = std::f64::INFINITY;
|
||||
pub const PI: f64 = std::f64::consts::PI;
|
||||
|
||||
// Utility Functions
|
||||
pub fn degrees_to_radians(degrees: f64) -> f64 {
|
||||
degrees * std::f64::consts::PI / 180.0
|
||||
}
|
||||
|
||||
// PLEASE CHANGE
|
||||
pub fn random_f64() -> f64 {
|
||||
rand::thread_rng().gen()
|
||||
}
|
||||
|
||||
// PLEASE CHANGE
|
||||
pub fn random_range_f64(min: f64, max: f64) -> f64 {
|
||||
rand::thread_rng().gen_range(min..=max)
|
||||
}
|
||||
|
||||
pub fn clamp(x: f64, min: f64, max: f64) -> f64 {
|
||||
if x < min { return min; }
|
||||
if x > max { return max; }
|
||||
x
|
||||
}
|
||||
Reference in New Issue
Block a user