Unit CastleSpaceFillingCurves
Description
Generate spacefilling curves (TSwapScanCurve, THilbertCurve, TPeanoCurve). These are sequences of points that completely fill some 2D space.
Uses
 SysUtils
 CastleVectors
Overview
Classes, Interfaces, Objects and Records
Name  Description 

Class TSpaceFillingCurve 
Base abstract spacefilling curve class. 
Class TPrecalcCurve 
Abstract spacefilling curve class, helping implementing curves that precalculate points at construction. 
Class TSwapScanCurve 
Simple spacefilling curve that goes row by row, swapping direction. 
Class THilbertCurve 
Spacefilling Hilbert curve. 
Class TPeanoCurve 
Spacefilling 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); 
Lowlevel procedures to generate consecutive Peano and Hilbert curve points. See e.g. "Graphic Gems II" (gem I.8) or http://en.wikipedia.org/wiki/Spacefilling_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:

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 casesensitive. Exceptions raised

function AllSFCurveClassesNames: string; 
All nonabstract spacefilling curve names. Separated by commas, in apostrophes. 
Types
TSFCAngle = 0..3; 
Angle for spacefilling 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 spacefilling curves (nonabstract TSpaceFillingCurve descendants). 
Generated by PasDoc 0.16.0.