Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some minor cleanups in kernel #1000

Merged
merged 5 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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