CartoType API
Public Types | Static Public Member Functions
CartoType::Spline Class Reference

#include <cartotype_spline.h>

List of all members.

Public Types

enum  { EStackSize = 32 * 3 + 1 }

Static Public Member Functions

static void SplitQuadratic (TPoint *aStack)
static void SplitCubic (TPoint *aStack)
static void SplitQuadratic (TPointFP *aStack)
static void SplitCubic (TPointFP *aStack)
static CT_IMPORT void EquidistantParabola (const TPoint &aFocus, const TPoint &aLineStart, const TPoint &aLineEnd, TOutlinePoint &aStart, TOutlinePoint &aControl, TOutlinePoint &aEnd)
static CT_IMPORT void ExtendParabola (TOutlinePoint &aStart, TOutlinePoint &aControl, TOutlinePoint &aEnd)
static CT_IMPORT int32 QuadraticCurveLineIntersection (TFixed &aT1, TFixed &aT2, const TPoint &aLineStart, const TPoint &aLineEnd, const TPoint &aStart, const TPoint &aControl, const TPoint &aEnd)
static CT_IMPORT bool PointToT (TFixed &aT, const TPoint &aPoint, const TPoint &aStart, const TPoint &aControl, const TPoint &aEnd)
static CT_IMPORT void TToPoint (TPoint &aPoint, const TFixed &aT, const TPoint &aStart, const TPoint &aControl, const TPoint &aEnd)
static CT_IMPORT void CutQuadraticCurveAt (const TFixed &aT, TPoint &aStart, TPoint &aControl, TPoint &aEnd, bool aKeepStart)

Detailed Description

The Spline class is a wrapper for static functions concerned with Bezier splines.


Member Enumeration Documentation

anonymous enum
Enumerator:
EStackSize 

The size of a stack of points used for calculating a quadratic or cubic Bezier spline by repeated bisection. Cubic splines are defined by 4 points but the first point of the current curve is the last point of the previous one, hence the multiplication by 3. Quadratic splines need only 3 points.


Member Function Documentation

CT_EXPORT void Spline::CutQuadraticCurveAt ( const TFixed aT,
TPoint aStart,
TPoint aControl,
TPoint aEnd,
bool  aKeepStart 
) [static]

Split the quadratic curve at the specified value for t and updates start, control and end point such that they are the curve segment starting or ending at the point implied by t. If aKeepStart is true, this segment corresponds to the 0..t interval, otherwise the segment corresponds to the t..1 interval. Algorithm based on comp.graphics.algorithms FAQ 4.02 simplified for quadratic where f0t = s f00 + t f01 f1t = s f01 + t f11 ftt = s f0t + t f1t Low precision implementation in 64ths for speed.

CT_EXPORT void Spline::EquidistantParabola ( const TPoint aFocus,
const TPoint aLineStart,
const TPoint aLineEnd,
TOutlinePoint aStart,
TOutlinePoint aControl,
TOutlinePoint aEnd 
) [static]

Generate quadratic bezier curve that is a segment of the parabola of points equidistant to a point and a line. The end points of this segment are the intersections of the parabola with the line through the point parallel to the line segment.

CT_EXPORT void Spline::ExtendParabola ( TOutlinePoint aStart,
TOutlinePoint aControl,
TOutlinePoint aEnd 
) [static]

Take a quadratic bezier curve assumed to represent a parabola segment and extend the segment by computing the points at -1 and 2 and recomputing the control point.

CT_EXPORT bool Spline::PointToT ( TFixed aT,
const TPoint aPoint,
const TPoint aStart,
const TPoint aControl,
const TPoint aEnd 
) [static]

Convert point on quadratic curve to a value for t. It is assumed that the point is on or near the curve. This method uses an approximation method where a line perpendicular to the line between start and end point is constructed through the point and this line is intersected with the bezier curve. Return true if the point is on the curve, false otherwise.

CT_EXPORT int32 Spline::QuadraticCurveLineIntersection ( TFixed aT1,
TFixed aT2,
const TPoint aLineStart,
const TPoint aLineEnd,
const TPoint aStart,
const TPoint aControl,
const TPoint aEnd 
) [static]

Compute t's for intersection between quadratic bezier and a line. Return number of solutions. If there is one solution it is returned in aT1. Algorithm: transform coordinates such that the line aligns with the x axis. Then solve the blending function equation y = 0 for t. Values of t between 0 and 1 (both inclusive) are valid solutions.

CT_EXPORT void Spline::TToPoint ( TPoint aPoint,
const TFixed aT,
const TPoint aStart,
const TPoint aControl,
const TPoint aEnd 
) [static]

Convert t value to a point on quadratic curve. Low precision implementation in 64ths for speed.


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