Module nannou::geom::polyline [] [src]

Tools for working with polylines using varying kinds of line joins and caps.

The naming and behaviour for line joins and caps follows the SVG format conventions.

Line Joins

  • miter: Extends the stroke to where the edges on each side bisect. This is the default.
  • round: Rounds the outside edge with a circle the diameter of the thickness.
  • bevel: Cuts the outside edge off where a circle the diameter of the thickness intersects the thickness.

Line Caps

  • butt: Ends the stroke flush with the start or end of the line. This is the default.
  • round: Ends the line with a half circle whose radius is half the line thickness.
  • square: Extends the line on either end by half the thickness.
start                      end
  |                         |
  v                         v

  ---------------------------
  |                         |   butt (default)
  ---------------------------

 /---------------------------\
(                             ) round
 \---------------------------/

-------------------------------
|                             | square
-------------------------------

  ^                         ^
  |                         |
start                      end

Examples

This example is not tested
polyline::miter(points, thickness).triangles();
polyline::round(points, thickness).square().contains(&point);
polyline::benel(points, thickness).round().triangles();

// Calls `miter(points).butt().triangles()`
polyline::triangles(points, thickness); 
// Calls `miter(points).butt().contains(&point)`
polyline::contains(points, thickness, &point); 

Re-exports

pub use self::cap::Cap;
pub use self::join::Join;

Modules

cap
join

Structs

DynamicTriangles

A Triangles iterator yielding triangles from a polyline whose cap and join types may change at runtime.

Parts

Iterator yielding triangles that describe some Polyline.

Polyline

A polyline described by a list of connected points joined by the given join style and ending with the given cap style,

Triangles

Iterator yielding triangles that describe some Polyline.

Enums

Part

A segment of a polyline represented by a sequence of triangles.

Functions

new

Construct a Polyline which can be either triangulated or checked for containing points.

Type Definitions

Dynamic

A Polyline whose cap and join types may change at run-time.