Skip to content

Commit

Permalink
Merge pull request #1000 from hannobraun/kernel
Browse files Browse the repository at this point in the history
Make some minor cleanups in kernel
  • Loading branch information
hannobraun authored Aug 25, 2022
2 parents 186fec0 + af2b42a commit da16f06
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
27 changes: 15 additions & 12 deletions crates/fj-kernel/src/builder/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,28 @@ impl EdgeBuilder {
GlobalVertex::from_position(position)
});

let curve_local = CurveKind::Line(Line::from_points(points));
let curve_global = {
let points =
global_vertices.map(|global_vertex| global_vertex.position());
let kind = CurveKind::Line(Line::from_points(points));
GlobalCurve::from_kind(kind)
let curve = {
let curve_local = CurveKind::Line(Line::from_points(points));
let curve_global = {
let points = global_vertices
.map(|global_vertex| global_vertex.position());
let kind = CurveKind::Line(Line::from_points(points));
GlobalCurve::from_kind(kind)
};

Curve::new(curve_local, curve_global)
};

let vertices = {
let [a, b] = global_vertices;
[
let vertices = [
Vertex::new(Point::from([0.]), a),
Vertex::new(Point::from([1.]), b),
]
];

VerticesOfEdge::from_vertices(vertices)
};

Edge::from_curve_and_vertices(
Curve::new(curve_local, curve_global),
VerticesOfEdge::from_vertices(vertices),
)
Edge::from_curve_and_vertices(curve, vertices)
}
}
7 changes: 0 additions & 7 deletions crates/fj-kernel/src/objects/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ impl Cycle {
}

/// Create a new cycle
#[allow(clippy::new_without_default)]
pub fn new(surface: Surface) -> Self {
// Implementation note:
// As I'm writing this, this constructor has no arguments. I expect it
// to take a `Surface` at some point. Remove the `#[allow(...)]`
// attribute then.
// - @hannobraun

Self {
surface,
edges: Vec::new(),
Expand Down
6 changes: 3 additions & 3 deletions crates/fj-kernel/src/objects/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ impl Vertex {
Self { position, global }
}

/// The position of the vertex on the curve
/// Access the position of the vertex on the curve
pub fn position(&self) -> Point<1> {
self.position
}

/// The global form of this vertex
/// Access the global form of this vertex
pub fn global(&self) -> &GlobalVertex {
&self.global
}
Expand Down Expand Up @@ -67,7 +67,7 @@ impl GlobalVertex {
Self { position }
}

/// The position of the vertex
/// Access the position of the vertex
pub fn position(&self) -> Point<3> {
self.position
}
Expand Down

0 comments on commit da16f06

Please sign in to comment.