svg2: Add curvature equations for elliptical arcs.

details:   https://svgwg.org/hg/svg2/rev/e488deaa93a8
branches:  
changeset: 497:e488deaa93a8
user:      tbah <tavmjong@free.fr>
date:      Tue May 21 22:00:13 2013 +0200
description:
Add curvature equations for elliptical arcs.

diffstat:

 master/painting.html |  99 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 97 insertions(+), 2 deletions(-)

diffs (119 lines):

diff --git a/master/painting.html b/master/painting.html
--- a/master/painting.html
+++ b/master/painting.html
@@ -1355,18 +1355,113 @@ a subpath is determined as follows:</p>
   the stroke: <var>r<sub>c</sub></var> = <var>r</var> &#x00b1; &#xbd;
   stroke-width. The center of the circle will be on a line normal to
   the path end a distance of <var>r<sub>c</sub></var> away from the
   outer stroke edge at the end.</p>
 
 <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>
+    </math>
+    <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>
+    </math>
+    <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>
 
   <div role="math" aria-describedby="math-quadratic-start">
     <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
       <mi>&#x03BA;<!-- κ --></mi>
       <mo stretchy="false">(</mo>
       <mn>0</mn>

Received on Tuesday, 21 May 2013 20:02:43 UTC