Cleanup
This commit is contained in:
parent
c6591e7455
commit
aa6779ff4b
|
|
@ -97,6 +97,7 @@ pub fn main() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
struct Location {
|
struct Location {
|
||||||
/// Положение в основной СК
|
/// Положение в основной СК
|
||||||
pos: Vec2,
|
pos: Vec2,
|
||||||
|
|
@ -104,6 +105,7 @@ struct Location {
|
||||||
rot: Mat2,
|
rot: Mat2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
struct Object {
|
struct Object {
|
||||||
id: i32,
|
id: i32,
|
||||||
loc: Location,
|
loc: Location,
|
||||||
|
|
@ -587,9 +589,9 @@ fn test_rect() {
|
||||||
|
|
||||||
impl Metric for Rect {
|
impl Metric for Rect {
|
||||||
fn sqrt_at(&self, pos: Vec2) -> Decomp2 {
|
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 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!(sx.is_finite());
|
||||||
assert!(sy.is_finite());
|
assert!(sy.is_finite());
|
||||||
assert!(sy > 0.0);
|
assert!(sy > 0.0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user