Empeld
Empeld plugin documentation.
pluginbase.Helpers.Coords.VectorIterators Class Reference

A class of helpers that iterate through vector-space More...

Static Public Member Functions

static IEnumerable< Vector3iIterateCubeFaces (int x, int y, int z)
 Iterate accross the 6 faces of a cube More...
 
static IEnumerable< Vector3iIterateSpace (int w, int l, int h)
 Iterates the space. More...
 
static IEnumerable< Vector3iIterateSpace (int x, int y, int z, int w, int l, int h)
 Iterates across space w,l,h starting at x,y,z More...
 
static IEnumerable< Vector3iIterateVolume (this Volume vol)
 Enumerates all points in a volume. If volume size=0, then no points More...
 
static IEnumerable< Vector3iInnerIterateSpace (int x, int y, int z, int radius_wl, int radius_h)
 Enumerates through a cubic area starting at the center and moving outward More...
 
static IEnumerable< Vector3iInnerIterateSpace (int w, int l, int h)
 Iterates through a space of a size, starting in the center and moving outward. RADIUS (negatives included) More...
 

Detailed Description

A class of helpers that iterate through vector-space

Member Function Documentation

◆ InnerIterateSpace() [1/2]

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.InnerIterateSpace ( int  x,
int  y,
int  z,
int  radius_wl,
int  radius_h 
)
static

Enumerates through a cubic area starting at the center and moving outward

Returns
The iterate space.
Parameters
xX.
yY.
zZ.
radius_wlWl.
radius_hH.
120  {
121  for (int cZ=-radius_h; cZ <= radius_h; ++cZ)
122  yield return new Vector3i(x,y,z+cZ);
123  for (int sz=1; sz <= radius_wl; ++sz )
124  {
125  for (int cX=-sz; cX<=sz; ++cX)
126  {
127  for (int cY=-sz; cY<=sz; ++cY)
128  {
129 
130  if (System.Math.Abs(cX) == sz || System.Math.Abs(cY) == sz )
131  {
132  for (int cZ=-radius_h; cZ <= radius_h; ++cZ)
133  {
134  yield return new Vector3i(x+cX, y+cY, z+cZ);
135  }
136  }
137 
138  }
139  }
140  }
141  }
static readonly Vector3i
All directions, including diagnols
Definition: Vector3i.cs:111

◆ InnerIterateSpace() [2/2]

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.InnerIterateSpace ( int  w,
int  l,
int  h 
)
static

Iterates through a space of a size, starting in the center and moving outward. RADIUS (negatives included)

Returns
The iterate space.
Parameters
wThe width.
lL.
hThe height.
151  {
152  for (int z = -h; z <= h; z++)
153  yield return new Vector3i(0, 0, z);
154 
155  for (int sz=1; sz<=w || sz<=l; sz++)
156  {
157  for (int xy = -sz; xy < sz; xy++)
158  {
159  for (int z = -h; z <= h; z++)
160  {
161  if (Math.Abs(xy) <= w && sz <= l)
162  {
163  yield return new Vector3i(xy, sz, z); // top
164  yield return new Vector3i(-xy, -sz, z); // bottom
165  }
166 
167  if (sz <= w && Math.Abs(xy) <= l)
168  {
169  yield return new Vector3i(sz, -xy, z); // right
170  yield return new Vector3i(-sz, xy, z); // left
171  }
172  }
173  }
174  }
175  }
static readonly Vector3i
All directions, including diagnols
Definition: Vector3i.cs:111

◆ IterateCubeFaces()

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.IterateCubeFaces ( int  x,
int  y,
int  z 
)
static

Iterate accross the 6 faces of a cube

Returns
The cube faces.
Parameters
xX.
yY.
zZ.
27  {
28  yield return new Vector3i(x-1,y,z);
29  yield return new Vector3i(x+1,y,z);
30  yield return new Vector3i(x,y-1,z);
31  yield return new Vector3i(x,y+1,z);
32  yield return new Vector3i(x,y,z-1);
33  yield return new Vector3i(x,y,z+1);
34  }
static readonly Vector3i
All directions, including diagnols
Definition: Vector3i.cs:111

◆ IterateSpace() [1/2]

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.IterateSpace ( int  w,
int  l,
int  h 
)
static

Iterates the space.

Returns
The space.
Parameters
wW.
lL.
hH.
52  {
53  return IterateSpace(0,0,0,w,l,h);
54  }
static IEnumerable< Vector3i > IterateSpace(int w, int l, int h)
Iterates the space.
Definition: VectorIterators.cs:51

◆ IterateSpace() [2/2]

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.IterateSpace ( int  x,
int  y,
int  z,
int  w,
int  l,
int  h 
)
static

Iterates across space w,l,h starting at x,y,z

Returns
The space.
Parameters
xX.
yY.
zZ.
wW.
lL.
hH.
81  {
82  for (int i=x; i<x+w; ++i)
83  for (int j=y; j<y+l; ++j)
84  for (int k=z; k<z+h; ++k)
85  yield return new Vector3i(i,j,k);
86  }
static readonly Vector3i
All directions, including diagnols
Definition: Vector3i.cs:111

◆ IterateVolume()

static IEnumerable<Vector3i> pluginbase.Helpers.Coords.VectorIterators.IterateVolume ( this Volume  vol)
static

Enumerates all points in a volume. If volume size=0, then no points

Returns
The volume.
Parameters
volVol.
94  {
95  return IterateSpace(vol.Point.X, vol.Point.Y, vol.Point.Z, vol.Size.Width, vol.Size.Length, vol.Size.Height);
96  }
static IEnumerable< Vector3i > IterateSpace(int w, int l, int h)
Iterates the space.
Definition: VectorIterators.cs:51

The documentation for this class was generated from the following file: