[−][src]Crate piecewise_linear
This crate provides utilities to manipulate continuous piecewise linear functions.
They are internally represented as a list of (x, y)
pairs, each representing a point of
inflection (or equivalently a limit between two linear pieces). The represented function is
assumed to be linear between each of these points.
Domains
The domain of a function is the range over which it is defined, that is, the range between the smallest x coordinate and the greatest one in the function's definition points.
Most methods will refuse to operate on two (or more) functions that do not have the same
domain. You can use expand_domain()
and shrink_domain()
to adapt domains.
Domains over all real numbers should be possible by using ±inf x values, but this has not been extensively tested.
Numeric types
This crate should support functions using any CoordinateType
(more or less a rust-num Num
),
however it has not been tested with types other than f32
and f64
.
Structs
Coordinate | A lightweight struct used to store coordinates on the 2-dimensional Cartesian plane. |
Line | A line segment made up of exactly two |
LineString | An ordered collection of two or more |
PiecewiseLinearFunction | A continuous piecewise linear function. |
Point | A single point in 2D space. |
PointsOfInflectionIterator | Structure returned by |
SegmentsIterator | Structure returned by |
Enums
ExpandDomainStrategy | Controls how the domain of a function is expanded using |
Traits
CoordinateType | The type of an x or y value of a point/coordinate. |
Functions
points_of_inflection_iter | Returns an iterator over pairs |
sum | Sums the functions together. Returns |