Class Bresenham

java.lang.Object
one.microstream.math.Bresenham

public class Bresenham
extends Object
  • Method Details

    • stepCountDistance

      public static final int stepCountDistance​(int x1, int y1, int x2, int y2)
      Determines the amount of discrete steps from (x1,y1) to (x2,y2), where one step is a change of coordinates in either straight or diagonal direction.

      Examples:
      (0,0) to (2,0) = 2 steps
      (0,0) to (2,2) = 2 steps
      (5,18) to (10,9) = 9 steps

      Parameters:
      x1 - the x coordinate of the first point
      y1 - the y coordinate of the first point
      x2 - the x coordinate of the second point
      y2 - the y coordinate of the second point
      Returns:
      the amount of discrete steps between the two points
    • linePoints

      public static final Point[] linePoints​(int x1, int y1, int x2, int y2)
    • linePointsInt1D

      public static final int[] linePointsInt1D​(int x1, int y1, int x2, int y2)
    • linePointsInt2D

      public static final int[][] linePointsInt2D​(int x1, int y1, int x2, int y2)
    • line

      public static final void line​(int x1, int y1, int x2, int y2, IntCoordinateManipulator manipulator) throws InvalidCoordinateException
      Throws:
      InvalidCoordinateException