ExLTTB v0.2.0 ExLTTB.SampleUtils View Source
Utility functions to perform common operations on generic samples
Link to this section Summary
Functions
Returns the average sample of a list of sample
Returns the area of the triangle defined by s1
, s2
and s3
Link to this section Functions
Returns the average sample of a list of sample.
Arguments
samples
: a list of samples. These can have any representation provided that access functions are provided (see Options)opts
: a keyword list of options
Options
sample_to_x_fun
: a function that takes as argument a sample and returns its x coordinate. Defaults tosample[:x]
sample_to_y_fun
: a function that takes as argument a sample and returns its y coordinate. Defaults tosample[:y]
xy_to_sample_fun
: a function that takes as argumentx
andy
and returns a sample with these coordinates. Defaults to%{x: x, y: y}
Returns the area of the triangle defined by s1
, s2
and s3
.
Arguments
s1
,s2
,s3
: the vertices of the triangle. These can have any representation provided that access functions are provided (see Options)opts
: a keyword list of options
Options
sample_to_x_fun
: a function that takes as argument a sample and returns its x coordinate. Defaults tosample[:x]
sample_to_y_fun
: a function that takes as argument a sample and returns its y coordinate. Defaults tosample[:y]
xy_to_sample_fun
: a function that takes as argumentx
andy
and returns a sample with these coordinates. Defaults to%{x: x, y: y}