mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 04:48:29 +00:00
Prepare to make CurveGeometry
floating
This commit is contained in:
parent
0738d1da98
commit
a58fac6e1b
@ -98,7 +98,7 @@ pub trait CurveGeometry {
|
|||||||
) -> Vec<Point<1>>;
|
) -> Vec<Point<1>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
impl CurveGeometry for (Point<3>, Circle) {
|
||||||
fn clone_curve_geometry(&self) -> FloatingCurve {
|
fn clone_curve_geometry(&self) -> FloatingCurve {
|
||||||
Box::new(*self)
|
Box::new(*self)
|
||||||
}
|
}
|
||||||
@ -106,22 +106,12 @@ impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
|||||||
fn point_from_local(&self, point: Point<1>) -> Point<3> {
|
fn point_from_local(&self, point: Point<1>) -> Point<3> {
|
||||||
let (offset, circle) = *self;
|
let (offset, circle) = *self;
|
||||||
|
|
||||||
let circle = Circle {
|
|
||||||
a: circle.a(),
|
|
||||||
b: circle.b(),
|
|
||||||
};
|
|
||||||
|
|
||||||
offset + circle.vector_from_local_point(point)
|
offset + circle.vector_from_local_point(point)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn project_point(&self, point: Point<3>) -> Point<1> {
|
fn project_point(&self, point: Point<3>) -> Point<1> {
|
||||||
let (origin, circle) = *self;
|
let (origin, circle) = *self;
|
||||||
|
|
||||||
let circle = Circle {
|
|
||||||
a: circle.a(),
|
|
||||||
b: circle.b(),
|
|
||||||
};
|
|
||||||
|
|
||||||
circle.project_vector(point - origin)
|
circle.project_vector(point - origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +119,6 @@ impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
|||||||
let (origin, circle) = *self;
|
let (origin, circle) = *self;
|
||||||
|
|
||||||
let origin = origin + offset;
|
let origin = origin + offset;
|
||||||
let circle = circle.transform(&Transform::translation(offset));
|
|
||||||
|
|
||||||
Box::new((origin, circle))
|
Box::new((origin, circle))
|
||||||
}
|
}
|
||||||
@ -141,11 +130,6 @@ impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
|||||||
) -> Vec<Point<1>> {
|
) -> Vec<Point<1>> {
|
||||||
let (_, circle) = self;
|
let (_, circle) = self;
|
||||||
|
|
||||||
let circle = Circle {
|
|
||||||
a: circle.a(),
|
|
||||||
b: circle.b(),
|
|
||||||
};
|
|
||||||
|
|
||||||
CircleApproxParams::new(circle.radius(), tolerance)
|
CircleApproxParams::new(circle.radius(), tolerance)
|
||||||
.approx_circle(boundary)
|
.approx_circle(boundary)
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
use fj_math::{Circle, Point, Scalar};
|
use fj_math::{Point, Scalar};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -11,7 +11,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::AnchoredCurve;
|
use super::{AnchoredCurve, Circle};
|
||||||
|
|
||||||
pub struct Sketch {
|
pub struct Sketch {
|
||||||
segments: Vec<SketchSegment>,
|
segments: Vec<SketchSegment>,
|
||||||
@ -101,8 +101,10 @@ impl Sketch {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let origin = a;
|
let origin = a;
|
||||||
let circle =
|
let circle = Circle {
|
||||||
Circle::new(center, a - center, b - center);
|
a: a - center,
|
||||||
|
b: b - center,
|
||||||
|
};
|
||||||
|
|
||||||
(origin, circle)
|
(origin, circle)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user