I’m writing a C# component that requires curves with C3 continuity or higher as input to work properly. If there are C3 discontinuities, I need to stop the calculation and warn the user, but I’m having trouble writing this validation logic.
The continuity enum only has options for C2 or CInfinity, so it’s not precise enough. Is there some other way to check this? I’ve gathered that curve degree n-1 sets a continuity “ceiling” for a curve with knots, but that there are other factors at play which might make it lower.
As a home-made C3 validation check I could see something like…:
check for C2 discontinuities;
then for knots;
and require the degree to be 4 or more if there are knots
…covering a large majority of the cases.
Is that assumption correct? Am I missing something? Is there a simpler way?
In case of a C3 continuity, a curve needs to match with G3 continuity. Plus all of the involved CP’s of one curve have the same relative distance to its equivalents on the other curve. Essentially this says these 4 points are mirrored by the normal. This is a special case of G3.
G3 basically means that the rate-of-change of the curvature is equal at the point of matching.
But since you also know that for C3 a symmetry is involved, you can skip this check, and simply check for symmetry of p0 to q0, p1 to q1, p2 to q2 and p3 to q3, given that there is G1 continuity!
I think even detecting a mirrored situation can be sufficient. It depends a bit. There are tools which will check for G2/G3 continuity, and even say how much you are off, even if there is no positional or tangency match. It then just compares the curvature or the rate-of-change of the curvature, but not its relative location. In this case, checking for G1 is then also redundant.
Getting all knot parameters (CInfinity discontinuities),
checking DerivativeAt (above and below) at each one,
and then looping through each pair to check equality
… is a very concise way of doing it, and works like a charm.
I love that video, but I couldn’t quite figure out how to put that knowledge into practice. I never explicitly set out joints, and it didn’t really occur to me that the knot points are equivalent to CInfinity discontinuities. Now it clicked - thanks again.