author tbah Tue, 21 May 2013 22:00:13 +0200 changeset 497 e488deaa93a8 parent 496 6a335756fc10 child 498 6f0ada2a80cc
Add curvature equations for elliptical arcs.
 master/painting.html
--- a/master/painting.html	Tue May 21 20:10:29 2013 +0200
+++ b/master/painting.html	Tue May 21 22:00:13 2013 +0200
@@ -1360,8 +1360,103 @@
<p>For a line: the curvature is infinite. Extend the outer stroke edge by a line.</p>

<p>For an elliptical arc:</p>
-<p class="issue">Need to do. This isn't as trivial as it first looks since we have to deal
-  with rx != ry and an arbitrary rotation.</p>
+
+  <div role="math" aria-describedby="math-curvature-of-ellipse">
+    <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+      <mi>&#x03BA;<!-- κ --></mi>
+      <mo stretchy="false">(</mo>
+      <mi>t</mi>
+      <mo stretchy="false">)</mo>
+      <mo>=</mo>
+      <mrow class="MJX-TeXAtom-ORD">
+	<mfrac>
+	  <mrow class="MJX-TeXAtom-ORD">
+            <msub>
+              <mi>r</mi>
+              <mi>x</mi>
+            </msub>
+            <msub>
+              <mi>r</mi>
+              <mi>y</mi>
+            </msub>
+	  </mrow>
+	  <mrow class="MJX-TeXAtom-ORD">
+            <mo stretchy="false">(</mo>
+            <msubsup>
+              <mi>r</mi>
+              <mi>x</mi>
+              <mn>2</mn>
+            </msubsup>
+            <msup>
+              <mi>sin</mi>
+              <mn>2</mn>
+            </msup>
+            <mo>&#x2061;<!-- ⁡ --></mo>
+            <mi>t</mi>
+            <mo>+</mo>
+            <msubsup>
+              <mi>r</mi>
+              <mi>y</mi>
+              <mn>2</mn>
+            </msubsup>
+            <msup>
+              <mi>cos</mi>
+              <mn>2</mn>
+            </msup>
+            <mo>&#x2061;<!-- ⁡ --></mo>
+            <mi>t</mi>
+            <msup>
+              <mo stretchy="false">)</mo>
+              <mrow class="MJX-TeXAtom-ORD">
+		<mn>3</mn>
+		<mrow class="MJX-TeXAtom-ORD">
+		  <mo>/</mo>
+		</mrow>
+		<mn>2</mn>
+              </mrow>
+            </msup>
+	  </mrow>
+	</mfrac>
+      </mrow>
+    [/itex]
+    <pre id="math-curvature-of-ellipse">$$\kappa(t) = {{r_x r_y}\over{(r_x^2 \sin^2 t + r_y^2 \cos^2 t)^{3/2}}}$$</pre>
+  </div>
+
+  <p>where:</p>
+
+  <div role="math" aria-describedby="math-curvature-t">
+    <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+      <mi>t</mi>
+      <mo>=</mo>
+      <mi>arctan</mi>
+      <mo>&#x2061;<!-- ⁡ --></mo>
+      <mo stretchy="false">(</mo>
+      <mrow class="MJX-TeXAtom-ORD">
+	<mfrac>
+	  <msub>
+            <mi>r</mi>
+            <mi>y</mi>
+	  </msub>
+	  <msub>
+            <mi>r</mi>
+            <mi>x</mi>
+	  </msub>
+	</mfrac>
+      </mrow>
+      <mi>tan</mi>
+      <mo>&#x2061;<!-- ⁡ --></mo>
+      <mi>&#x03B8;<!-- θ --></mi>
+      <mo stretchy="false">)</mo>
+    [/itex]
+    <pre id="math-curvature-t">$$t = \arctan ( {r_y \over r_x} \tan \theta )$$</pre>
+  </div>
+
+  <p>The parameter <var>&#x03B8;</var> at the beginning or end of an
+    arc segment can be found by using the formulas in
+    the <a href="implnote.html#ArcImplementationNotes">Elliptical arc
+    implementation notes</a>. (Note, some renderers convert elliptical
+    arcs to cubic Béziers prior to rendering so the equations here may
+    not be needed.)</p>

<p>For a quadratic Bézier:</p>