10000 GitHub - jonasvdd/lttb-cpp: C++ implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

C++ implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm

License

Notifications You must be signed in to change notification settings

jonasvdd/lttb-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Implementation of the Largest Triangle Three Buckets (LTTB) Downsampling Algorithm

This is a straightforward C++ port of the reference implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm described in the paper "Downsampling time series for visual representation" by Sveinn Steinarsson. 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

#include "lttb.hpp"

struct ExamplePoint {
    float x;
    float y;
};

using PointLttb = LargestTriangleThreeBuckets<ExamplePoint, float, &ExamplePoint::x, &ExamplePoint::y>

Then use the static method Downsample in the class. It can be used with iterators

std::vector<ExamplePoint> in = GetYourInputsFromSomewhere();
std::vector<ExamplePoint> out;
PointLttb::Downsample(in.begin(), in.size(), std::back_inserter(out), 50);

...or pointers:

ExamplePoint in[500];
GetYourInputsFromSomewhere(in);
ExamplePoint out[50];
PointLttb::Downsample(in, 500, out, 50);

About

C++ implementation of the Largest Triangle Three Buckets (LTTB) downsampling algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.8%
  • CMake 3.2%
0