MFEK / math.rlib

A library which supplies mathematics and algorithms for manipulating beziers.
Apache License 2.0
7 stars 4 forks source link

+`ContinuousBeziersIterator`. May need some more refactoring. #30

Closed ctrlcctrlv closed 1 year ago

ctrlcctrlv commented 1 year ago

This is for MFEK/kurbo.rlib#1 and linebender/kurbo#230.

Sorry for the long delay on this @raphlinus. Because your code did not handle discontinuous splines, I had to add support here first for iterating over only the continuous Beziers of a Piecewise Bezier path.

ctrlcctrlv commented 1 year ago

Ultimately I think it might be best to split this out of math.rlib and make a new Rust project out of the code, similar to cucoqu.rlib. Called something like discontinue.rlib. Basically, I'd create a crate that'll hard depend on kurbo, and then I'd define the same types as here.

The reason I think it might be best to do it that way is that this is yet more GPT-3 aided code.

I'm simply just not talented enough at this kind of thing to come up with stuff like:

         match G {
            // G^0 continuity
            // The two Bezier splines are connected if the end point of the first Bezier spline
            // equals the start point of the second Bezier spline.
            0 => xdist!() && ydist!(),
            // G^1 continuity
            // The two Bezier splines are connected if the end point of the first Bezier spline
            // equals the start point of the second Bezier spline and the tangent at the end point
            // equals the tangent at the start point.
            1 => xdist!() && ydist!() && taneq!(),
            // G^2 continuity
            // The two Bezier splines are connected if the end point of the first Bezier spline
            // equals the start point of the second Bezier spline and the tangent at the end point
            // equals the tangent at the start point and the second derivative at the end point
            // equals the second derivative at the start point.
            2 => xdist!() && ydist!() && taneq!() && crveq!(),
            const_order => {
                panic!("G continuity of order {} not supported.", const_order);
            }
        }

My policy on this is here: https://github.com/MFEK/cucoqu.rlib/blob/main/GPT-3%20(English).md

I might need to email Dr. Stallman or someone else at the FSF for guidance on this matter, as GPT-3 is becoming more and more important to my workflow.

ctrlcctrlv commented 1 year ago

Moving to own lib.