FastLED 3.9.15
Loading...
Searching...
No Matches
xypaths.cpp
Go to the documentation of this file.
1
2
3#include "fl/gfx/xypath.h"
4#include "fl/stl/vector.h"
5#include "fl/math/math.h"
6
7
8#include "xypaths.h"
9
10namespace {
12 // make a triangle.
15 points.push_back(fl::vec2f(0.0f, 0.0f));
16 points.push_back(fl::vec2f(width / 3, height / 2));
17 points.push_back(fl::vec2f(width - 3, height - 1));
18 points.push_back(fl::vec2f(0.0f, height - 1));
19 points.push_back(fl::vec2f(0.0f, 0.0f));
20 for (auto &p : points) {
21 p.x = fl::map_range<float, float>(p.x, 0.0f, width - 1, -1.0f, 1.0f);
22 p.y = fl::map_range<float, float>(p.y, 0.0f, height - 1, -1.0f, 1.0f);
23 params->addPoint(p);
24 }
25 return params;
26 }
27}
28
31 out.push_back(fl::XYPath::NewCirclePath(width, height));
32 out.push_back(fl::XYPath::NewRosePath(width, height));
33 out.push_back(fl::XYPath::NewHeartPath(width, height));
35 out.push_back(fl::XYPath::NewPhyllotaxisPath(width, height));
36 out.push_back(fl::XYPath::NewGielisCurvePath(width, height));
37 out.push_back(fl::XYPath::NewCatmullRomPath(width, height, make_path(width, height)));
38 return out;
39}
fl::vector< fl::XYPathPtr > CreateXYPaths(int width, int height)
Definition xypaths.cpp:29
static XYPathPtr NewPhyllotaxisPath(u16 width=0, u16 height=0, const fl::shared_ptr< PhyllotaxisParams > &args=fl::make_shared< PhyllotaxisParams >())
static XYPathPtr NewHeartPath()
static XYPathPtr NewArchimedeanSpiralPath(u16 width, u16 height)
static XYPathPtr NewGielisCurvePath(u16 width=0, u16 height=0, const fl::shared_ptr< GielisCurveParams > &params=fl::make_shared< GielisCurveParams >())
static XYPathPtr NewCatmullRomPath(u16 width=0, u16 height=0, const fl::shared_ptr< CatmullRomParams > &params=fl::make_shared< CatmullRomParams >())
static XYPathPtr NewRosePath(u16 width=0, u16 height=0, const fl::shared_ptr< RosePathParams > &params=fl::make_shared< RosePathParams >())
static XYPathPtr NewCirclePath()
void push_back(const T &value) FL_NOEXCEPT
Definition vector.h:624
fl::shared_ptr< fl::CatmullRomParams > make_path(int width, int height)
Definition xypaths.cpp:11
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
Definition math.h:174
vec2< float > vec2f
Definition geometry.h:333
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414
VectorN< T, INLINED_SIZE > vector_inlined
Definition vector.h:1133