cleanup
This commit is contained in:
15
src/bezier.h
15
src/bezier.h
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
// link: https://www.codeproject.com/Articles/25237/Bezier-Curves-Made-Simple
|
||||
|
||||
class BezierCurve
|
||||
{
|
||||
static double FactorialLookup[33];
|
||||
|
||||
public:
|
||||
// just check if n is appropriate, then return the result
|
||||
static double factorial(int n)
|
||||
{
|
||||
// if (n < 0) { throw new Exception("n is less than 0"); }
|
||||
// if (n > 32) { throw new Exception("n is greater than 32"); }
|
||||
return FactorialLookup[n]; /* returns the value n! as a SUMORealing point number */
|
||||
return FactorialLookup[n];
|
||||
}
|
||||
|
||||
static double Ni(int n, int i)
|
||||
@@ -27,10 +27,8 @@ public:
|
||||
static double Bernstein(int n, int i, double t)
|
||||
{
|
||||
double basis;
|
||||
double ti; /* t^i */
|
||||
double tni; /* (1 - t)^i */
|
||||
|
||||
/* Prevent problems with pow */
|
||||
double ti;
|
||||
double tni;
|
||||
|
||||
if (t == 0.0 && i == 0)
|
||||
ti = 1.0;
|
||||
@@ -49,9 +47,6 @@ public:
|
||||
|
||||
static glm::vec2 Bezier2D(const std::vector<glm::vec2>& b, double t)
|
||||
{
|
||||
// if ((1.0 - t) < 5e-6)
|
||||
// t = 1.0;
|
||||
|
||||
double px = 0.0;
|
||||
double py = 0.0;
|
||||
const int npts = (int)b.size();
|
||||
|
||||
Reference in New Issue
Block a user