Interface Grid2D

    • Method Summary

      Modifier and Type Method Description
      default int AlongLineIs​(double x1, double y1, double x2, double y2, int[] writeHere)
      returns the set of indicies of squares that the line between (x1,y1) and (x2,y2) touches.
      default int ApplyHood​(int[] hood, int centerX, int centerY, Coords2DAction Action)
      applies the action function to all positions in the neighborhood
      default int ApplyHood​(int[] hood, int centerI, Coords2DAction Action)
      applies the action function to all positions in the neighborhood
      default void ApplyHoodMapped​(int[] hood, int validCount, IndexAction Action)
      applies the action function to all positions in the neighborhood up to validCount, assumes the neighborhood is already mapped
      default void ApplyRectangle​(int startX, int startY, int width, int height, Coords2DAction Action)
      applies the action function to all positions in the rectangle, will use wraparound if appropriate
      default int[] BoundaryIs()
      returns a list of indices, where each index maps to one square on the boundary of the grid
      default boolean ContainsValidI​(int[] hood, int centerX, int centerY, Coords2DBool IsValid)
      returns whether a valid index exists in the neighborhood
      default boolean ContainsValidI​(int[] hood, int centerI, Coords2DBool IsValid)
      returns whether a valid index exists in the neighborhood
      default double DispX​(double x1, double x2)
      gets the displacement from the first coorinate to the second.
      default double DispY​(double y1, double y2)
      gets the displacement from the first coorinate to the second.
      default double Dist​(double x1, double y1, double x2, double y2)
      gets the distance between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned)
      default double DistSquared​(double x1, double y1, double x2, double y2)
      gets the distance squared between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned) more efficient than the Dist function above as it skips a square-root calculation.
      default int GetHoodI​(int[] hood, int centerX, int centerY, int entryIndex)
      gets a specified index from the hood after mapping to the center position
      default int I​(double x, double y)
      gets the index of the square that contains the specified coordinates
      default int I​(int x, int y)
      gets the index of the square at the specified coordinates
      default boolean In​(double x, double y)
      returns whether the specified coordinates are inside the typeGrid bounds
      default boolean In​(int x, int y)
      returns whether the specified coordinates are inside the typeGrid bounds
      default boolean InWrap​(int x, int y)
      returns whether the specified coordinates are inside the Grid bounds with wraparound
      boolean IsWrapX()  
      boolean IsWrapY()  
      default int ItoX​(int i)
      gets the xDim component of the square at the specified index
      default int ItoY​(int i)
      gets the yDim component of the square at the specified index
      int Length()  
      default int MapHood​(int[] hood, int iCenter)
      This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to.
      default int MapHood​(int[] hood, int centerX, int centerY)
      This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to.
      default int MapHood​(int[] hood, int centerX, int centerY, IndexCoords2DBool Eval)
      This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin.
      default int MapHood​(int[] hood, int iCenter, IndexCoords2DBool Eval)
      This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin.
      default int MapI​(int i, Grid2D other)
      returns the index of the center of the square in otherGrid that the coordinate maps to.
      default double MapXpt​(double x, Grid2D other)
      returns the position that x rescales to in the other grid
      default int MapXsq​(int x, Grid2D other)
      returns the index of the center of the square in otherGrid that the coordinate maps to.
      default double MapYpt​(double y, Grid2D other)
      returns the position that y rescales to in the other grid
      default int MapYsq​(int y, Grid2D other)
      returns the index of the center of the square in otherGrid that the coordinate maps to.
      default int RandomHoodI​(int[] hood, int centerX, int centerY, Rand rng)
      gets a random index from the full neighborhood, if the index does not map, returns -1
      default int WrapI​(int x, int y)
      gets the index of the square at the specified coordinates with wrap around
      int Xdim()  
      int Ydim()  
    • Method Detail

      • I

        default int I​(int x,
                      int y)
        gets the index of the square at the specified coordinates
      • WrapI

        default int WrapI​(int x,
                          int y)
        gets the index of the square at the specified coordinates with wrap around
      • ItoX

        default int ItoX​(int i)
        gets the xDim component of the square at the specified index
      • ItoY

        default int ItoY​(int i)
        gets the yDim component of the square at the specified index
      • I

        default int I​(double x,
                      double y)
        gets the index of the square that contains the specified coordinates
      • In

        default boolean In​(int x,
                           int y)
        returns whether the specified coordinates are inside the typeGrid bounds
      • InWrap

        default boolean InWrap​(int x,
                               int y)
        returns whether the specified coordinates are inside the Grid bounds with wraparound
      • In

        default boolean In​(double x,
                           double y)
        returns whether the specified coordinates are inside the typeGrid bounds
      • ApplyRectangle

        default void ApplyRectangle​(int startX,
                                    int startY,
                                    int width,
                                    int height,
                                    Coords2DAction Action)
        applies the action function to all positions in the rectangle, will use wraparound if appropriate
      • ApplyHoodMapped

        default void ApplyHoodMapped​(int[] hood,
                                     int validCount,
                                     IndexAction Action)
        applies the action function to all positions in the neighborhood up to validCount, assumes the neighborhood is already mapped
      • ApplyHood

        default int ApplyHood​(int[] hood,
                              int centerI,
                              Coords2DAction Action)
        applies the action function to all positions in the neighborhood
      • ApplyHood

        default int ApplyHood​(int[] hood,
                              int centerX,
                              int centerY,
                              Coords2DAction Action)
        applies the action function to all positions in the neighborhood
      • MapHood

        default int MapHood​(int[] hood,
                            int iCenter)
        This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to. The function returns the number of valid locations it set. this function differs from HoodToIs and CoordsToIs in that it takes no ret[], MapHood instead puts the result of the mapping back into the hood array.
      • MapHood

        default int MapHood​(int[] hood,
                            int centerX,
                            int centerY,
                            IndexCoords2DBool Eval)
        This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin. this function should take as argument (i,x,y) of a location and return a boolean that decides whether that location should be included as a valid one.
      • MapHood

        default int MapHood​(int[] hood,
                            int iCenter,
                            IndexCoords2DBool Eval)
        This function is very similar to the previous definition of MapHood, only it additionally takes as argument an EvaluationFunctoin. this function should take as argument (i,x,y) of a location and return a boolean that decides whether that location should be included as a valid one.
      • MapHood

        default int MapHood​(int[] hood,
                            int centerX,
                            int centerY)
        This function takes a neighborhood centered around the origin, translates the set of coordinates to be centered around a particular central location, and computes which indices the translated coordinates map to. The function returns the number of valid locations it set. this function differs from HoodToIs and CoordsToIs in that it takes no ret[], MapHood instead puts the result of the mapping back into the hood array.
      • BoundaryIs

        default int[] BoundaryIs()
        returns a list of indices, where each index maps to one square on the boundary of the grid
      • ContainsValidI

        default boolean ContainsValidI​(int[] hood,
                                       int centerI,
                                       Coords2DBool IsValid)
        returns whether a valid index exists in the neighborhood
      • ContainsValidI

        default boolean ContainsValidI​(int[] hood,
                                       int centerX,
                                       int centerY,
                                       Coords2DBool IsValid)
        returns whether a valid index exists in the neighborhood
      • MapXsq

        default int MapXsq​(int x,
                           Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapYsq

        default int MapYsq​(int y,
                           Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapI

        default int MapI​(int i,
                         Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapXpt

        default double MapXpt​(double x,
                              Grid2D other)
        returns the position that x rescales to in the other grid
      • MapYpt

        default double MapYpt​(double y,
                              Grid2D other)
        returns the position that y rescales to in the other grid
      • AlongLineIs

        default int AlongLineIs​(double x1,
                                double y1,
                                double x2,
                                double y2,
                                int[] writeHere)
        returns the set of indicies of squares that the line between (x1,y1) and (x2,y2) touches.
      • RandomHoodI

        default int RandomHoodI​(int[] hood,
                                int centerX,
                                int centerY,
                                Rand rng)
        gets a random index from the full neighborhood, if the index does not map, returns -1
      • GetHoodI

        default int GetHoodI​(int[] hood,
                             int centerX,
                             int centerY,
                             int entryIndex)
        gets a specified index from the hood after mapping to the center position
      • DispX

        default double DispX​(double x1,
                             double x2)
        gets the displacement from the first coorinate to the second. using wraparound if allowed over the given axis to find the shortest displacement.
      • DispY

        default double DispY​(double y1,
                             double y2)
        gets the displacement from the first coorinate to the second. using wraparound if allowed over the given axis to find the shortest displacement.
      • Dist

        default double Dist​(double x1,
                            double y1,
                            double x2,
                            double y2)
        gets the distance between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned)
      • DistSquared

        default double DistSquared​(double x1,
                                   double y1,
                                   double x2,
                                   double y2)
        gets the distance squared between two positions with or without grid wrap around (if wraparound is enabled, the shortest distance taking this into account will be returned) more efficient than the Dist function above as it skips a square-root calculation.
      • Xdim

        int Xdim()
      • Ydim

        int Ydim()
      • Length

        int Length()
      • IsWrapX

        boolean IsWrapX()
      • IsWrapY

        boolean IsWrapY()