linebender / kurbo

A Rust library for manipulating curves
Apache License 2.0
697 stars 67 forks source link

Make TranslateScale::from_scale_about to take `Into<Point>`. #323

Closed ratmice closed 7 months ago

ratmice commented 10 months ago

bring it into alignment with Rect methods that take Into<Point>.

Randomly noticed this, this patch doesn't do a full audit of the methods taking Point, should (we, or I) do such? I went ahead and had a look through, here are the functions that take Points as parameters that we could consider changing.

  1. The nearest functions of ParamCurve, CubicBez, QuadBez, PathSeg, and Line.
  2. Shape::winding, and Shape::contains trait methods.
  3. The other variable, of various Point functions lerp midpoint, distance, distance_squared
  4. Rect::union_pt
  5. Ellipse::with_center
  6. Affine::rotate_about, pre_rotate_about, then_rotate_about.

Here are some things I don't think should change, and reasons

  1. While the new fn of QuadSpline takes a Vec<Point>, it takes ownership, turning it into an IntoIterator or something Would force an allocation in collect.