public Coord makeRangeSafe(CoRange _coRa) { Coord retCo = Coord.Max(this, _coRa.start); Coord outerMinus = _coRa.outerLimit() - 1; return(Coord.Min(this, outerMinus)); }
public List <Chunk> chunksInCoRange(CoRange _corange, bool excludeNullChunks) { List <Chunk> retChunks = new List <Chunk> (); if (!chunks.ContainsKey(_corange.start)) { return(retChunks); } Coord start = _corange.start; Coord range = _corange.range; int i = start.x; for (; i < start.x + range.x; ++i) { int j = (int)start.y; for (; j < start.y + range.y; ++j) { int k = start.z; for (; k < start.z + range.z; ++k) { Chunk chh = chunkAt(i, j, k); if (!excludeNullChunks || (chh != null)) { retChunks.Add(chh); } } } } return(retChunks); }
public CoRange makeRangeSafeCoRange(CoRange mapDims) { CoRange retCo = this; retCo.start = Coord.Max(retCo.start, mapDims.start); retCo.range = Coord.Min(retCo.range, mapDims.range); return(retCo); }
public bool isInsideOfRange(CoRange coRange) { Coord outerLimit = coRange.outerLimit(); return((Coord.greaterThanOrEqual(this, coRange.start)) && (Coord.greaterThan(outerLimit, this))); // return this.isInsideOfRange (coRange.start, coRange.range); }
static void drawDebugCube(CoRange chunkCoRange, bool drawBlock) { int length = drawBlock ? 1 : (int)ChunkManager.CHUNKLENGTH; Coord start = chunkCoRange.start * length; if (drawBlock) { drawDebugBlock(start, chunkCoRange.range * length); return; } drawDebugCube(start, chunkCoRange.range * length); }
public static Quad QuadFromCoRange(CoRange coRange) { return(new Quad(PTwo.PTwoXZFromCoord(coRange.start), PTwo.PTwoXZFromCoord(coRange.range))); }
public static void drawDebugLinesForChunkRange(CoRange chunkCoRange) { drawDebugCube(chunkCoRange, false); }
public static void drawDebugLinesForBlockAtWorldCoord(Coord woco) { CoRange blockCo = new CoRange(woco, Coord.coordOne()); drawDebugCube(blockCo, true); }
public List <Chunk> nonNullChunksInCoRange(CoRange _corange) { return(chunksInCoRange(_corange, true)); }
public bool isInsideOfRangeInclusive(CoRange coRange) { Coord outerLimit = coRange.outerLimit(); return((Coord.greaterThanOrEqual(this, coRange.start)) && (Coord.greaterThanOrEqual(outerLimit, this))); }
public static bool Contains(CoRange container, CoRange contained) { bool startIsLess = Coord.greaterThanOrEqual(contained.start, container.start); return(Coord.greaterThan(container.outerLimit(), contained.outerLimit())); }