FastLED 3.9.15
Loading...
Searching...
No Matches
xypaths.cpp
Go to the documentation of this file.
1
2
3#include "fl/xypath.h"
4#include "fl/vector.h"
5#include "fl/map_range.h"
6
7
8#include "xypaths.h"
9
10using namespace fl;
11
12namespace {
14 // make a triangle.
17 points.push_back(vec2f(0.0f, 0.0f));
18 points.push_back(vec2f(width / 3, height / 2));
19 points.push_back(vec2f(width - 3, height - 1));
20 points.push_back(vec2f(0.0f, height - 1));
21 points.push_back(vec2f(0.0f, 0.0f));
22 for (auto &p : points) {
23 p.x = map_range<float, float>(p.x, 0.0f, width - 1, -1.0f, 1.0f);
24 p.y = map_range<float, float>(p.y, 0.0f, height - 1, -1.0f, 1.0f);
25 params->addPoint(p);
26 }
27 return params;
28 }
29}
30
31fl::vector<XYPathPtr> CreateXYPaths(int width, int height) {
33 out.push_back(XYPath::NewCirclePath(width, height));
34 out.push_back(XYPath::NewRosePath(width, height));
35 out.push_back(XYPath::NewHeartPath(width, height));
37 out.push_back(XYPath::NewPhyllotaxisPath(width, height));
38 out.push_back(XYPath::NewGielisCurvePath(width, height));
39 out.push_back(XYPath::NewCatmullRomPath(width, height, make_path(width, height)));
40 return out;
41}
fl::vector< XYPathPtr > CreateXYPaths(int width, int height)
Definition xypaths.cpp:31
void push_back(const T &value)
Definition vector.h:552
void push_back(const T &value)
Definition vector.h:1061
static XYPathPtr NewPhyllotaxisPath(u16 width=0, u16 height=0, const fl::shared_ptr< PhyllotaxisParams > &args=fl::make_shared< PhyllotaxisParams >())
Definition xypath.cpp:210
static XYPathPtr NewHeartPath()
Definition xypath.cpp:175
static XYPathPtr NewArchimedeanSpiralPath(u16 width, u16 height)
Definition xypath.cpp:187
static XYPathPtr NewGielisCurvePath(u16 width=0, u16 height=0, const fl::shared_ptr< GielisCurveParams > &params=fl::make_shared< GielisCurveParams >())
Definition xypath.cpp:220
static XYPathPtr NewCatmullRomPath(u16 width=0, u16 height=0, const fl::shared_ptr< CatmullRomParams > &params=fl::make_shared< CatmullRomParams >())
Definition xypath.cpp:230
static XYPathPtr NewRosePath(u16 width=0, u16 height=0, const fl::shared_ptr< RosePathParams > &params=fl::make_shared< RosePathParams >())
Definition xypath.cpp:200
static XYPathPtr NewCirclePath()
Definition xypath.cpp:163
fl::shared_ptr< CatmullRomParams > make_path(int width, int height)
Definition xypaths.cpp:13
InlinedVector< T, INLINED_SIZE > vector_inlined
Definition vector.h:1220
vec2< float > vec2f
Definition geometry.h:333
shared_ptr< T > make_shared(Args &&... args)
Definition shared_ptr.h:348
HeapVector< T, Allocator > vector
Definition vector.h:1214
IMPORTANT!
Definition crgb.h:20