# IpeBezier Class Reference
[Ipe Geometry]

A cubic Bezier spline. More...

List of all members.

## Public Member Functions

- IpeBezier ()
- IpeBezier (const IpeVector &p0, const IpeVector &p1, const IpeVector &p2, const IpeVector &p3)
- IpeVector Point (double t) const
- double Distance (const IpeVector &v, double bound)
- bool Straight (double precision) const
- void Subdivide (IpeBezier &l, IpeBezier &r) const
- void Approximate (double precision, std::vector< IpeVector > &result) const
- IpeRect BBox () const
- bool Intersects (const IpeLine &l, IpeVector &pt) const
- bool Intersects (const IpeSegment &l, IpeVector &pt) const

## Static Public Member Functions

- static IpeBezier QuadBezier (const IpeVector &p0, const IpeVector &p1, const IpeVector &p2)
- static void Spline (int n, const IpeVector *v, std::vector< IpeBezier > &result)
- static void ClosedSpline (int n, const IpeVector *v, std::vector< IpeBezier > &result)

## Public Attributes

- IpeVector iV [4]

## Detailed Description

A cubic Bezier spline.

## Constructor & Destructor Documentation

IpeBezier::IpeBezier | ( |  | ) | `[inline]`

Default constructor, uninitialized curve.

IpeBezier::IpeBezier | ( | const IpeVector & | p0,
|  | const IpeVector & | p1,
|  | const IpeVector & | p2,
|  | const IpeVector & | p3 |
| ) |  |  | `[inline]`

Constructor with four control points.

## Member Function Documentation

IpeVector IpeBezier::Point | ( | double | t | ) | const

Return point on curve with parameter t (from 0.0 to 1.0).

double IpeBezier::Distance | ( | const IpeVector & | v,
|  | double | bound |
| ) |  |  |

Return distance to Bezier spline.

But may just return bound if actual distance is larger.

bool IpeBezier::Straight | ( | double | precision | ) | const

Returns true if the Bezier curve is nearly identical to the line segment iV[0]..iV[3].

void IpeBezier::Subdivide | ( | IpeBezier & | l,
|  | IpeBezier & | r |
| ) |  |  | const

Subdivide this Bezier curve in the middle.

void IpeBezier::Approximate | ( | double | precision,
|  | std::vector< IpeVector > & | result |
| ) |  |  | const

Approximate by a polygonal chain.

result must be empty when calling this.

IpeRect IpeBezier::BBox | ( |  | ) | const

Return a tight bounding box (accurate to within 0.5).

IpeBezier IpeBezier::QuadBezier | ( | const IpeVector & | p0,
|  | const IpeVector & | p1,
|  | const IpeVector & | p2 |
| ) |  |  | `[static]`

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.

void IpeBezier::Spline | ( | int | n,
|  | const IpeVector * | v,
|  | std::vector< IpeBezier > & | result |
| ) |  |  | `[static]`

Convert a uniform cubic B-spline to a series of Bezier splines.

First and last control point are given multiplicity 3. Bezier splines are appended to result.

void IpeBezier::ClosedSpline | ( | int | n,
|  | const IpeVector * | v,
|  | std::vector< IpeBezier > & | result |
| ) |  |  | `[static]`

Convert a closed uniform cubic B-spline to a series of Bezier splines.

Bezier splines are appended to result.

The documentation for this class was generated from the following files:

- ipegeo.h
- ipegeo.cpp