A collection of typespecs to be used in other modules. There are no meaningful functions to be found here.
Summary
Types
define_opts/0, plus the :tension of Curves.define_cardinal/2.
define_opts/0, plus the :alpha of Curves.define_centripetal_catmull_rom/2.
A single number, represented as either x or y in 2D space
Any curve: a Curves.Bezier.Curve, Curves.Spline.Curve or Curves.Polyline.Curve.
All 'define_*' functions can receive the following options
define_opts/0, plus the tilt and angles (in degrees) of Curves.define_ellipse/3.
define_opts/0, plus the three dials of Curves.define_kochanek_bartels/2.
The order of a curve is (the number of control points) - 1. Although a more accurate definition might be "the depth of recursion when interpolating".
A list of {x, y} number coordinates
An {x, y} pair representing a coordinate in 2D space
Float between 0.0 and 1.0, representing a percentage of progress from the first to last point.
Types
@type cardinal_opts() :: [origin: point_tuple(), tension: number()]
define_opts/0, plus the :tension of Curves.define_cardinal/2.
@type centripetal_opts() :: [origin: point_tuple(), alpha: number()]
define_opts/0, plus the :alpha of Curves.define_centripetal_catmull_rom/2.
@type coord() :: number()
A single number, represented as either x or y in 2D space
@type curve_struct() :: Curves.Bezier.Curve.t() | Curves.Spline.Curve.t() | Curves.Polyline.Curve.t()
Any curve: a Curves.Bezier.Curve, Curves.Spline.Curve or Curves.Polyline.Curve.
@type define_opts() :: [{:origin, point_tuple()}]
All 'define_*' functions can receive the following options:
key | default | description |
|---|---|---|
:origin | {0, 0} | Provides an offset. every point in the curve will automatically be increased by this {x, y} coordinate |
@type ellipse_opts() :: [ origin: point_tuple(), rotation: number(), from: number(), to: number() ]
define_opts/0, plus the tilt and angles (in degrees) of Curves.define_ellipse/3.
@type kochanek_bartels_opts() :: [ origin: point_tuple(), tension: number(), continuity: number(), bias: number() ]
define_opts/0, plus the three dials of Curves.define_kochanek_bartels/2.
@type opts() :: keyword()
A keyword list of options. See the Options section of Curves for the keys.
@type order() :: 1 | 2 | 3
The order of a curve is (the number of control points) - 1. Although a more accurate definition might be "the depth of recursion when interpolating".
Linear == 1
Quadratic == 2
Cubic == 3So for example, if you have a straight line (formed from only 2 points) and want to find a new point at 50%, you are interpolating exactly 1 time to do so.
If you have a quadratic, with 3 points, you first interpolate between p0->p1 and p1->p2, thus creating two new dots. Then you recurse, creating a new line from those new dots, and interpolate again.
Cubic curves would recursively interpolate once more.
@type point_list() :: [point_tuple()]
A list of {x, y} number coordinates
An {x, y} pair representing a coordinate in 2D space
@type t() :: float()
Float between 0.0 and 1.0, representing a percentage of progress from the first to last point.