Skip to content

Commit

Permalink
Rename Spline to SimpleSpline
Browse files Browse the repository at this point in the history
We're going to use Spline for the general case, so free up that name.
It's likely SimpleSpline will go away as it will be fully subsumed by
Spline, but it's also possible it will remain useful in some cases.
  • Loading branch information
raphlinus authored and cmyr committed Dec 8, 2020
1 parent 72a5641 commit dce3cbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rand::distributions::{Distribution, Uniform};

use kurbo::Point;

use spline::Spline;
use spline::SimpleSpline;

fn main() {
let mut rng = rand::thread_rng();
Expand All @@ -19,7 +19,7 @@ fn main() {
Point::new(x, y)
})
.collect::<Vec<_>>();
let mut spline = Spline::new(pts.clone());
let mut spline = SimpleSpline::new(pts.clone());
for iter_ix in 0..10 {
let abs_err = spline.iterate(iter_ix);
eprintln!("err: {}", abs_err);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
//! [research spline]: https://github.com/raphlinus/spline-research
mod hyperbezier;
mod spline;
mod simple_spline;
mod util;

pub use hyperbezier::{HyperBezier, ThetaParams};
pub use spline::Spline;
pub use simple_spline::SimpleSpline;
10 changes: 5 additions & 5 deletions src/spline.rs → src/simple_spline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use kurbo::{Affine, BezPath, Point, Vec2};
use crate::hyperbezier::{HyperBezier, HyperBezierResult, ThetaParams};
use crate::util;

pub struct Spline {
pub struct SimpleSpline {
pts: Vec<Point>,
ths: Vec<f64>,
}
Expand All @@ -18,10 +18,10 @@ struct Seg {
d: Vec2,
}

impl Spline {
pub fn new(pts: Vec<Point>) -> Spline {
impl SimpleSpline {
pub fn new(pts: Vec<Point>) -> SimpleSpline {
let ths = Self::initial_ths(&pts);
Spline { pts, ths }
SimpleSpline { pts, ths }
}

fn initial_ths(pts: &[Point]) -> Vec<f64> {
Expand Down Expand Up @@ -150,7 +150,7 @@ impl Spline {

fn bias_for_theta(th: f64) -> f64 {
// Tangent angles up to this limit will be Euler spirals.
const EULER_LIMIT: f64 = 0.4 * PI;
const EULER_LIMIT: f64 = 0.3 * PI;
let th = th.abs();
if th < EULER_LIMIT {
1.0
Expand Down

0 comments on commit dce3cbe

Please sign in to comment.