Class TSpaceFillingCurve

Unit

Declaration

type TSpaceFillingCurve = class(TObject)

Description

Base abstract space-filling curve class.

Generates consecutive points by NextPixel, until EndOfPixels = True, filling the 2D space in [0..SizeX-1, 0..SizeY-1]. To process (exactly once) each point of your 2D space, you can use something like

while not SFCurve.EndOfPixels do DoSomethingOnPixel(SFCurve.NextPixel);

We try to make NextPixel and EndOfPixels work instantly fast, preferably making some preprocessing at construction time.

Hierarchy

  • TObject
  • TSpaceFillingCurve

Overview

Methods

Public constructor Create(ASizeX, ASizeY: Cardinal); virtual;
Public function EndOfPixels: boolean; virtual; abstract;
Public function NextPixel: TVector2Cardinal; virtual; abstract;
Public procedure SkipPixels(SkipCount: Cardinal); virtual; abstract;
Public procedure Reset; virtual; abstract;
Public function PixelsDone: Cardinal; virtual; abstract;
Public class function SFCName: string; virtual; abstract;

Properties

Public property SizeX: Cardinal read FSizeX;
Public property SizeY: Cardinal read FSizeY;
Public property PixelsCount: Cardinal read FPixelsCount;

Description

Methods

Public constructor Create(ASizeX, ASizeY: Cardinal); virtual;
 
Public function EndOfPixels: boolean; virtual; abstract;
 
Public function NextPixel: TVector2Cardinal; virtual; abstract;

Get next point. Do not ever call this when EndOfPixels = True.

Public procedure SkipPixels(SkipCount: Cardinal); virtual; abstract;

Skip next SkipCount curve points. Just like you would call NextPixel SkipCount times, ignoring the result. Although may be implemented much faster, so don't worry about calling with large SkipCount values.

Do not ever try to skip beyond the end of points. That is, do not use SkipCount > PixelsCount - PixelsDone. For example, do not use SkipCount > 0 if currently EndOfPixels - True.

Public procedure Reset; virtual; abstract;

Start generating points back from the beginning.

Public function PixelsDone: Cardinal; virtual; abstract;

How many curve points were generated. Number of generated points (by NextPixel or skipped by SkipPixels), since the last Reset or constructor.

Public class function SFCName: string; virtual; abstract;

Nice curve name, like 'swapscan', 'hilbert' or 'peano'.

Properties

Public property SizeX: Cardinal read FSizeX;

Size of the 2D space filled by space-filling curve. It's OK even if they are 0 (then EndOfPixels = True instantly).

Public property SizeY: Cardinal read FSizeY;
 
Public property PixelsCount: Cardinal read FPixelsCount;

Shortcut for SizeX * SizeY.


Generated by PasDoc 0.16.0.