mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-09 04:18:28 +00:00
Add SurfaceGeom2::origin
This commit is contained in:
parent
0471cf257b
commit
2c70cc6e3a
@ -1,6 +1,6 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use fj_math::{Circle, Line};
|
||||
use fj_math::{Circle, Line, Point};
|
||||
|
||||
use crate::{storage::Handle, topology::Surface};
|
||||
|
||||
@ -65,12 +65,27 @@ pub struct LocalCurveGeom {
|
||||
/// We'll have a much clearer image of the situation then. Hopefully, by then it
|
||||
/// will be clearer what specific role this trait will play in relation to other
|
||||
/// curve geometry types, and a better name will reveal itself.
|
||||
pub trait CurveGeom2<const D: usize> {}
|
||||
pub trait CurveGeom2<const D: usize> {
|
||||
/// # Access the origin of the curve
|
||||
fn origin(&self) -> Point<D>;
|
||||
}
|
||||
|
||||
impl<const D: usize> CurveGeom2<D> for Circle<D> {}
|
||||
impl<const D: usize> CurveGeom2<D> for Circle<D> {
|
||||
fn origin(&self) -> Point<D> {
|
||||
self.center() + self.a()
|
||||
}
|
||||
}
|
||||
|
||||
impl<const D: usize> CurveGeom2<D> for Line<D> {}
|
||||
impl<const D: usize> CurveGeom2<D> for Line<D> {
|
||||
fn origin(&self) -> Point<D> {
|
||||
self.origin()
|
||||
}
|
||||
}
|
||||
|
||||
// This implementation is temporary, to ease the transition towards a curve
|
||||
// geometry trait. Eventually, `CurveGeom2` is expected to replace `Path`.
|
||||
impl<const D: usize> CurveGeom2<D> for Path<D> {}
|
||||
impl<const D: usize> CurveGeom2<D> for Path<D> {
|
||||
fn origin(&self) -> Point<D> {
|
||||
self.origin()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user