Reduce MetricCS API
This commit is contained in:
parent
e3d068579c
commit
fce3203859
|
|
@ -185,7 +185,7 @@ fn test_rect() {
|
||||||
|
|
||||||
mod coords {
|
mod coords {
|
||||||
use glam::{Mat2, Vec2, vec2};
|
use glam::{Mat2, Vec2, vec2};
|
||||||
use crate::riemann::{Decomp2, Metric};
|
use crate::riemann::Metric;
|
||||||
use crate::types::{Location, Ray};
|
use crate::types::{Location, Ray};
|
||||||
use super::{Rect, Tube};
|
use super::{Rect, Tube};
|
||||||
|
|
||||||
|
|
@ -201,14 +201,11 @@ mod coords {
|
||||||
|
|
||||||
trait MetricCS: FlatCoordinateSystem<Vec2> {
|
trait MetricCS: FlatCoordinateSystem<Vec2> {
|
||||||
fn global_metric(&self) -> &impl Metric;
|
fn global_metric(&self) -> &impl Metric;
|
||||||
fn sqrt_at_global(&self, pos: Vec2) -> Decomp2 {
|
|
||||||
self.global_metric().sqrt_at(pos)
|
|
||||||
}
|
|
||||||
fn flat_to_global_tfm_at(&self, pos: Vec2) -> Mat2 {
|
fn flat_to_global_tfm_at(&self, pos: Vec2) -> Mat2 {
|
||||||
self.sqrt_at_global(self.flat_to_global(pos)).inverse().into()
|
self.global_metric().sqrt_at(self.flat_to_global(pos)).inverse().into()
|
||||||
}
|
}
|
||||||
fn global_to_flat_tfm_at(&self, pos: Vec2) -> Mat2 {
|
fn global_to_flat_tfm_at(&self, pos: Vec2) -> Mat2 {
|
||||||
self.sqrt_at_global(pos).into()
|
self.global_metric().sqrt_at(pos).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user