Object TRationalQuadraticBezierCurve

Unit

Declaration

type TRationalQuadraticBezierCurve = object(TObject)

Description

Quasi-standard rational quadratic Bezier curve. It has one control point c with a weight. To transform a rational quadratic Bezier curve with an affin transformation, you only have to transform the three points and leave the weight as it is.

Hierarchy

Overview

Fields

Public c: TPointF;
Public p1: TPointF;
Public p2: TPointF;
Public weight: single;

Methods

Public function ComputeLength(AAcceptedDeviation: single = 0.1): single;
Public function ComputePointAt(t: single): TPointF;
Public function GetBounds: TRectF;
Public function ToPoints(AInfiniteBounds: TRectF; AAcceptedDeviation: single = 0.1; AIncludeFirstPoint: boolean = true): ArrayOfTPointF; overload;
Public function ToPoints(AAcceptedDeviation: single = 0.1; AIncludeFirstPoint: boolean = true): ArrayOfTPointF; overload;
Public procedure Split(out ALeft, ARight: TRationalQuadraticBezierCurve);

Properties

Public property IsInfinite: boolean read GetIsInfinite;

Description

Fields

Public c: TPointF;

Control point

Public p1: TPointF;

Starting point

Public p2: TPointF;

End point

Public weight: single;

Weight of control point. The curve is an arc of:

  • ellipse when weight in ]-1; 1[

  • parabola when weight = 1 (classical quadratic Bezier curve)

  • hyperbola when weight > 1

A negative weight give the complementary curve for its positive counterpart. So when weight <= -1 the curve is discontinuous:

  • infinite branches of parabola when weight = -1

  • infinite branches of hyperbola and symetric hyperbola when weight < -1

Methods

Public function ComputeLength(AAcceptedDeviation: single = 0.1): single;

Compute the length of the curve

Public function ComputePointAt(t: single): TPointF;

Compute a point at the specified time (t in [0; 1]). The curve is defined by:

p = ((1-t)ˆ2 * p1 + 2 * t * (1-t) * weight * c + tˆ2*p2) / (1-t)ˆ2 + 2 * t * (1-t) * weight + tˆ2)

Public function GetBounds: TRectF;

Compute the rectangular bounds of the curve

Public function ToPoints(AInfiniteBounds: TRectF; AAcceptedDeviation: single = 0.1; AIncludeFirstPoint: boolean = true): ArrayOfTPointF; overload;

Computes the points of the curve by providing where the infinite curve can stop.

Public function ToPoints(AAcceptedDeviation: single = 0.1; AIncludeFirstPoint: boolean = true): ArrayOfTPointF; overload;

Computes the points of the curve

Public procedure Split(out ALeft, ARight: TRationalQuadraticBezierCurve);

Split into two curves

Properties

Public property IsInfinite: boolean read GetIsInfinite;

Is the curve infinitely long