uploaded 3 months ago
Math component for ESP-IDF

readme

Math Component

Badge

The math component provides various classes and static functions for commonly used math operations.

Table of Contents

Bezier

The bezier header provides a templated implementation of cubic bezier curves and rational cubic bezier curves. Intended use for these templated functions is on raw floating point values or on the associated Vector2d class.

Fast Math

The Fast Math header provides a set of static functions which implement optimized approximations of the following functions:

  • fast_sqrt
  • fast_ln
  • fast_sin
  • fast_cos

along with some utility functions:

  • square (x^2)
  • cube (x^3)
  • sgn (sign of a number)
  • round (round floating point value to nearest integer value)
  • lerp (linear interpolate between two points)
  • inv_lerp (inverse linear interpolate between two points)
  • piecewise_linear (compute the piecewise linear interpolation between a set of points)

Gaussian

The gaussian class provides an implementation of the gaussian function:

Math

   y(t)= \alpha e^{ -\frac{ (t-\beta)^2 }{ 2\gamma^2 } }

The class allows for dynamically changing the α, β, and γ parameters.

Range Mapper

The RangeMapper provides a class which allows you to map from a configurable input range to a standardized output range of [-1,1].

Vector2d (2 Dimensional Vector)

The Vector2d provides a container for a 2-dimensional vector with associated math operations implemented.

Example

The example showcases some of the math functionality provided by the math component.

Links

Supports all targets

Maintainer

  • William Emfinger <waemfinger@gmail.com>

License: MIT

To add this component to your project, run:

idf.py add-dependency "espp/math^1.0.3"

or download archive

Stats

  • Archive size
    Archive size ~ 22.17 KB
  • Downloaded in total
    Downloaded in total 4.7k times
  • Downloaded this version
    This version: 85 times

Badge

espp/math version: 1.0.3
|