mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-26 00:55:50 +00:00
Replace Edge::circle
with Edges::add_circle
See previous commit for an explanation.
This commit is contained in:
parent
8a578e3782
commit
a88476d3e6
@ -1,6 +1,9 @@
|
||||
use crate::kernel::{
|
||||
geometry::{Curve, Line},
|
||||
use crate::{
|
||||
kernel::{
|
||||
geometry::{Curve, Line, Circle},
|
||||
topology::{edges::Edge, vertices::Vertex},
|
||||
},
|
||||
math::{Scalar, Vector, Point},
|
||||
};
|
||||
|
||||
use super::handle::{Handle, Storage};
|
||||
@ -27,6 +30,20 @@ impl Edges {
|
||||
Storage::new(edge).handle()
|
||||
}
|
||||
|
||||
/// Add a circle to the shape
|
||||
///
|
||||
/// Calls [`Edges::add`] internally, and is subject to the same
|
||||
/// restrictions.
|
||||
pub fn add_circle(&mut self, radius: Scalar) -> Handle<Edge> {
|
||||
self.add(Edge {
|
||||
curve: Curve::Circle(Circle {
|
||||
center: Point::origin(),
|
||||
radius: Vector::from([radius, Scalar::ZERO]),
|
||||
}),
|
||||
vertices: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Add a line segment to the shape
|
||||
///
|
||||
/// Calls [`Edges::add`] internally, and is subject to the same
|
||||
|
@ -3,10 +3,7 @@ use crate::{
|
||||
kernel::{
|
||||
geometry::Surface,
|
||||
shape::Shape,
|
||||
topology::{
|
||||
edges::{Cycle, Edge},
|
||||
faces::Face,
|
||||
},
|
||||
topology::{edges::Cycle, faces::Face},
|
||||
},
|
||||
math::{Aabb, Point, Scalar},
|
||||
};
|
||||
@ -20,9 +17,7 @@ impl ToShape for fj::Circle {
|
||||
// Circles have just a single round edge with no vertices. So none need
|
||||
// to be added here.
|
||||
|
||||
let edge = shape
|
||||
.edges()
|
||||
.add(Edge::circle(Scalar::from_f64(self.radius)));
|
||||
let edge = shape.edges().add_circle(Scalar::from_f64(self.radius));
|
||||
shape.cycles().add(Cycle { edges: vec![edge] });
|
||||
|
||||
let cycles = shape.cycles().all().collect();
|
||||
|
@ -1,10 +1,4 @@
|
||||
use crate::{
|
||||
kernel::{
|
||||
geometry::{Circle, Curve},
|
||||
shape::handle::Handle,
|
||||
},
|
||||
math::{Point, Scalar, Vector},
|
||||
};
|
||||
use crate::kernel::{geometry::Curve, shape::handle::Handle};
|
||||
|
||||
use super::vertices::Vertex;
|
||||
|
||||
@ -44,16 +38,3 @@ pub struct Edge {
|
||||
/// and store 1D vertices again, at some point.
|
||||
pub vertices: Option<[Handle<Vertex>; 2]>,
|
||||
}
|
||||
|
||||
impl Edge {
|
||||
/// Create a circle
|
||||
pub fn circle(radius: Scalar) -> Self {
|
||||
Edge {
|
||||
curve: Curve::Circle(Circle {
|
||||
center: Point::origin(),
|
||||
radius: Vector::from([radius, Scalar::ZERO]),
|
||||
}),
|
||||
vertices: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user