Package one.microstream.math
Class Bresenham
java.lang.Object
one.microstream.math.Bresenham
public class Bresenham extends Object
-
Method Summary
Modifier and Type Method Description static void
line(int x1, int y1, int x2, int y2, IntCoordinateManipulator manipulator)
static Point[]
linePoints(int x1, int y1, int x2, int y2)
static int[]
linePointsInt1D(int x1, int y1, int x2, int y2)
static int[][]
linePointsInt2D(int x1, int y1, int x2, int y2)
static 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.
-
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 pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second point- Returns:
- the amount of discrete steps between the two points
-
linePoints
-
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
-