Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/parkertomatoes/lttb-cpp
C++ implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm
https://github.com/parkertomatoes/lttb-cpp
cpp downsample lttb
Last synced: about 1 month ago
JSON representation
C++ implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm
- Host: GitHub
- URL: https://github.com/parkertomatoes/lttb-cpp
- Owner: parkertomatoes
- License: mit
- Created: 2019-12-05T17:12:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-11T03:01:33.000Z (5 months ago)
- Last Synced: 2024-09-11T08:26:46.644Z (5 months ago)
- Topics: cpp, downsample, lttb
- Language: C++
- Homepage:
- Size: 103 KB
- Stars: 29
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ Implementation of the Largest Triangle Three Buckets (LTTB) Downsampling Algorithm
This is a straightforward C++ port of the [reference implementation](https://github.com/sveinn-steinarsson/flot-downsample) of the Largest Triangle Three Buckets (LTTB) downsampling algorithm described in the paper ["Downsampling time series for visual representation" by Sveinn Steinarsson](http://hdl.handle.net/1946/15343). It is a single header, with a single class template that allows using different structures and data types.
## How To Install
Simply add the ```lttb.hpp``` header to your project. There are no binaries to install, and no dependencies outside the standard library.## How To Use
Create a typedef to specify your time series datapoint type
```c++
#include "lttb.hpp"struct ExamplePoint {
float x;
float y;
};using PointLttb = LargestTriangleThreeBuckets
```Then use the static method ```Downsample``` in the class. It can be used with iterators
```c++
std::vector in = GetYourInputsFromSomewhere();
std::vector out;
PointLttb::Downsample(in.begin(), in.size(), std::back_inserter(out), 50);
```...or pointers:
```c++
ExamplePoint in[500];
GetYourInputsFromSomewhere(in);
ExamplePoint out[50];
PointLttb::Downsample(in, 500, out, 50);
```