Skip to content

Commit 3a1255f

Browse files
lynzrandrami3l
authored andcommitted
refactor: default quad bezier type to using FP points
1 parent 4d13191 commit 3a1255f

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

crates/monoxide-curves/src/convert/cube_to_quad.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
55
use kurbo::PathSeg;
66

7-
use crate::{CubicBezier, CubicSegment, QuadBezier, point::Point2D};
7+
use crate::{CubicBezier, CubicSegment, QuadBezier};
88

99
/// Convert a cubic bezier curve into a quadratic bezier curve, with `prec` as
1010
/// the maximum allowed distance between the original curve and its
1111
/// approximation.
12-
pub fn cube_to_quad(cube: CubicBezier, prec: f64) -> QuadBezier<Point2D> {
12+
pub fn cube_to_quad(cube: CubicBezier, prec: f64) -> QuadBezier {
1313
let mut quad = QuadBezier::builder(cube.start);
1414

1515
for seg in cube.segment_iter() {

crates/monoxide-curves/src/quad.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::point::Point2D;
2+
13
/// A quadratic bezier segment, with `P` as the point type
24
#[derive(Debug, Clone, PartialEq)]
35
pub struct QuadSegment<P> {
@@ -16,7 +18,7 @@ impl<P: PartialEq> QuadSegment<P> {
1618

1719
/// A Bezier curve with `P` as the point type and `S` as the segment type.
1820
#[derive(Debug, Clone, PartialEq)]
19-
pub struct QuadBezier<P> {
21+
pub struct QuadBezier<P = Point2D> {
2022
/// The start point of the curve.
2123
pub start: P,
2224
/// The segments of the curve.
@@ -56,7 +58,7 @@ impl<P: Copy> QuadBezier<P> {
5658
}
5759
}
5860

59-
pub struct QuadBezierBuilder<P> {
61+
pub struct QuadBezierBuilder<P = Point2D> {
6062
bezier: QuadBezier<P>,
6163
}
6264

0 commit comments

Comments
 (0)