Skip to content

Commit

Permalink
Merge pull request #163 from hannobraun/circle
Browse files Browse the repository at this point in the history
Define circle radius using 2D vector
  • Loading branch information
hannobraun authored Feb 10, 2022
2 parents 02cad38 + 622d58e commit c29f44a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/kernel/geometry/curves/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ pub struct Circle {
/// The radius is represented by a vector that points from the center to the
/// circumference. The point on the circumference that it points to defines
/// the origin of the circle's 1-dimensional curve coordinate system.
pub radius: Vector<3>,
pub radius: Vector<2>,
}

impl Circle {
#[must_use]
pub fn transform(self, transform: &Isometry<f64>) -> Self {
let radius = vector![self.radius.x, self.radius.y, 0.];

Self {
center: transform.transform_point(&self.center),
radius: transform.transform_vector(&self.radius),
radius: transform.transform_vector(&radius).xy(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/topology/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Edge {
Self {
curve: Curve::Circle(Circle {
center: Point::origin(),
radius: vector![radius, 0., 0.],
radius: vector![radius, 0.],
}),
vertices: None,
reverse: false,
Expand Down

0 comments on commit c29f44a

Please sign in to comment.