mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
Merged in Mastificate/love (pull request #77)
Fix infinite loop bug with bezier curves
This commit is contained in:
@@ -105,6 +105,9 @@ BezierCurve BezierCurve::getDerivative() const
|
||||
|
||||
const Vector &BezierCurve::getControlPoint(int i) const
|
||||
{
|
||||
if (controlPoints.size() == 0)
|
||||
throw Exception("Curve contains no control points.");
|
||||
|
||||
while (i < 0)
|
||||
i += controlPoints.size();
|
||||
|
||||
@@ -116,6 +119,9 @@ const Vector &BezierCurve::getControlPoint(int i) const
|
||||
|
||||
void BezierCurve::setControlPoint(int i, const Vector &point)
|
||||
{
|
||||
if (controlPoints.size() == 0)
|
||||
throw Exception("Curve contains no control points.");
|
||||
|
||||
while (i < 0)
|
||||
i += controlPoints.size();
|
||||
|
||||
@@ -127,6 +133,9 @@ void BezierCurve::setControlPoint(int i, const Vector &point)
|
||||
|
||||
void BezierCurve::insertControlPoint(const Vector &point, int i)
|
||||
{
|
||||
if (controlPoints.size() == 0)
|
||||
i = 0;
|
||||
|
||||
while (i < 0)
|
||||
i += controlPoints.size();
|
||||
|
||||
@@ -138,6 +147,9 @@ void BezierCurve::insertControlPoint(const Vector &point, int i)
|
||||
|
||||
void BezierCurve::removeControlPoint(int i)
|
||||
{
|
||||
if (controlPoints.size() == 0)
|
||||
throw Exception("No control points to remove.");
|
||||
|
||||
while (i < 0)
|
||||
i += controlPoints.size();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user