Prepare to support arcs in sketches

This commit is contained in:
Hanno Braun 2025-04-16 12:21:33 +02:00
parent 83febdae02
commit 94bd019099
2 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,6 @@
use std::collections::{BTreeMap, BTreeSet};
use fj_math::Point;
use fj_math::{Point, Scalar};
use itertools::Itertools;
use crate::{
@ -22,9 +22,16 @@ impl Sketch {
}
}
pub fn arc_from(mut self, start: impl Into<Point<2>>) -> Self {
pub fn arc_from(
mut self,
start: impl Into<Point<2>>,
radius: impl Into<Scalar>,
) -> Self {
let start = start.into();
let _ = radius.into();
self.segments.push(SketchSegment::Arc { start });
self
}

View File

@ -21,10 +21,10 @@ pub fn model(viewer: &Viewer) -> TriMesh {
// connection to inner boundary
.line_from([-1., -1.])
// inner boundary
.arc_from([-0.5, -0.5])
.arc_from([-0.5, 0.5])
.arc_from([0.5, 0.5])
.arc_from([0.5, -0.5])
.arc_from([-0.5, -0.5], 1.)
.arc_from([-0.5, 0.5], 1.)
.arc_from([0.5, 0.5], 1.)
.arc_from([0.5, -0.5], 1.)
// connection to outer boundary
.line_from([-0.5, -0.5]);
// The connection between the last and first points is implicit, so