Algorithm-LineSegments
view release on metacpan or search on metacpan
lib/Algorithm/LineSegments.pm view on Meta::CPAN
return 0 if $segment_count <= 10;
return 1;
},
);
=head1 DESCRIPTION
This module takes discrete data points like time series data and
computes a piecewise linear function, line segments, approximating
them. It does this by merging groups of adjacent points into lines,
always picking the pair that produces the smallest error, until it
is told to stop.
=head2 FUNCTIONS
=over
=item line_segment_points(%options)
Returns a list of [[$x0, $y0], [$x1, $y1]] pairs describing line
segments. Options are
lib/Algorithm/LineSegments.pm view on Meta::CPAN
segments and the cost of the current merge with the expectation
the callback returns a true value if it should perform the merge
and continue, and a false value if it should stop merging and
return. The default is to merge until only three line segments
are left.
=item C<cost>
A callback function that is called with two list references of
points and it should return a number indicating how costly it
is, how much of an error it introduces, if all points are made
into a single line segment. The default projects all data points
to the unit range 0 .. 1 based on the maximum and minimum value
and computes the euclidean distance between the points and the
corresponding points on a line that would cover them all.
=back
=back
=head2 EXPORTS
( run in 0.671 second using v1.01-cache-2.11-cpan-65fba6d93b7 )