1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-21 16:02:08 +02:00

Clean up typos and run-on sentences. (#300)

* Clean up typos and run-on sentences.

* Make requested changes
This commit is contained in:
Steve Nicholson
2021-02-03 16:42:56 -08:00
committed by GitHub
parent 59f84f0621
commit cb54f43a68

View File

@@ -4,9 +4,9 @@ De Casteljau's algorithm is the pivotal algorithm when it comes to Bézier curve
How does that work? Succinctly: we run de Casteljau's algorithm in reverse! How does that work? Succinctly: we run de Casteljau's algorithm in reverse!
In order to run de Casteljau's algorithm in reverse, we need a few basic things: a start and end point, a point on the curve that want to be moving around, which has an associated *t* value, and a point we've not explicitly talked about before, and as far as I know has no explicit name, but lives one iteration higher in the de Casteljau process then our on-curve point does. I like to call it "A" for reasons that will become obvious. In order to run de Casteljau's algorithm in reverse, we need a few basic things: a start and end point, a point on the curve that we want to be moving around, which has an associated *t* value, and a point we've not explicitly talked about before, and as far as I know has no explicit name, but lives one iteration higher in the de Casteljau process then our on-curve point does. I like to call it "A" for reasons that will become obvious.
So let's use graphics instead of text to see where this "A" is, because text only gets us so far: move the sliders for the following graphics to see what, given specific `t` value, our `A` coordinate is. As well as some other coordinates, which taken together let us derive a value that the graphics call "ratio": if you move the curve's points around, A, B, and C will move, what happens to that value? So let's use graphics instead of text to see where this "A" is, because text only gets us so far: move the sliders for the following graphics to see what, given a specific `t` value, our `A` coordinate is. As well as some other coordinates, which taken together let us derive a value that the graphics call "ratio": if you move the curve's points around, A, B, and C will move, what happens to that value?
<div class="figure"> <div class="figure">
@@ -29,13 +29,13 @@ So these graphics show us several things:
These three values A, B, and C allow us to derive an important identity formula for quadratic and cubic Bézier curves: for any point on the curve with some `t` value, the ratio of distances from A to B and B to C is fixed: if some `t` value sets up a C that is 20% away from the start and 80% away from the end, then _it doesn't matter where the start, end, or control points are_; for that `t` value, `C` will *always* lie at 20% from the start and 80% from the end point. Go ahead, pick an on-curve point in either graphic and then move all the other points around: if you only move the control points, start and end won't move, and so neither will C, and if you move either start or end point, C will move but its relative position will not change. These three values A, B, and C allow us to derive an important identity formula for quadratic and cubic Bézier curves: for any point on the curve with some `t` value, the ratio of distances from A to B and B to C is fixed: if some `t` value sets up a C that is 20% away from the start and 80% away from the end, then _it doesn't matter where the start, end, or control points are_; for that `t` value, `C` will *always* lie at 20% from the start and 80% from the end point. Go ahead, pick an on-curve point in either graphic and then move all the other points around: if you only move the control points, start and end won't move, and so neither will C, and if you move either start or end point, C will move but its relative position will not change.
So, how can we compute `C`? We start with our observation that `C` always lies somewhere between the start and ends points, so logically `C` will have a function that interpolates between those two coordinates: So, how can we compute `C`? We start with our observation that `C` always lies somewhere between the start and end points, so logically `C` will have a function that interpolates between those two coordinates:
\[ \[
C = u(t) \cdot P_{start} + (1-u(t)) \cdot P_{end} C = u(t) \cdot P_{start} + (1-u(t)) \cdot P_{end}
\] \]
If we can figure out what the function `u(t)` looks like, we'll be done. Although we do need to remember that this `u(t)` will have a different for depending on whether we're working with quadratic or cubic curves. [Running through the maths](https://mathoverflow.net/questions/122257/finding-the-formula-for-bezier-curve-ratios-hull-point-point-baseline) (with thanks to Boris Zbarsky) shows us the following two formulae: If we can figure out what the function `u(t)` looks like, we'll be done. Although we do need to remember that this `u(t)` will have a different form depending on whether we're working with quadratic or cubic curves. [Running through the maths](https://mathoverflow.net/questions/122257/finding-the-formula-for-bezier-curve-ratios-hull-point-point-baseline) (with thanks to Boris Zbarsky) shows us the following two formulae:
\[ \[
u(t)_{quadratic} = \frac{(1-t)^2}{t^2 + (1-t)^2} u(t)_{quadratic} = \frac{(1-t)^2}{t^2 + (1-t)^2}
@@ -47,7 +47,7 @@ And
u(t)_{cubic} = \frac{(1-t)^3}{t^3 + (1-t)^3} u(t)_{cubic} = \frac{(1-t)^3}{t^3 + (1-t)^3}
\] \]
So, if we know the start and end coordinates, and we know the *t* value, we know C, without having to calculate the `A` or even `B` coordinates. In fact, we can do the same for the ratio function: as another function of `t`, we technically don't need to know what `A` or `B` or `C` are, we can express it was a pure function of `t`, too. So, if we know the start and end coordinates and the *t* value, we know C without having to calculate the `A` or even `B` coordinates. In fact, we can do the same for the ratio function. As another function of `t`, we technically don't need to know what `A` or `B` or `C` are. It, too, can be expressed as a pure function of `t`.
We start by observing that, given `A`, `B`, and `C`, the following always holds: We start by observing that, given `A`, `B`, and `C`, the following always holds:
@@ -67,7 +67,7 @@ And
ratio(t)_{cubic} = \left | \frac{t^3 + (1-t)^3 - 1}{t^3 + (1-t)^3} \right | ratio(t)_{cubic} = \left | \frac{t^3 + (1-t)^3 - 1}{t^3 + (1-t)^3} \right |
\] \]
Which now leaves us with some powerful tools: given thee points (start, end, and "some point on the curve"), as well as a `t` value, we can _construct_ curves: we can compute `C` using the start and end points, and our `u(t)` function, and once we have `C`, we can use our on-curve point (`B`) and the `ratio(t)` function to find `A`: Which now leaves us with some powerful tools: given three points (start, end, and "some point on the curve"), as well as a `t` value, we can _construct_ curves. We can compute `C` using the start and end points and our `u(t)` function, and once we have `C`, we can use our on-curve point (`B`) and the `ratio(t)` function to find `A`:
\[ \[
A = B - \frac{C - B}{ratio(t)} = B + \frac{B - C}{ratio(t)} A = B - \frac{C - B}{ratio(t)} = B + \frac{B - C}{ratio(t)}
@@ -82,7 +82,7 @@ With `A` found, finding `e1` and `e2` for quadratic curves is a matter of runnin
\end{aligned} \right . \end{aligned} \right .
\] \]
And then reverse engineer the curve's control control points: And then reverse engineer the curve's control points:
\[ \[
\left \{ \begin{aligned} \left \{ \begin{aligned}
@@ -91,4 +91,4 @@ And then reverse engineer the curve's control control points:
\end{aligned} \right . \end{aligned} \right .
\] \]
So: if we have a curve's start and end point, then for any `t` value we implicitly know all the ABC values, which (combined with an educated guess on appropriate `e1` and `e2` coordinates for cubic curves) gives us the necessary information to reconstruct a curve's "de Casteljau skeleton". Which means that we can now do several things: we can "fit" curves using only three points, which means we can also "mold" curves by moving an on-curve point but leaving its start and end point, and then reconstructing the curve based on where we moved the on-curve point to. These are very useful things, and we'll look at both in the next few sections. So: if we have a curve's start and end points, then for any `t` value we implicitly know all the ABC values, which (combined with an educated guess on appropriate `e1` and `e2` coordinates for cubic curves) gives us the necessary information to reconstruct a curve's "de Casteljau skeleton". Which means that we can now do several things: we can "fit" curves using only three points, which means we can also "mold" curves by moving an on-curve point but leaving its start and end points, and then reconstruct the curve based on where we moved the on-curve point to. These are very useful things, and we'll look at both in the next few sections.