mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-31 12:01:54 +02:00
.
This commit is contained in:
@@ -121,7 +121,9 @@
|
||||
<li><a href="#aligning">Aligning curves</a></li>
|
||||
<li><a href="#tightbounds">Tight bounding boxes</a></li>
|
||||
<li><a href="#inflections">Curve inflections</a></li>
|
||||
<li><a href="#canonical">Canonical form (for cubic curves)</a></li>
|
||||
<li>
|
||||
<a href="#canonical">The canonical form (for cubic curves)</a>
|
||||
</li>
|
||||
<li><a href="#yforx">Finding Y, given X</a></li>
|
||||
<li><a href="#arclength">Arc length</a></li>
|
||||
<li><a href="#arclengthapprox">Approximated arc length</a></li>
|
||||
@@ -3824,7 +3826,9 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
>
|
||||
</section>
|
||||
<section id="canonical">
|
||||
<h1><a href="#canonical">Canonical form (for cubic curves)</a></h1>
|
||||
<h1>
|
||||
<a href="#canonical">The canonical form (for cubic curves)</a>
|
||||
</h1>
|
||||
<p>
|
||||
While quadratic curves are relatively simple curves to analyze, the
|
||||
same cannot be said of the cubic curve. As a curvature is controlled
|
||||
@@ -4006,11 +4010,11 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
<p>
|
||||
The approach is going to start with a curve that doesn't have
|
||||
all-colinear points (so we need to make sure the points don't all
|
||||
fall on a straight line), and then applying four graphics operations
|
||||
that you will probably have heard of: translation (moving all points
|
||||
by some fixed x- and y-distance), scaling (multiplying all points by
|
||||
some x and y scale factor), and shearing (an operation that turns
|
||||
rectangles into parallelograms).
|
||||
fall on a straight line), and then applying three graphics
|
||||
operations that you will probably have heard of: translation (moving
|
||||
all points by some fixed x- and y-distance), scaling (multiplying
|
||||
all points by some x and y scale factor), and shearing (an operation
|
||||
that turns rectangles into parallelograms).
|
||||
</p>
|
||||
<p>
|
||||
Step 1: we translate any curve by -p1.x and -p1.y, so that the curve
|
||||
@@ -4026,8 +4030,8 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
</p>
|
||||
<img
|
||||
class="LaTeX SVG"
|
||||
src="./images/chapters/canonical/d089cc0687982a3302249bb82af3fc16.svg"
|
||||
width="499px"
|
||||
src="./images/chapters/canonical/2a411f175dcc987cdcc12e7df49ca272.svg"
|
||||
width="464px"
|
||||
height="55px"
|
||||
loading="lazy"
|
||||
/>
|
||||
@@ -4038,8 +4042,8 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
</p>
|
||||
<img
|
||||
class="LaTeX SVG"
|
||||
src="./images/chapters/canonical/058fa85ac31eb666857a860fdedd79df.svg"
|
||||
width="477px"
|
||||
src="./images/chapters/canonical/ba5f418452c3657f3c4dd4b319e59070.svg"
|
||||
width="447px"
|
||||
height="57px"
|
||||
loading="lazy"
|
||||
/>
|
||||
@@ -4124,16 +4128,18 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
</p>
|
||||
<img
|
||||
class="LaTeX SVG"
|
||||
src="./images/chapters/canonical/2f85d84f0e3dd14cc25e48583aed3822.svg"
|
||||
width="460px"
|
||||
height="80px"
|
||||
src="./images/chapters/canonical/f039b4e7cf0203df9fac48dad820b2b7.svg"
|
||||
width="455px"
|
||||
height="91px"
|
||||
loading="lazy"
|
||||
/>
|
||||
<p>
|
||||
That looks very complex, but notice that every coordinate value is
|
||||
being offset by the initial translation, and a lot of terms in there
|
||||
repeat: it's pretty easy to calculate this fast, since there's so
|
||||
much we can cache and reuse while we compute this mapped coordinate!
|
||||
Okay, well, that looks plain ridiculous, but: notice that every
|
||||
coordinate value is being offset by the initial translation, and
|
||||
also notice that <em>a lot</em> of terms in that expression are
|
||||
repeated. Even though the maths looks crazy as a single expression,
|
||||
we can just pull this apart a little and end up with an
|
||||
easy-to-calculate bit of code!
|
||||
</p>
|
||||
<p>
|
||||
First, let's just do that translation step as a "preprocessing"
|
||||
@@ -4142,9 +4148,9 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
</p>
|
||||
<img
|
||||
class="LaTeX SVG"
|
||||
src="./images/chapters/canonical/83262761bb7fa9b832fe483ded436973.svg"
|
||||
width="359px"
|
||||
height="56px"
|
||||
src="./images/chapters/canonical/16fad73cbbbd2202b08ebef05b1579c5.svg"
|
||||
width="317px"
|
||||
height="67px"
|
||||
loading="lazy"
|
||||
/>
|
||||
<p>
|
||||
@@ -4156,9 +4162,9 @@ function getCubicRoots(pa, pb, pc, pd) {
|
||||
</p>
|
||||
<img
|
||||
class="LaTeX SVG"
|
||||
src="./images/chapters/canonical/f3261ad2802d980ebe6e35b272375700.svg"
|
||||
width="427px"
|
||||
height="40px"
|
||||
src="./images/chapters/canonical/5af3d1772ee07e634d04259a02f7201f.svg"
|
||||
width="483px"
|
||||
height="56px"
|
||||
loading="lazy"
|
||||
/>
|
||||
<p>
|
||||
|
Reference in New Issue
Block a user