Skip to content

Commit

Permalink
Merge branch 'main' into feature/motorgo-mini
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 authored Apr 23, 2024
2 parents 8aabfa1 + 69590cc commit 1653287
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/math/include/bezier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ namespace espp {
* curves.
* @note Template class which can be used individually on floating point
* values directly or on containers such as Vector2d<float>.
* @tparam T The type of the control points, e.g. float or Vector2d<float>.
* @note The bezier curve is defined by 4 control points, P0, P1, P2, P3.
* The curve is defined by the equation:
* \f$B(t) = (1-t)^3 * P0 + 3 * (1-t)^2 * t * P1 + 3 * (1-t) * t^2 * P2 + t^3 * P3\f$
* where t is the evaluation parameter, [0, 1].
*
* @note The weighted bezier curve is defined by 4 control points, P0, P1, P2, P3
* and 4 weights, W0, W1, W2, W3.
* The curve is defined by the equation:
* \f$B(t) = (W0 * (1-t)^3 * P0 + W1 * 3 * (1-t)^2 * t * P1 + W2 * 3 * (1-t) * t^2 * P2 + W3 *
* t^3 * P3) / (W0 + W1 + W2 + W3)\f$ where t is the evaluation parameter, [0, 1].
*
* \section bezier_ex1 Example
* \snippet math_example.cpp bezier example
*/
template <typename T> class Bezier {
public:
Expand Down
3 changes: 3 additions & 0 deletions components/math/include/gaussian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace espp {
* \f$y(t)=\alpha\exp(-\frac{(t-\beta)^2}{2\gamma^2})\f$.
* @details Alows you to store the alpha, beta, and gamma coefficients as well
* as update them dynamically.
*
* \section gaussian_ex1 Example
* \snippet math_example.cpp gaussian example
*/
class Gaussian {
public:
Expand Down
3 changes: 3 additions & 0 deletions components/math/include/range_mapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ namespace espp {
* The RangeMapper can be optionally configured to invert the output,
* so that after converting from the input range to the output range,
* it will flip the sign on the output.
*
* \section range_mapper_ex1 Example
* \snippet math_example.cpp range_mapper example
*/
template <typename T> class RangeMapper {
public:
Expand Down
3 changes: 3 additions & 0 deletions components/math/include/vector2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace espp {
*
* Provides getters/setters, index operator, and vector / scalar math
* utilities.
*
* \section vector_ex1 Example
* \snippet math_example.cpp vector2d example
*/
template <typename T> class Vector2d {
public:
Expand Down
5 changes: 5 additions & 0 deletions doc/en/math/fast_math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ optimized approximations of the following functions:

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)

.. ---------------------------- API Reference ----------------------------------
Expand Down

0 comments on commit 1653287

Please sign in to comment.