Copyright  (c) 2013 diagramslib team (see LICENSE) 

License  BSDstyle (see LICENSE) 
Maintainer  diagramsdiscuss@googlegroups.com 
Safe Haskell  None 
Language  Haskell2010 
Compute offsets to segments in two dimensions. More details can be found in the manual at http://projects.haskell.org/diagrams/doc/manual.html#offsetsofsegmentstrailsandpaths.
 offsetSegment :: RealFloat n => n > n > Segment Closed V2 n > Located (Trail V2 n)
 data OffsetOpts d = OffsetOpts {
 _offsetJoin :: LineJoin
 _offsetMiterLimit :: d
 _offsetEpsilon :: d
 offsetJoin :: Lens' (OffsetOpts d) LineJoin
 offsetMiterLimit :: Lens' (OffsetOpts d) d
 offsetEpsilon :: Lens' (OffsetOpts d) d
 offsetTrail :: RealFloat n => n > Located (Trail V2 n) > Located (Trail V2 n)
 offsetTrail' :: RealFloat n => OffsetOpts n > n > Located (Trail V2 n) > Located (Trail V2 n)
 offsetPath :: RealFloat n => n > Path V2 n > Path V2 n
 offsetPath' :: RealFloat n => OffsetOpts n > n > Path V2 n > Path V2 n
 data ExpandOpts d = ExpandOpts {
 _expandJoin :: LineJoin
 _expandMiterLimit :: d
 _expandCap :: LineCap
 _expandEpsilon :: d
 expandJoin :: Lens' (ExpandOpts d) LineJoin
 expandMiterLimit :: Lens' (ExpandOpts d) d
 expandCap :: Lens' (ExpandOpts d) LineCap
 expandEpsilon :: Lens' (ExpandOpts d) d
 expandTrail :: RealFloat n => n > Located (Trail V2 n) > Path V2 n
 expandTrail' :: (OrderedField n, RealFloat n, RealFrac n) => ExpandOpts n > n > Located (Trail V2 n) > Path V2 n
 expandPath :: RealFloat n => n > Path V2 n > Path V2 n
 expandPath' :: RealFloat n => ExpandOpts n > n > Path V2 n > Path V2 n
Offsets
:: RealFloat n  
=> n  Epsilon factor that when multiplied to the absolute value of the radius gives a value that represents the maximum allowed deviation from the true offset. In the current implementation each result segment should be bounded by arcs that are plus or minus epsilon factor from the radius of curvature of the offset. 
> n  Offset from the original segment, positive is on the right of the curve, negative is on the left. 
> Segment Closed V2 n  Original segment 
> Located (Trail V2 n)  Resulting located (at the offset) trail. 
data OffsetOpts d Source #
Compute the offset of a segment. Given a segment compute the offset curve that is a fixed distance from the original curve. For linear segments nothing special happens, the same linear segment is returned with a point that is offset by a perpendicular vector of the given offset length.
Cubic segments require a search for a subdivision of cubic segments that gives an approximation of the offset within the given epsilon factor (the given epsilon factor is applied to the radius giving a concrete epsilon value). We must do this because the offset of a cubic is not a cubic itself (the degree of the curve increases). Cubics do, however, approach constant curvature as we subdivide. In light of this we scale the handles of the offset cubic segment in proportion to the radius of curvature difference between the original subsegment and the offset which will have a radius increased by the offset parameter.
In the following example the blue lines are the original segments and the alternating green and red lines are the resulting offset trail segments.
Note that when the original curve has a cusp, the offset curve forms a radius around the cusp, and when there is a loop in the original curve, there can be two cusps in the offset curve.
Options for specifying line join and segment epsilon for an offset involving multiple segments.
OffsetOpts  

Eq d => Eq (OffsetOpts d) Source #  
Show d => Show (OffsetOpts d) Source #  
Fractional d => Default (OffsetOpts d) Source #  The default offset options use the default 
offsetJoin :: Lens' (OffsetOpts d) LineJoin Source #
Specifies the style of join for between adjacent offset segments.
offsetMiterLimit :: Lens' (OffsetOpts d) d Source #
Specifies the miter limit for the join.
offsetEpsilon :: Lens' (OffsetOpts d) d Source #
Epsilon perimeter for offsetSegment
.
offsetTrail :: RealFloat n => n > Located (Trail V2 n) > Located (Trail V2 n) Source #
Offset a Trail
with the default options and a given radius. See offsetTrail'
.
:: RealFloat n  
=> OffsetOpts n  
> n  Radius of offset. A negative value gives an offset on the left for a line and on the inside for a counterclockwise loop. 
> Located (Trail V2 n)  
> Located (Trail V2 n) 
Offset a Trail
with options and by a given radius. This generates a new
trail that is always radius r
away from the given Trail
(depending on
the line join option) on the right.
The styles applied to an outside corner can be seen here (with the original
trail in blue and the result of offsetTrail'
in green):
When a negative radius is given, the offset trail will be on the left:
When offseting a counterclockwise loop a positive radius gives an outer loop while a negative radius gives an inner loop (both counterclockwise).
offsetPath :: RealFloat n => n > Path V2 n > Path V2 n Source #
Offset a Path
with the default options and given radius. See offsetPath'
.
offsetPath' :: RealFloat n => OffsetOpts n > n > Path V2 n > Path V2 n Source #
Offset a Path
by applying offsetTrail'
to each trail in the path.
Expansions
data ExpandOpts d Source #
Options for specifying how a Trail
should be expanded.
ExpandOpts  

Eq d => Eq (ExpandOpts d) Source #  
Show d => Show (ExpandOpts d) Source #  
Fractional d => Default (ExpandOpts d) Source #  The default 
expandJoin :: Lens' (ExpandOpts d) LineJoin Source #
Specifies the style of join for between adjacent offset segments.
expandMiterLimit :: Lens' (ExpandOpts d) d Source #
Specifies the miter limit for the join.
expandEpsilon :: Lens' (ExpandOpts d) d Source #
Epsilon perimeter for offsetSegment
.
expandTrail :: RealFloat n => n > Located (Trail V2 n) > Path V2 n Source #
Expand a Trail
with the given radius and default options. See expandTrail'
.
:: (OrderedField n, RealFloat n, RealFrac n)  
=> ExpandOpts n  
> n  Radius of offset. Only nonnegative values allowed. For a line this gives a loop of the offset. For a loop this gives two loops, the outer counterclockwise and the inner clockwise. 
> Located (Trail V2 n)  
> Path V2 n 
Expand a Trail
with the given options and radius r
around a given Trail
.
Expanding can be thought of as generating the loop that, when filled, represents
stroking the trail with a radius r
brush.
The cap styles applied to an outside corner can be seen here (with the original
trail in white and the result of expandTrail'
filled in green):
Loops result in a path with an inner and outer loop:
expandPath :: RealFloat n => n > Path V2 n > Path V2 n Source #
Expand a Path
with the given radius and default options. See expandPath'
.
expandPath' :: RealFloat n => ExpandOpts n > n > Path V2 n > Path V2 n Source #
Expand a Path
using expandTrail'
on each trail in the path.