Interface JaxoGrid

All Known Subinterfaces:
JaxoPaintableGrid
All Known Implementing Classes:
JaxoDefaultGrid

public interface JaxoGrid
Grid: A grid "is" a collection of Points in the plane. An arbitrary point can be mapped to its closest point on the grid. This interface only knows about points on the grid, not about painting. In general, the grid is assumed to be infinite in all directions, not restricted to current bounding boxes or canvas size (of course, a specific grid could, e.g., claim that there are no grid points with negative coordinates).
Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines if 'p' is on the grid.
    Closest point to 'p' on the grid.
    void
    Change 'p' to the closest point on the grid.
  • Method Details

    • isSnapped

      boolean isSnapped(Point p)
      Determines if 'p' is on the grid. This is equivalent to p.equals(snappedPoint(p)).
      Parameters:
      p - The point to snap.
      Returns:
      True if p is on the grid.
    • snappedPoint

      Point snappedPoint(Point p)
      Closest point to 'p' on the grid.
      Parameters:
      p - The point to snap.
      Returns:
      The closest grid point.
    • snapPoint

      void snapPoint(Point p)
      Change 'p' to the closest point on the grid.
      Parameters:
      p - The point to snap.