|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.math.Bresenham2
public class Bresenham2
Returns a list of points at integer coordinates for a line on a 2D grid, using the Bresenham algorithm.
Instances of this class own the returned array of points and the points themselves to avoid garbage collection as much as possible. Calling any of the methods will result in the reuse of the previously returned array and vectors, expect
Constructor Summary | |
---|---|
Bresenham2()
|
Method Summary | |
---|---|
Array<GridPoint2> |
line(GridPoint2 start,
GridPoint2 end)
Returns a list of GridPoint2 instances along the given line, at integer coordinates. |
Array<GridPoint2> |
line(int startX,
int startY,
int endX,
int endY)
Returns a list of GridPoint2 instances along the given line, at integer coordinates. |
Array<GridPoint2> |
line(int startX,
int startY,
int endX,
int endY,
Pool<GridPoint2> pool,
Array<GridPoint2> output)
Returns a list of GridPoint2 instances along the given line, at integer coordinates. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bresenham2()
Method Detail |
---|
public Array<GridPoint2> line(GridPoint2 start, GridPoint2 end)
GridPoint2
instances along the given line, at integer coordinates.
start
- the start of the lineend
- the end of the line
public Array<GridPoint2> line(int startX, int startY, int endX, int endY)
GridPoint2
instances along the given line, at integer coordinates.
startX
- the start x coordinate of the linestartY
- the start y coordinate of the lineendX
- the end x coordinate of the lineendY
- the end y coordinate of the line
public Array<GridPoint2> line(int startX, int startY, int endX, int endY, Pool<GridPoint2> pool, Array<GridPoint2> output)
GridPoint2
instances along the given line, at integer coordinates.
startX
- the start x coordinate of the linestartY
- the start y coordinate of the lineendX
- the end x coordinate of the lineendY
- the end y coordinate of the linepool
- the pool from which GridPoint2 instances are fetchedoutput
- the output array, will be cleared in this method
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |