/// <summary> /// Returns the index of the nearest point in the grid. /// Assumes the point is within the bounds of the grid. /// </summary> /// <param name="point"></param> /// <returns></returns> public int IndexAtUnchecked(Vec3d point) { (int i, int j, int k) = IndicesAt(point); return(GridUtil.FlattenIndices(i, j, k, _nx, _nxy)); }
/// <summary> /// Expands a 1 dimensional index into a 3 dimensional index. /// </summary> /// <param name="index"></param> /// <returns></returns> public (int, int, int) IndicesAt(int index) { return(GridUtil.ExpandIndex(index, _nx, _nxy)); }
/// <summary> /// Flattens a 3 dimensional index into a 1 dimensional index. /// Assumes the given indices are within the valid range. /// </summary> /// <param name="i"></param> /// <param name="j"></param> /// <param name="k"></param> /// <returns></returns> public int IndexAtUnchecked(int i, int j, int k) { return(GridUtil.FlattenIndices(i, j, k, _nx, _nxy)); }
/// <summary> /// Returns the index of the nearest point in the grid. /// </summary> /// <param name="point"></param> /// <returns></returns> public int IndexAt(Vec3d point) { (int i, int j, int k) = IndicesAt(point); return(GridUtil.FlattenIndices(WrapX(i), WrapY(j), WrapZ(k), _nx, _nxy)); }
/// <summary> /// Applies a wrap function to the given index based on the current wrap mode. /// </summary> /// <param name="k"></param> /// <returns></returns> public int WrapZ(int k) { return(GridUtil.Wrap(k, _nz, _wrapModeZ)); }
/// <summary> /// Flattens a 3 dimensional index into a 1 dimensional index. /// </summary> /// <param name="i"></param> /// <param name="j"></param> /// <param name="k"></param> /// <returns></returns> public int IndexAt(int i, int j, int k) { return(GridUtil.FlattenIndices(WrapX(i), WrapY(j), WrapZ(k), _nx, _nxy)); }
/// <summary> /// Applies a wrap function to the given index based on the current wrap mode. /// </summary> /// <param name="i"></param> /// <returns></returns> public int WrapX(int i) { return(GridUtil.Wrap(i, _nx, _wrapModeX)); }
/// <summary> /// Applies a wrap function to the given index based on the current wrap mode. /// </summary> /// <param name="j"></param> /// <returns></returns> public int WrapY(int j) { return(GridUtil.Wrap(j, _ny, _wrapModeY)); }
/// <summary> /// Expands a 1 dimensional index into a 2 dimensional index. /// </summary> /// <param name="index"></param> /// <returns></returns> public (int i, int j) IndicesAt(int index) { return(GridUtil.ExpandIndex(index, _nx)); }
/// <summary> /// Returns the index of the nearest point in the grid. /// Assumes the point is within the bounds of the grid. /// </summary> /// <param name="point"></param> /// <returns></returns> public int IndexAtUnsafe(Vec2d point) { (int i, int j) = IndicesAt(point); return(GridUtil.FlattenIndices(i, j, _nx)); }
/// <summary> /// Returns the index of the nearest point in the grid. /// </summary> /// <param name="point"></param> /// <returns></returns> public int IndexAt(Vec2d point) { (int i, int j) = IndicesAt(point); return(GridUtil.FlattenIndices(WrapX(i), WrapY(j), _nx)); }
/// <summary> /// Flattens a 2 dimensional index into a 1 dimensional index. /// Assumes the given indices are within the valid range. /// </summary> /// <param name="i"></param> /// <param name="j"></param> /// <returns></returns> public int IndexAtUnsafe(int i, int j) { return(GridUtil.FlattenIndices(i, j, _nx)); }
/// <summary> /// Flattens a 2 dimensional index into a 1 dimensional index. /// Applies the current wrap mode to the given indices. /// </summary> /// <param name="i"></param> /// <param name="j"></param> /// <returns></returns> public int IndexAt(int i, int j) { return(GridUtil.FlattenIndices(WrapX(i), WrapY(j), _nx)); }