Skip to content

Commit

Permalink
Derive Debug and Clone more
Browse files Browse the repository at this point in the history
This will just make it easier to integrate this into things like
runebender.
  • Loading branch information
cmyr committed Dec 8, 2020
1 parent 1b40035 commit 4100bae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hyperbezier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use crate::util;
/// A few observation. If both bias values are 1, then the curve is an Euler
/// spiral. If both bias values are less than 1, then curvature is a cubic
/// polynomial as a function of arclength, so it is a Spiro curve.
#[derive(Copy, Clone, Debug)]
pub struct HyperBezier {
pub k0: f64,
pub bias0: f64,
Expand All @@ -45,6 +46,7 @@ pub struct HyperBezier {
///
/// Here, angles are given relative to the chord, but the bias parameters
/// are the same as for `HyperBezier`.
#[derive(Copy, Clone, Debug)]
pub struct ThetaParams {
pub th0: f64,
pub bias0: f64,
Expand All @@ -57,7 +59,7 @@ pub struct ThetaParams {
/// The `th0` and `th1` values are defined so that if they are have the
/// same sign, the curve is convex, but if they are opposite signs, it is
/// an "s" shape.
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct HyperBezierResult {
/// Tangent angle from the chord to the curve at the start point.
pub th0: f64,
Expand Down Expand Up @@ -301,4 +303,4 @@ fn test_k() {
assert!((k - actual_k).abs() < 1e-5);
//println!("{}, {}, {}", k, bias, actual_k);
}
}
}
4 changes: 4 additions & 0 deletions src/spline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::util;
/// The specification of a spline curve.
///
/// Currently this represents a single subpath.
#[derive(Clone, Debug)]
pub struct SplineSpec {
elements: Vec<Element>,
is_closed: bool,
Expand All @@ -22,12 +23,14 @@ pub struct SplineSpec {
segments: Vec<Segment>,
}

#[derive(Clone, Debug)]
pub struct Spline {
segments: Vec<Segment>,
is_closed: bool,
}

/// A single spline segment.
#[derive(Clone, Debug)]
pub struct Segment {
pub p0: Point,
pub p1: Point,
Expand All @@ -46,6 +49,7 @@ pub struct Segment {
ch: f64,
}

#[derive(Copy, Clone, Debug)]
enum Element {
MoveTo(Point),
LineTo(Point, bool),
Expand Down

0 comments on commit 4100bae

Please sign in to comment.