Ipelib
|
#include <ipegeo.h>
Public Member Functions | |
Bezier () | |
Bezier (const Vector &p0, const Vector &p1, const Vector &p2, const Vector &p3) | |
Vector | point (double t) const |
Vector | tangent (double t) const |
double | distance (const Vector &v, double bound) |
bool | straight (double precision) const |
void | subdivide (Bezier &l, Bezier &r) const |
void | approximate (double precision, std::vector< Vector > &result) const |
Rect | bbox () const |
bool | snap (const Vector &v, double &t, Vector &pos, double &bound) const |
void | intersect (const Line &l, std::vector< Vector > &result) const |
void | intersect (const Segment &l, std::vector< Vector > &result) const |
void | intersect (const Bezier &b, std::vector< Vector > &result) const |
Static Public Member Functions | |
static Bezier | quadBezier (const Vector &p0, const Vector &p1, const Vector &p2) |
static void | spline (int n, const Vector *v, std::vector< Bezier > &result) |
static void | closedSpline (int n, const Vector *v, std::vector< Bezier > &result) |
Public Attributes | |
Vector | iV [4] |
A cubic Bezier spline.
|
inline |
Default constructor, uninitialized curve.
|
inline |
Constructor with four control points.
Vector Bezier::point | ( | double | t | ) | const |
Return point on curve with parameter t (from 0.0 to 1.0).
Vector Bezier::tangent | ( | double | t | ) | const |
Return tangent direction of curve at parameter t (from 0.0 to 1.0).
The returned vector is not normalized.
double Bezier::distance | ( | const Vector & | v, |
double | bound | ||
) |
bool Bezier::straight | ( | double | precision | ) | const |
Returns true if the Bezier curve is nearly identical to the line segment iV[0]..iV[3].
void Bezier::approximate | ( | double | precision, |
std::vector< Vector > & | result | ||
) | const |
Approximate by a polygonal chain.
result must be empty when calling this.
Rect Bezier::bbox | ( | ) | const |
Return a tight bounding box (accurate to within 0.5).
Find (approximately) nearest point on Bezier spline.
Find point on spline nearest to v, but only if it is closer than bound. If a point is found, sets t to the parameter value and pos to the actual point, and returns true.
Convert a quadratic Bezier-spline to a cubic one.
The quadratic Bezier-spline with control points p0, p1, p2 is identical to the cubic Bezier-spline with control points q0 = p0, q1 = (2p1 + p0)/3, q2 = (2p1 + p2)/3, q3 = p2.
Vector ipe::Bezier::iV[4] |