2023-11-27 02:05:35 +00:00
|
|
|
use rand::Rng;
|
|
|
|
|
2023-11-26 00:58:14 +00:00
|
|
|
/// This source file includes some common things that tests are using.
|
|
|
|
|
|
|
|
#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
|
|
|
|
pub struct Vec2 {
|
|
|
|
pub x: f32,
|
|
|
|
pub y: f32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Vec2 {
|
|
|
|
pub fn new(x: f32, y: f32) -> Self {
|
|
|
|
Self {
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
}
|
|
|
|
}
|
2023-11-27 02:05:35 +00:00
|
|
|
|
|
|
|
pub fn rand() -> Self {
|
|
|
|
let mut rng = rand::thread_rng();
|
|
|
|
let range = 30.0..1853.0;
|
|
|
|
|
|
|
|
Vec2 {
|
|
|
|
x: rng.gen_range(range.clone()),
|
|
|
|
y: rng.gen_range(range)
|
|
|
|
}
|
|
|
|
}
|
2023-11-26 05:56:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
|
|
|
|
pub struct Vec3 {
|
|
|
|
pub x: f32,
|
|
|
|
pub y: f32,
|
|
|
|
pub z: f32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Vec3 {
|
|
|
|
pub fn new(x: f32, y: f32, z: f32) -> Self {
|
|
|
|
Self {
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
z
|
|
|
|
}
|
|
|
|
}
|
2023-11-26 00:58:14 +00:00
|
|
|
}
|