Skip to content

Instantly share code, notes, and snippets.

@bradmartin333
Created May 19, 2021 19:59
Show Gist options
  • Save bradmartin333/c9321a265267845392d57203dad87e1c to your computer and use it in GitHub Desktop.
Save bradmartin333/c9321a265267845392d57203dad87e1c to your computer and use it in GitHub Desktop.
let MakeIDs (ax:float, ay:float,
bx:float, by:float,
cx:float, cy:float,
apx:float, apy:float,
bpx:float, bpy:float,
cpx:float, cpy:float,
ox:float, oy:float,
device:bool, nullRegion:bool) : ID[] =
[|
for n in 0. .. cy-1. do
for m in 0. .. cx-1. do
for l in 0. .. by-1. do
for k in 0. .. bx-1. do
let mutable idx = 1
if device then
idx <- int (((ax-1.)*(ay-1.)) + 1.)
for j in 0. .. ay-1. do
for i in 0. .. ax-1. do
if nullRegion then
yield toID(float (i*apx+k*bpx+m*cpx+ox),
float (j*apy+l*bpy+n*cpy+oy),
1, 1, int (cy-n), int (cx-m),
idx, false)
else
yield toID(float (i*apx+k*bpx+m*cpx+ox),
float (j*apy+l*bpy+n*cpy+oy),
int (cy-n), int (cx-m), int (by-l), int (bx-k),
idx, false)
if device then
idx <- idx - 1
|]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment