Answer the question
In order to leave comments, you need to log in
How to compare the shape of bezier curves?
Tell me where to dig to write an algorithm for comparing curves, or poke into a ready-made solution.
The coordinates of points and anchors are known. These coordinates for the two compared curves do not match. The number of points on the curve can also be different. It is necessary to compare the form. For true, the shape should "roughly" match.
I found $1 recognizer, but as I understand it, it does not work with Bezier curves.
Please see the picture:
Answer the question
In order to leave comments, you need to log in
The curvature depends on the signs of the second derivative. If you have several connected Bezier curves, then the second derivative may not exist at the boundary.
If cubic Bezier curves are used, then the second derivative is a linear function. Therefore, for one segment there may be options:
1. The second derivative is positive.
2. The second derivative is negative.
3. The second derivative changes sign from plus to minus.
4. The second derivative changes sign from minus to plus.
Therefore, in order to compare two curves consisting of several Bézier curves, it is possible to classify each segment of each curve by the form of the second derivative and compare the classification.
If I understand correctly, you want to compare up to curvature. I would parametric the curve and take the second derivative d^2 f / dt^2. At each point, this will be the normal to the curve. It is necessary for each curve to write down a sequence when this normal is on the left of the curve, when it is zero (the curve goes straight or an inflection point), when it is on the right. You will get such a line, for example, +1,0,-1,...,1. Well, compare them.
The sign can be obtained, for example, by counting the determinant a 2x2 matrix composed of vectors for the first and second derivatives. You can try to do it numerically first. If appropriate, try to solve analytically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question