Leiter.Marchingsquares: Types Modinfo Source  

Marching squares algorithm implementation

This module provides an implementation of the marching squares algorithm.
Short info: The marching squares algorithm is an algorithm to plot implicit functions.
Working with this module is kind of straightforward: At first, you must define a line drawing function for the module to use.
This Function has to accept the following parameters: The rendertarget (an Object), the four coordinates of the line (x and y coordinates of
starting- and endpoint) (Integers) and the color of the line (an Integer).
Create an object of TCurvePlotter and feed it with the necessary information:
-The sampling function, the sample's width and height
-Whether or not you want to interpolate
-the threshold (look up how the algorithm works if you want to know what the threshold is)
-the number of cells in horizontal and vertical direction
-the color of the contour which will be plotted

After that, invoke the "Plot"-Method, which will use your line drawing function. For plotting you can also specify a viewport.

Types Summary

TCurvePlotter Curve plotter Type.

Types

Type TCurvePlotter
DescriptionCurve plotter Type.
Methods Summary
__MarchCell Private method. DO NOT TOUCH!
Plot Plot.
SetCellNum Set cell number.
SetColorARGB Set color.
SetInterpolation Set interpolation.
SetLineFnc Line function setter.
SetSampleFnc Set sample function.
SetSampleSize Set sample size.
SetThreshold Set the threshold.
Method __MarchCell(X:Int,Y:Int,CellWidth:Int,CellHeight:Int)
DescriptionPrivate method. DO NOT TOUCH!
Method Plot(Target:Object,Width:Int,Height:Int,VX1:Int=0,VY1:Int=0,VX2:Int=-1,VY2:Int=-1)
DescriptionPlot.
InformationThis function plots to the specified rendertarget.
Method SetCellNum(Size:Int)
DescriptionSet cell number.
InformationUse this to set the number of cells in horizontal and vertical direction.
Method SetColorARGB(ARGB:Int)
DescriptionSet color.
InformationUse this to set the color (as an ARGB integer) of the plotted contour.
Method SetInterpolation(fInterpolate:Int=False)
DescriptionSet interpolation.
InformationSet whether the plotting will be interpolated or not.
Method SetLineFnc(Fnc(Target:Object,X1:Int,Y1:Int,X2:Int,Y2:Int,ARGB:Int))
DescriptionLine function setter.
InformationUse this method to set the used line drawing function to your own.
Method SetSampleFnc(Fnc:Float(X:Int,Y:Int))
DescriptionSet sample function.
InformationUse this to set the function which returns the used data.
Method SetSampleSize(Width:Int,Height:Int)
DescriptionSet sample size.
InformationUse this to set the maximum size of the sample (limits the viewport of plotting)
Method SetThreshold(Threshold:Float=0)
DescriptionSet the threshold.
InformationUse this to set the used threshold.

Module Information

AuthorCalvin 'n-Halbleiter' Bornhofen
Version1.0
LicensePublic Domain
CopyrightCalvin Bornhofen