public Fixed GetYFromCellSafe(Fixed x, Fixed z) { if (x.IsNegativeOrZero() || z.IsNegativeOrZero() || x > gridXDimensionMax || z > gridZDimensionMax) { return(OUT_OF_GRID_Y_VALUE); } int cellX = (int)(x / cellSize); int cellZ = (int)(z / cellSize); return(cells [cellZ, cellX].GetYOf(x, z)); }
private void CheckCellDimensionsException(Fixed width, Fixed height) { if (width.IsNegativeOrZero()) { throw new System.ArgumentOutOfRangeException("cell width <= 0"); } if (height.IsNegativeOrZero()) { throw new System.ArgumentOutOfRangeException("cell height <= 0"); } }
public FixedGridXZ3D(int gWidth, int gHeight, Fixed cSize) { if (gHeight <= 0 || gWidth <= 0 || cSize.IsNegativeOrZero()) { throw new System.ArgumentOutOfRangeException("gHeight <= 0 || gWidth <= 0 || cSize.IsNegativeOrZero ()"); } this.cellSize = cSize; this.width = gWidth; this.height = gHeight; this.gridXDimensionMax = cSize * gWidth; this.gridZDimensionMax = cSize * gHeight; this.CreateIndexedVerticesList(); this.CreateCells(); }