Unit CastleSpaceFillingCurves

Description

Generate space-filling curves (TSwapScanCurve, THilbertCurve, TPeanoCurve). These are sequences of points that completely fill some 2D space.

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TSpaceFillingCurve Base abstract space-filling curve class.
Class TPrecalcCurve Abstract space-filling curve class, helping implementing curves that precalculate points at construction.
Class TSwapScanCurve Simple space-filling curve that goes row by row, swapping direction.
Class THilbertCurve Space-filling Hilbert curve.
Class TPeanoCurve Space-filling Peano curve.
Class EInvalidSFCurveClassName  

Functions and Procedures

procedure PeanoCurve(InitialOrient: boolean; Angle: TSFCAngle; InitialLevel: Cardinal; Step: TSFCStepFunction; StepData: Pointer);
procedure HilbertCurve(InitialOrient: boolean; Angle: TSFCAngle; InitialLevel: Cardinal; Step: TSFCStepFunction; StepData: Pointer);
function StrToSFCurveClass(const s: string): TSpaceFillingCurveClass;
function AllSFCurveClassesNames: string;

Types

TSFCAngle = 0..3;
TSFCStepFunction = procedure (Angle: TSFCAngle; StepFuncData: Pointer);
TSpaceFillingCurveClass = class of TSpaceFillingCurve;

Constants

AvailableSFCurveClasses: array[0..2]of TSpaceFillingCurveClass= (TSwapScanCurve, THilbertCurve, TPeanoCurve);

Description

Functions and Procedures

procedure PeanoCurve(InitialOrient: boolean; Angle: TSFCAngle; InitialLevel: Cardinal; Step: TSFCStepFunction; StepData: Pointer);

Low-level procedures to generate consecutive Peano and Hilbert curve points. See e.g. "Graphic Gems II" (gem I.8) or http://en.wikipedia.org/wiki/Space-filling_curve for nice description.

Step is a function that goes to a neighbor 2D point, and "marks" it (whatever it means for your usage). If the starting point is "marked" at the beginning, using Peano or Hilbert curve guarantees that you will eventually "mark" the whole 2D space.

Peano curve fills a plane size 3ˆLevel, Hilbert curve fills size 2ˆLevel.

Angle is an initial orientation, determining in which direction the curve will be drawn. If you want to fill the space up and to the left from the initial point (according to conventions that Angle = 0 is right, Angle = 1 is up, and so on (CCW)), then use:

  • InitialOrient = false and Angle = 0 for PeanoCurve.

  • InitialOrient = true and Angle = 0 for HilbertCurve.

procedure HilbertCurve(InitialOrient: boolean; Angle: TSFCAngle; InitialLevel: Cardinal; Step: TSFCStepFunction; StepData: Pointer);
 
function StrToSFCurveClass(const s: string): TSpaceFillingCurveClass;

For curve name (matching some TSpaceFillingCurve.SFCName), return appropriate class. Not case-sensitive.

Exceptions raised
EInvalidSFCurveClassName
For unknown curve names.
function AllSFCurveClassesNames: string;

All non-abstract space-filling curve names. Separated by commas, in apostrophes.

Types

TSFCAngle = 0..3;

Angle for space-filling curves.

Let's say 0 = 0 degrees, 1 = 90 degrees, 2 = 180, 3 = 270, but actually it doesn't matter much — it all a matter of convention here.

TSFCStepFunction = procedure (Angle: TSFCAngle; StepFuncData: Pointer);
 
TSpaceFillingCurveClass = class of TSpaceFillingCurve;
 

Constants

AvailableSFCurveClasses: array[0..2]of TSpaceFillingCurveClass= (TSwapScanCurve, THilbertCurve, TPeanoCurve);

Available space-filling curves (non-abstract TSpaceFillingCurve descendants).


Generated by PasDoc 0.15.0.