mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-30 19:50:01 +02:00
en sections 31-35
This commit is contained in:
16
components/sections/graduatedoffset/content.en-GB.md
Normal file
16
components/sections/graduatedoffset/content.en-GB.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Graduated curve offsetting
|
||||
|
||||
What if we want to do graduated offsetting, starting at some distance `s` but ending at some other distance `e`? well, if we can compute the length of a curve (which we can if we use the Legendre-Gauss quadrature approach) then we can also determine how far "along the line" any point on the curve is. With that knowledge, we can offset a curve so that its offset curve is not uniformly wide, but graduated between with two different offset widths at the start and end.
|
||||
|
||||
Like normal offsetting we cut up our curve in sub-curves, and then check at which distance along the original curve each sub-curve starts and ends, as well as to which point on the curve each of the control points map. This gives us the distance-along-the-curve for each interesting point in the sub-curve. If we call the total length of all sub-curves seen prior to seeing "the current" sub-curve `S` (and if the current sub-curve is the first one, `S` is zero), and we call the full length of our original curve `L`, then we get the following graduation values:
|
||||
|
||||
- start: map `S` from interval (`0,L`) to interval `(s,e)`
|
||||
- c1: `map(<strong>S+d1</strong>, 0,L, s,e)`, d1 = distance along curve to projection of c1
|
||||
- c2: `map(<strong>S+d2</strong>, 0,L, s,e)`, d2 = distance along curve to projection of c2
|
||||
- ...
|
||||
- end: `map(<strong>S+length(subcurve)</strong>, 0,L, s,e)`
|
||||
|
||||
At each of the relevant points (start, end, and the projections of the control points onto the curve) we know the curve's normal, so offsetting is simply a matter of taking our original point, and moving it along the normal vector by the offset distance for each point. Doing so will give us the following result (these have with a starting width of 0, and an end width of 40 pixels, but can be controlled with your up and down arrow keys):
|
||||
|
||||
<Graphic preset="simple" title="Offsetting a quadratic Bézier curve" setup={this.setupQuadratic} draw={this.draw} onKeyDown={this.props.onKeyDown}/>
|
||||
<Graphic preset="simple" title="Offsetting a cubic Bézier curve" setup={this.setupCubic} draw={this.draw} onKeyDown={this.props.onKeyDown}/>
|
@@ -1,6 +1,9 @@
|
||||
var React = require("react");
|
||||
var Graphic = require("../../Graphic.jsx");
|
||||
var SectionHeader = require("../../SectionHeader.jsx");
|
||||
|
||||
var Locale = require("../../../lib/locale");
|
||||
var locale = new Locale();
|
||||
var page = "graduatedoffset";
|
||||
|
||||
var keyHandling = require("../../decorators/keyhandling-decorator.jsx");
|
||||
|
||||
var GraduatedOffsetting = React.createClass({
|
||||
@@ -16,7 +19,7 @@ var GraduatedOffsetting = React.createClass({
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
title: "Graduated curve offsetting"
|
||||
title: locale.getTitle(page)
|
||||
};
|
||||
},
|
||||
|
||||
@@ -47,43 +50,7 @@ var GraduatedOffsetting = React.createClass({
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<section>
|
||||
<SectionHeader {...this.props} />
|
||||
|
||||
<p>What if we want to do graduated offsetting, starting at some distance <i>s</i> but ending
|
||||
at some other distance <i>e</i>? well, if we can compute the length of a curve (which we can
|
||||
if we use the Legendre-Gauss quadrature approach) then we can also determine how far "along the
|
||||
line" any point on the curve is. With that knowledge, we can offset a curve so that its offset
|
||||
curve is not uniformly wide, but graduated between with two different offset widths at the
|
||||
start and end.</p>
|
||||
|
||||
<p>Like normal offsetting we cut up our curve in sub-curves, and then check at which distance
|
||||
along the original curve each sub-curve starts and ends, as well as to which point on the curve
|
||||
each of the control points map. This gives us the distance-along-the-curve for each interesting
|
||||
point in the sub-curve. If we call the total length of all sub-curves seen prior to seeing "the\
|
||||
current" sub-curve <i>S</i> (and if the current sub-curve is the first one, <i>S</i> is zero),
|
||||
and we call the full length of our original curve <i>L</i>, then we get the following graduation
|
||||
values:</p>
|
||||
|
||||
<ul>
|
||||
<li>start: map <i>S</i> from interval (<i>0,L</i>) to interval <i>(s,e)</i></li>
|
||||
<li>c1: <i>map(<strong>S+d1</strong>, 0,L, s,e)</i>, d1 = distance along curve to projection of c1</li>
|
||||
<li>c2: <i>map(<strong>S+d2</strong>, 0,L, s,e)</i>, d2 = distance along curve to projection of c2</li>
|
||||
<li>...</li>
|
||||
<li>end: <i>map(<strong>S+length(subcurve)</strong>, 0,L, s,e)</i></li>
|
||||
</ul>
|
||||
|
||||
<p>At each of the relevant points (start, end, and the projections of the control points onto
|
||||
the curve) we know the curve's normal, so offsetting is simply a matter of taking our original
|
||||
point, and moving it along the normal vector by the offset distance for each point. Doing so
|
||||
will give us the following result (these have with a starting width of 0, and an end width
|
||||
of 40 pixels, but can be controlled with your up and down arrow keys):</p>
|
||||
|
||||
<Graphic preset="simple" title="Offsetting a quadratic Bézier curve" setup={this.setupQuadratic} draw={this.draw} onKeyDown={this.props.onKeyDown}/>
|
||||
<Graphic preset="simple" title="Offsetting a cubic Bézier curve" setup={this.setupCubic} draw={this.draw} onKeyDown={this.props.onKeyDown}/>
|
||||
</section>
|
||||
);
|
||||
return locale.getContent(page, this);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user