MarchingSquares Class

Utility class for creating a polygonal representation of an isocurve of a 2D scalar field.
Public Class MarchingSquares 
Inherits WorkUnit
This language is not supported or no code example is available.
public class MarchingSquares : WorkUnit
This language is not supported or no code example is available.
Name Description
Public constructor MarchingSquares(Bitmap, int, int, bool) Centered in world origin constructor.
Public constructor MarchingSquares(Point2D, int, float, int, float, ScalarField2D) Standard constructor.
Public constructor MarchingSquares(int, float, int, float, ScalarField2D) Centered in world origin constructor.
Top
Name Description
Public property ExecutionTime Gets the (last) work execution time in milliseconds. (inherited from WorkUnit).
Public property IsoLevel Gets or sets the desired iso-level value.
Public property Log Gets the list of errors and warnings generated during execution. (inherited from WorkUnit).
Public property ProgressBarText Gets or sets the progress bar text string.
Public property Result Gets the resulting line array.
Public property Status Gets the WorkUnit status. (inherited from WorkUnit).
Top
Methods
 
Name Description
Internal protected (Protected Friend) method Cancelled(BackgroundWorker, DoWorkEventArgs) Checks if the user has requested cancellation of the background operation. (inherited from WorkUnit).
Protected method ComputeCoords(int, int, double[,])
Internal protected (Protected Friend) method DoWork(BackgroundWorker, DoWorkEventArgs) Does the actual work allowing progress bar update and cancellation.
Public method Equals(Object) Determines whether the specified object is equal to the current object. (inherited from Object).
Protected method FillGrid(ScalarField2D)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (inherited from Object).
Public method GetHashCode Serves as the default hash function. (inherited from Object).
Public method GetType Gets the Type of the current instance. (inherited from Object).
Protected method MemberwiseClone Creates a shallow copy of the current Object. (inherited from Object).
Internal protected (Protected Friend) method ResetProgressParallel(int) Resets the progress bar for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method StartContinuousAnimation(string, BackgroundWorker, params string[]) Start the animation for the continuous progress bar. (inherited from WorkUnit).
Internal protected (Protected Friend) method StopContinuousAnimation(BackgroundWorker) Stop the animation for the continuous progress bar. (inherited from WorkUnit).
Public method ToString Returns a string that represents the current object. (inherited from Object).
Internal protected (Protected Friend) method UpdateProgress(double, double, string, BackgroundWorker, bool, params string[]) Updates the progress bar value. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgress(int, int, string, BackgroundWorker, bool, params string[]) Updates the progress bar value. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressAndCheckCancelled(int, int, string, BackgroundWorker, DoWorkEventArgs, bool, params string[]) Updates the progress bar value and checks if the worker thread has been canceled. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressAndCheckCancelledParallel(int, string, BackgroundWorker, DoWorkEventArgs, params string[]) Updates the progress bar value and checks if the worker thread has been canceled, for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressParallel(double, string, BackgroundWorker, params string[]) Updates the progress bar value for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressTo100(string, BackgroundWorker, params string[]) Set the progress bar to 100% and forces screen update. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkCancelled(Environment) Called when the work is cancelled. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkCompleted(Environment) Called when the work has completed. In the case you are modeling something, the environment parameter allows you to easily add the model to the entities collection. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkFailed(Environment) Called when the work has failed. (inherited from WorkUnit).
Top
Events
 
Name Description
Public event ProgressChanged Occurs when the DoWork() is called synchronously and the progress has changed. (inherited from WorkUnit).
Top
Fields
 
Name Description
Internal protected (Protected Friend) field log (inherited from WorkUnit).
Top
Example
 
public void MarchingSquares()
 {
     ScalarField2D func = new ScalarField2D(myScalarField);
     MarchingSquares ms = new MarchingSquares(new Point2D(0, 0), 100, 1, 100, 1, func);
     ms.IsoLevel = 20;
     ms.DoWork();
     Line[] isoCurv = ms.Result;
     Assert.AreEqual(156, isoCurv.Length);
 }
 float myScalarField(float x1, float y1)
 {
     Point2D pt = new Point2D(x1, y1);
     Point2D cen = new Point2D(50, 50);
     return Convert.ToSingle(cen.DistanceTo(pt));
 }					
This language is not supported or no code example is available.
Public Sub MarchingSquares()
     Dim func As ScalarField2D = New ScalarField2D(AddressOf myScalarField)
 
     Dim ms As MarchingSquares = new MarchingSquares(new Point2D(0, 0), 100, 1, 100, 1, func)
     ms.IsoLevel = 20
     ms.DoWork()
     Dim isoCurv As Line() = ms.Result
     Assert.AreEqual(156, isoCurv.Length)
 End Sub
 Private Function myScalarField(ByVal x1 As Single, ByVal y1 As Single) As Single
     Dim pt As Point2D = New Point2D(x1, y1)
     Dim cen As Point2D = New Point2D(50, 50)
     Return Convert.ToSingle(cen.DistanceTo(pt))
 End Function					
This language is not supported or no code example is available.
devDept.Eyeshot.Triangulation.MarchingSquares

.NET Framework

Supported in: 4.8

In this article

Definition