Skip to content

Commit

Permalink
WIP Add Edge::sweep_vertex
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 14, 2022
1 parent 7f0b617 commit b82849f
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/kernel/topology/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use nalgebra::vector;
use parry3d_f64::math::Isometry;

use crate::{
kernel::geometry::{Circle, Curve},
math::Point,
kernel::geometry::{Circle, Curve, Line},
math::{Point, Vector},
};

use super::vertices::Vertex;
Expand Down Expand Up @@ -131,6 +131,29 @@ impl Edge {
}
}

/// Construct an edge by sweeping a vertex
///
/// Only sweeps along the positive direction of the z axis are supported.
///
/// You must not use this method to create multiple instances of `Edge` that
/// refer to the same edge.
///
/// TASK: Complete this doc comment. Look at `Vertex::create_at` for more
/// info.
// TASK: Un-suppress warning.
#[allow(unused)]
pub fn sweep_vertex(vertex: Vertex<3>, path: Vector<1>) -> Self {
let line = Line {
origin: *vertex.location(),
direction: vector![0., 0., path.x],
};

let a = vertex;
let b = Vertex::create_at(line.origin + line.direction);

Self::new(Curve::Line(line), Some([a, b]))
}

/// Create an arc
///
/// So far, the name of this method is a bit ambitious, as only full circles
Expand Down

0 comments on commit b82849f

Please sign in to comment.