mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-07 11:28:28 +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>>;
|
||||
}
|
||||
|
||||
impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
||||
impl CurveGeometry for (Point<3>, Circle) {
|
||||
fn clone_curve_geometry(&self) -> FloatingCurve {
|
||||
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> {
|
||||
let (offset, circle) = *self;
|
||||
|
||||
let circle = Circle {
|
||||
a: circle.a(),
|
||||
b: circle.b(),
|
||||
};
|
||||
|
||||
offset + circle.vector_from_local_point(point)
|
||||
}
|
||||
|
||||
fn project_point(&self, point: Point<3>) -> Point<1> {
|
||||
let (origin, circle) = *self;
|
||||
|
||||
let circle = Circle {
|
||||
a: circle.a(),
|
||||
b: circle.b(),
|
||||
};
|
||||
|
||||
circle.project_vector(point - origin)
|
||||
}
|
||||
|
||||
@ -129,7 +119,6 @@ impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
||||
let (origin, circle) = *self;
|
||||
|
||||
let origin = origin + offset;
|
||||
let circle = circle.transform(&Transform::translation(offset));
|
||||
|
||||
Box::new((origin, circle))
|
||||
}
|
||||
@ -141,11 +130,6 @@ impl CurveGeometry for (Point<3>, fj_math::Circle<3>) {
|
||||
) -> Vec<Point<1>> {
|
||||
let (_, circle) = self;
|
||||
|
||||
let circle = Circle {
|
||||
a: circle.a(),
|
||||
b: circle.b(),
|
||||
};
|
||||
|
||||
CircleApproxParams::new(circle.radius(), tolerance)
|
||||
.approx_circle(boundary)
|
||||
.collect()
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use fj_math::{Circle, Point, Scalar};
|
||||
use fj_math::{Point, Scalar};
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::{
|
||||
@ -11,7 +11,7 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::AnchoredCurve;
|
||||
use super::{AnchoredCurve, Circle};
|
||||
|
||||
pub struct Sketch {
|
||||
segments: Vec<SketchSegment>,
|
||||
@ -101,8 +101,10 @@ impl Sketch {
|
||||
});
|
||||
|
||||
let origin = a;
|
||||
let circle =
|
||||
Circle::new(center, a - center, b - center);
|
||||
let circle = Circle {
|
||||
a: a - center,
|
||||
b: b - center,
|
||||
};
|
||||
|
||||
(origin, circle)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user