/usr/share/doc/libghc-diagrams-lib-doc/html/Diagrams-TwoD-Curvature.html is in libghc-diagrams-lib-doc 0.7.1.1-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Diagrams.TwoD.Curvature</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Diagrams-TwoD-Curvature.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Diagrams-TwoD-Curvature.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">diagrams-lib-0.7.1.1: Embedded domain-specific language for declarative graphics</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Maintainer</th><td>diagrams-discuss@googlegroups.com</td></tr><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Diagrams.TwoD.Curvature</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Compute curvature for segments in two dimensions.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:curvature">curvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:radiusOfCurvature">radiusOfCurvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:squaredCurvature">squaredCurvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:squaredRadiusOfCurvature">squaredRadiusOfCurvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:curvature" class="def">curvature</a><a href="src/Diagrams-TwoD-Curvature.html#curvature" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a></td><td class="doc"><p>Segment to measure on.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p>Parameter to measure at.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p>Result is a <code>PosInf</code> value where <code>PosInfty</code> represents
infinite curvature or zero radius of curvature.
</p></td></tr></table></div><div class="doc"><p>Curvature measures how curved the segment is at a point. One intuition
for the concept is how much you would turn the wheel when driving a car
along the curve. When the wheel is held straight there is zero curvature.
When turning a corner to the left we will have positive curvature. When
turning to the right we will have negative curvature.
</p><p>Another way to measure this idea is to find the largest circle that we can
push up against the curve and have it touch (locally) at exactly the point
and not cross the curve. This is a tangent circle. The radius of that
circle is the "Radius of Curvature" and it is the reciprocal of curvature.
Note that if the circle is on the "left" of the curve, we have a positive
radius, and if it is to the right we have a negative radius. Straight
segments have an infinite radius which leads us to our representation. We
result in a pair of numerator and denominator so we can include infinity and
zero for both the radius and the curvature.
</p><p>Lets consider the following curve:
</p><p><img src="diagrams/diagramA.svg#diagram=diagramA&height=200&width=400" />
</p><p>The curve starts with positive curvature,
</p><p><img src="diagrams/diagramPos.svg#diagram=diagramPos&height=200&width=400" />
</p><p>approaches zero curvature
</p><p><img src="diagrams/diagramZero.svg#diagram=diagramZero&height=200&width=400" />
</p><p>then has negative curvature
</p><p><img src="diagrams/diagramNeg.svg#diagram=diagramNeg&height=200&width=400" />
</p><pre> {-# LANGUAGE GADTs #-}
import Diagrams.TwoD.Curvature
import Data.Monoid.Inf
import Diagrams.Coordinates
segmentA = Cubic (12 & 0) (8 & 10) (OffsetClosed (20 & 8))
curveA = lw 0.1 . stroke . fromSegments $ [segmentA]
diagramA = pad 1.1 . centerXY $ curveA
diagramPos = diagramWithRadius 0.2
diagramZero = diagramWithRadius 0.5
diagramNeg = diagramWithRadius 0.8
diagramWithRadius t = pad 1.1 . centerXY
$ curveA
<> showCurvature segmentA t
# withEnvelope (curveA :: D R2)
# lw 0.05 # lc red
showCurvature bez@(Cubic b c (OffsetClosed d)) t
| v == 0 = mempty
| otherwise = go (radiusOfCurvature bez t)
where
v@(x,y) = unr2 $ firstDerivative b c d t
vp = (-y) & x
firstDerivative b c d t = let tt = t*t in (3*(3*tt-4*t+1))*^b + (3*(2-3*t)*t)*^c + (3*tt)*^d
go Infinity = mempty
go (Finite r) = (circle (abs r) # translate vpr
<> stroke (origin ~~ (origin .+^ vpr)))
# moveTo (origin .+^ atParam bez t)
where
vpr = r2 (normalized vp ^* r)
</pre></div></div><div class="top"><p class="src"><a name="v:radiusOfCurvature" class="def">radiusOfCurvature</a><a href="src/Diagrams-TwoD-Curvature.html#radiusOfCurvature" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a></td><td class="doc"><p>Segment to measure on.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p>Parameter to measure at.
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p>Result is a <code>PosInf</code> value where <code>PosInfty</code> represents
infinite radius of curvature or zero curvature.
</p></td></tr></table></div><div class="doc"><p>Reciprocal of <code>curvature</code>.
</p></div></div><div class="top"><p class="src"><a name="v:squaredCurvature" class="def">squaredCurvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Diagrams-TwoD-Curvature.html#squaredCurvature" class="link">Source</a></p><div class="doc"><p>With <code>squaredCurvature</code> we can compute values in spaces that do not support
<code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#v:sqrt">sqrt</a></code> and it is just as useful for relative ordering of curvatures or looking
for zeros.
</p></div></div><div class="top"><p class="src"><a name="v:squaredRadiusOfCurvature" class="def">squaredRadiusOfCurvature</a> :: <a href="Diagrams-Segment.html#t:Segment">Segment</a> <a href="Diagrams-Segment.html#t:Closed">Closed</a> <a href="Diagrams-TwoD-Types.html#t:R2">R2</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/libghc-monoid-extras-doc/html/Data-Monoid-Inf.html#t:PosInf">PosInf</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Diagrams-TwoD-Curvature.html#squaredRadiusOfCurvature" class="link">Source</a></p><div class="doc"><p>Reciprocal of <code>squaredCurvature</code>
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|