1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-02-25 01:53:05 +01:00

Small edits to control section. (#178)

* Small edits to control section.

* Fix code bug. Fixes #168
This commit is contained in:
Simon Cozens 2019-06-11 01:01:06 +01:00 committed by Pomax
parent 50ef8bdf3c
commit dc26026d09

View File

@ -1,6 +1,6 @@
# Controlling Bézier curvatures
Bézier curves are (like all "splines") interpolation functions, meaning they take a set of points, and generate values somewhere "between" those points. (One of the consequences of this is that you'll never be able to generate a point that lies outside the outline for the control points, commonly called the "hull" for the curve. Useful information!). In fact, we can visualize how each point contributes to the value generated by the function, so we can see which points are important, where, in the curve.
Bézier curves are, like all "splines", interpolation functions. This means that they take a set of points, and generate values somewhere "between" those points. (One of the consequences of this is that you'll never be able to generate a point that lies outside the outline for the control points, commonly called the "hull" for the curve. Useful information!). In fact, we can visualize how each point contributes to the value generated by the function, so we can see which points are important, where, in the curve.
The following graphs show the interpolation functions for quadratic and cubic curves, with "S" being the strength of a point's contribution to the total sum of the Bézier function. Click or click-drag to see the interpolation percentages for each curve-defining point at a specific <i>t</i> value.
@ -12,7 +12,7 @@ The following graphs show the interpolation functions for quadratic and cubic cu
Also shown is the interpolation function for a 15<sup>th</sup> order Bézier function. As you can see, the start and end point contribute considerably more to the curve's shape than any other point in the control point set.
If we want to change the curve, we need to change the weights of each point, effectively changing the interpolations. The way to do this is about as straight forward as possible: just multiply each point with a value that changes its strength. These values are conventionally called "Weights", and we can add them to our original Bézier function:
If we want to change the curve, we need to change the weights of each point, effectively changing the interpolations. The way to do this is about as straightforward as possible: just multiply each point with a value that changes its strength. These values are conventionally called "weights", and we can add them to our original Bézier function:
\[
Bézier(n,t) = \sum_{i=0}^{n}
@ -47,12 +47,12 @@ Given that we already know how to implement basis function, adding in the contro
```
function Bezier(n,t,w[]):
sum = 0
for(k=0; k<n; k++):
for(k=0; k<=n; k++):
sum += w[k] * binomial(n,k) * (1-t)^(n-k) * t^(k)
return sum
```
And for the extremely optimized versions:
And now for the extremely optimized versions:
```
function Bezier(2,t,w[]):