To find any point P along a line, use the formula: P = (1-t)P0 + (t)P1 , where t is the percentage along the line the point lies and P0 is the start point and P1 is the end point. Knowing this, we can now solve for the unknown control point.
As the algorithm is recursive, we can build Bezier curves of any order, that is: using 5, 6 or more control points. But in practice many points are less useful. Usually we take 2-3 points, and for complex lines glue several curves together. That's simpler to develop and calculate.
k=0: The Bezier curve starts at the first control point and stops at the last control point. (In general, it will not pass through any other control point.) k=1: The vector tangent to the Bezier curve at the start (stop) is parallel to the line connecting the first two (last two) control points.
Number of points i.e. k=4, Hence, we know that the degree of the Bezier curve is n= k-1= 4-1= 3. Hence, P0(2,2,0) and B0,3=(1−u)3,P1(2,3,0) and B1,3=3u(1−u)2,P2(3,3,0) and B2,3=3u2(1−u) andP2(3,2,0) and B3,3=u3.
Specifically, I'm working in canvas with javascript.
Basically, I have objects which have boundaries that I want to avoid, but still surround with a bezier curve. However, I'm not even sure where to begin to write an algorithm that would move control points to avoid colliding.
The problem is in the image below, even if you're not familiar with music notation, the problem should still be fairly clear. The points of the curve are the red dots
Also, I have access to the bounding boxes of each note, which includes the stem.
So naturally, collisions must be detected between the bounding boxes and the curves (some direction here would be good, but I've been browsing and see that there's a decent amount of info on this). But what happens after collisions have been detected? What would have to happen to calculate control points locations to make something that looked more like:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With