Class Bresenham


  • public class Bresenham
    extends Object
    • Constructor Detail

      • Bresenham

        public Bresenham()
    • Method Detail

      • 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 -
        y1 -
        x2 -
        y2 -
      • 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)