Class MarchingSquares
- Namespace
- Alis.Core.Physic.Common.TextureTools
- Assembly
- Alis.dll
The marching squares class
public static class MarchingSquaresInheritance
Inherited Members
Fields
_lookMarch
The look march
private static readonly int[] _lookMarchField Value
- int[]
Methods
DetectSquares(AABB, float, float, sbyte[,], int, bool)
Marching squares over the given domain using the mesh defined via the dimensions (wid,hei) to build a set of polygons such that f(x,y) less than 0, using the given number 'bin' for recursive linear inteprolation along cell boundaries. if 'comb' is true, then the polygons will also be composited into larger possible concave polygons.
public static List<Vertices> DetectSquares(AABB domain, float cellWidth, float cellHeight, sbyte[,] f, int lerpCount, bool combine)Parameters
Returns
Lerp(float, float, float, float)
Lerps the x 0
private static float Lerp(float x0, float x1, float v0, float v1)Parameters
Returns
- float
-
The float
MarchSquare(sbyte[,], sbyte[,], ref GeomPoly, int, int, float, float, float, float, int)
Marches the square using the specified f
private static int MarchSquare(sbyte[,] f, sbyte[,] fs, ref MarchingSquares.GeomPoly poly, int ax, int ay, float x0, float y0, float x1, float y1, int bin)Parameters
fsbyte[,]-
The
fssbyte[,]-
The fs
polyMarchingSquares.GeomPoly-
The poly
axint-
The ax
ayint-
The ay
x0float-
The
y0float-
The
x1float-
The
y1float-
The
binint-
The bin
Returns
- int
-
The key
Square(float)
private static float Square(float x)Parameters
xfloat
Returns
VecCross(Vector2, Vector2)
Vecs the cross using the specified a
private static float VecCross(Vector2 a, Vector2 b)Parameters
Returns
- float
-
The float
VecDsq(Vector2, Vector2)
Vecs the dsq using the specified a
private static float VecDsq(Vector2 a, Vector2 b)Parameters
Returns
- float
-
The float
Xlerp(float, float, float, float, float, sbyte[,], int)
private static float Xlerp(float x0, float x1, float y, float v0, float v1, sbyte[,] f, int c)Parameters
Returns
Ylerp(float, float, float, float, float, sbyte[,], int)
private static float Ylerp(float y0, float y1, float x, float v0, float v1, sbyte[,] f, int c)Parameters
Returns
combLeft(ref GeomPoly, ref GeomPoly)
Combs the left using the specified polya
private static void combLeft(ref MarchingSquares.GeomPoly polya, ref MarchingSquares.GeomPoly polyb)Parameters
polyaMarchingSquares.GeomPoly-
The polya
polybMarchingSquares.GeomPoly-
The polyb