mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +02:00
Clean up love’s internal Vector code a bit, and rename it to Vector2 so it’s more obvious what it is.
--HG-- branch : minor
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* @param controlPoints Control polygon of the curve.
|
||||
**/
|
||||
BezierCurve(const std::vector<Vector> &controlPoints);
|
||||
BezierCurve(const std::vector<Vector2> &controlPoints);
|
||||
|
||||
/**
|
||||
* @returns Degree of the curve
|
||||
@@ -58,14 +58,14 @@ public:
|
||||
/**
|
||||
* @returns i'th control point.
|
||||
**/
|
||||
const Vector &getControlPoint(int i) const;
|
||||
const Vector2 &getControlPoint(int i) const;
|
||||
|
||||
/**
|
||||
* Sets the i'th control point.
|
||||
* @param i Control point to change.
|
||||
* @param point New control point.
|
||||
**/
|
||||
void setControlPoint(int i, const Vector &point);
|
||||
void setControlPoint(int i, const Vector2 &point);
|
||||
|
||||
/**
|
||||
* Insert a new control point before the i'th control point.
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
* @param point Control point to insert.
|
||||
* @param pos Position to insert.
|
||||
**/
|
||||
void insertControlPoint(const Vector &point, int pos = -1);
|
||||
void insertControlPoint(const Vector2 &point, int pos = -1);
|
||||
|
||||
/**
|
||||
* Remove the i'th control point from the curve.
|
||||
@@ -93,27 +93,27 @@ public:
|
||||
* Move the curve.
|
||||
* @param t Translation vector.
|
||||
*/
|
||||
void translate(const Vector &t);
|
||||
void translate(const Vector2 &t);
|
||||
|
||||
/**
|
||||
* Rotate the curve.
|
||||
* @param phi Rotation angle (radians).
|
||||
* @param center Rotation center.
|
||||
*/
|
||||
void rotate(double phi, const Vector ¢er);
|
||||
void rotate(double phi, const Vector2 ¢er);
|
||||
|
||||
/**
|
||||
* Scale the curve.
|
||||
* @param phi Scale factor.
|
||||
* @param center Scale center.
|
||||
*/
|
||||
void scale(double phi, const Vector ¢er);
|
||||
void scale(double phi, const Vector2 ¢er);
|
||||
|
||||
/**
|
||||
* Evaluates the curve at time t.
|
||||
* @param t Curve parameter, must satisfy 0 <= t <= 1.
|
||||
**/
|
||||
Vector evaluate(double t) const;
|
||||
Vector2 evaluate(double t) const;
|
||||
|
||||
/**
|
||||
* Get curve segment starting at t1 and ending at t2.
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
* @param accuracy The 'fineness' of the curve.
|
||||
* @returns A polygon chain that approximates the bezier curve.
|
||||
**/
|
||||
std::vector<Vector> render(int accuracy = 4) const;
|
||||
std::vector<Vector2> render(int accuracy = 4) const;
|
||||
|
||||
/**
|
||||
* Renders a segment of the curve by subdivision.
|
||||
@@ -138,10 +138,10 @@ public:
|
||||
* @param accuracy The 'fineness' of the curve.
|
||||
* @returns A polygon chain that approximates the segment along the curve
|
||||
**/
|
||||
std::vector<Vector> renderSegment(double start, double end, int accuracy = 4) const;
|
||||
std::vector<Vector2> renderSegment(double start, double end, int accuracy = 4) const;
|
||||
|
||||
private:
|
||||
std::vector<Vector> controlPoints;
|
||||
std::vector<Vector2> controlPoints;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user