forked from Violet-CLM/MLLE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayfunctions.cs
More file actions
29 lines (28 loc) · 872 Bytes
/
arrayfunctions.cs
File metadata and controls
29 lines (28 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
static class ArrayFunctions
{
public static void TwoDSlice(ref ushort[][] data, ref ushort[][] results, int xs, int ys, ushort deflt=0)
{
for (int y = 0; y < results.Length; y++)
{
for (int x = 0; x < results[0].Length; x++)
{
results[y][x] = ((ys+y<=data.Length) && (xs+x <= data[0].Length)) ? data[ys + y][xs + x] : deflt;
}
}
}
public static void TwoDPrint(ushort[][] data)
{
for (int i = 0; i < data.Length; i++)
{
foreach (ushort j in data[i])
{
Console.Write(j);
}
Console.WriteLine();
}
}
}