Skip to content

Commit

Permalink
Merge pull request #125 from hannobraun/simplify-edge
Browse files Browse the repository at this point in the history
Simplify `Edge`
  • Loading branch information
hannobraun committed Feb 3, 2022
2 parents ce49523 + 538162f commit 4ac080a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/kernel/shapes/sketch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use nalgebra::point;
use parry3d_f64::bounding_volume::AABB;

use crate::{
Expand Down Expand Up @@ -50,7 +49,7 @@ impl Shape for fj::Sketch {
let b = window[1];

let line = Curve::Line(Line { a, b });
let edge = Edge::new(line, point![0.], point![1.]);
let edge = Edge::new(line);

edges.push(edge);
}
Expand Down
15 changes: 12 additions & 3 deletions src/kernel/topology/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,27 @@ pub struct Edge {
///
/// If there are no such vertices, that means the edge is connected to
/// itself (like a full circle, for example).
pub vertices: Option<[Point<1>; 2]>,
///
/// This field is a placeholder. Eventually, there will be actual vertices
/// here. For now, this field just tracks whether there are such bounding
/// vertices or not. If there are, they are implicitly assumed to be the
/// points with the curve coordinates `0` and `1`.
pub vertices: Option<[(); 2]>,

/// Indicates whether the curve's direction is reversed
///
/// Once this struct keeps track of the vertices that bound the edge, this
/// field can probably be made redundant. The order of the bounding points
/// will simply define the direction of the curve.
pub reverse: bool,
}

impl Edge {
/// Construct an edge
pub fn new(curve: Curve, start: Point<1>, end: Point<1>) -> Self {
pub fn new(curve: Curve) -> Self {
Self {
curve,
vertices: Some([start, end]),
vertices: Some([(), ()]),
reverse: false,
}
}
Expand Down

0 comments on commit 4ac080a

Please sign in to comment.