Added bezier curves
This commit is contained in:
parent
306d163613
commit
3ebe7d7972
14 changed files with 255 additions and 67 deletions
24
src/helpers/BezierCurve.hpp
Normal file
24
src/helpers/BezierCurve.hpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include <deque>
|
||||
|
||||
// an implementation of a cubic bezier curve
|
||||
// might do better later
|
||||
// TODO: n-point curves
|
||||
class CBezierCurve {
|
||||
public:
|
||||
// sets up the bezier curve.
|
||||
// this EXCLUDES the 0,0 and 1,1 points,
|
||||
void setup(std::vector<Vector2D>* points);
|
||||
|
||||
float getYForT(float t);
|
||||
float getXForT(float t);
|
||||
float getYForPoint(float x);
|
||||
|
||||
private:
|
||||
// this INCLUDES the 0,0 and 1,1 points.
|
||||
std::deque<Vector2D> m_dPoints;
|
||||
|
||||
std::array<float, 100> m_aPointsBaked;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue