This commit is contained in:
numzero 2024-06-09 23:30:37 +03:00
parent c6591e7455
commit aa6779ff4b

View File

@ -97,6 +97,7 @@ pub fn main() {
});
}
#[derive(Copy, Clone, Debug)]
struct Location {
/// Положение в основной СК
pos: Vec2,
@ -104,6 +105,7 @@ struct Location {
rot: Mat2,
}
#[derive(Copy, Clone, Debug)]
struct Object {
id: i32,
loc: Location,
@ -587,9 +589,9 @@ fn test_rect() {
impl Metric for Rect {
fn sqrt_at(&self, pos: Vec2) -> Decomp2 {
let x = pos.y.abs();
let y = pos.y.abs();
let sx = ((pos.x.abs() - self.inner_radius) / (self.outer_radius - self.inner_radius)).clamp(0.0, 1.0);
let sy = if x <= self.external_halflength { 1.0 / self.root(x) } else { 1.0 };
let sy = if y <= self.external_halflength { 1.0 / self.root(y) } else { 1.0 };
assert!(sx.is_finite());
assert!(sy.is_finite());
assert!(sy > 0.0);