public class PoissonDisk extends Object
Modifier and Type | Method and Description |
---|---|
static Coord |
randomUnblockedTile(Coord minPosition,
Coord maxPosition,
char[][] map,
RNG rng,
HashSet<Character> blocked)
Finds a random Coord where the x and y match up to a [x][y] location on map that has any value not in blocking.
|
static ArrayList<Coord> |
sampleCircle(Coord center,
float radius,
float minimumDistance,
int maxX,
int maxY)
Get a list of Coords, each randomly positioned around the given center out to the given radius (measured with
Euclidean distance, so a true circle), but with the given minimum distance from any other Coord in the list.
|
static ArrayList<Coord> |
sampleCircle(Coord center,
float radius,
float minimumDistance,
int maxX,
int maxY,
int pointsPerIteration,
RNG rng)
Get a list of Coords, each randomly positioned around the given center out to the given radius (measured with
Euclidean distance, so a true circle), but with the given minimum distance from any other Coord in the list.
|
static ArrayList<Coord> |
sampleMap(char[][] map,
float minimumDistance,
RNG rng,
Character... blocking) |
static ArrayList<Coord> |
sampleMap(Coord minPosition,
Coord maxPosition,
char[][] map,
float minimumDistance,
RNG rng,
Character... blocking) |
static ArrayList<Coord> |
sampleRectangle(Coord minPosition,
Coord maxPosition,
float minimumDistance,
int maxX,
int maxY)
Get a list of Coords, each randomly positioned within the rectangle between the given minPosition and
maxPosition, but with the given minimum distance from any other Coord in the list.
|
static ArrayList<Coord> |
sampleRectangle(Coord minPosition,
Coord maxPosition,
float minimumDistance,
int maxX,
int maxY,
int pointsPerIteration,
RNG rng)
Get a list of Coords, each randomly positioned within the rectangle between the given minPosition and
maxPosition, but with the given minimum distance from any other Coord in the list.
|
public static ArrayList<Coord> sampleCircle(Coord center, float radius, float minimumDistance, int maxX, int maxY)
center
- the center of the circle to spray Coords intoradius
- the radius of the circle to spray Coords intominimumDistance
- the minimum distance between Coords, in Euclidean distance as a float.maxX
- one more than the highest x that can be assigned; typically an array lengthmaxY
- one more than the highest y that can be assigned; typically an array lengthpublic static ArrayList<Coord> sampleCircle(Coord center, float radius, float minimumDistance, int maxX, int maxY, int pointsPerIteration, RNG rng)
center
- the center of the circle to spray Coords intoradius
- the radius of the circle to spray Coords intominimumDistance
- the minimum distance between Coords, in Euclidean distance as a float.maxX
- one more than the highest x that can be assigned; typically an array lengthmaxY
- one more than the highest y that can be assigned; typically an array lengthpointsPerIteration
- with small radii, this can be around 5; with larger ones, 30 is reasonablerng
- an RNG to use for all random sampling.public static ArrayList<Coord> sampleRectangle(Coord minPosition, Coord maxPosition, float minimumDistance, int maxX, int maxY)
minPosition
- the Coord with the lowest x and lowest y to be used as a corner for the bounding boxmaxPosition
- the Coord with the highest x and highest y to be used as a corner for the bounding boxminimumDistance
- the minimum distance between Coords, in Euclidean distance as a float.maxX
- one more than the highest x that can be assigned; typically an array lengthmaxY
- one more than the highest y that can be assigned; typically an array lengthpublic static ArrayList<Coord> sampleRectangle(Coord minPosition, Coord maxPosition, float minimumDistance, int maxX, int maxY, int pointsPerIteration, RNG rng)
minPosition
- the Coord with the lowest x and lowest y to be used as a corner for the bounding boxmaxPosition
- the Coord with the highest x and highest y to be used as a corner for the bounding boxminimumDistance
- the minimum distance between Coords, in Euclidean distance as a float.maxX
- one more than the highest x that can be assigned; typically an array lengthmaxY
- one more than the highest y that can be assigned; typically an array lengthpointsPerIteration
- with small areas, this can be around 5; with larger ones, 30 is reasonablerng
- an RNG to use for all random sampling.public static ArrayList<Coord> sampleMap(char[][] map, float minimumDistance, RNG rng, Character... blocking)
public static ArrayList<Coord> sampleMap(Coord minPosition, Coord maxPosition, char[][] map, float minimumDistance, RNG rng, Character... blocking)
public static Coord randomUnblockedTile(Coord minPosition, Coord maxPosition, char[][] map, RNG rng, HashSet<Character> blocked)
minPosition
- the Coord with the lowest x and lowest y to be used as a corner for the bounding boxmaxPosition
- the Coord with the highest x and highest y to be used as a corner for the bounding boxmap
- a dungeon map or something, x then yrng
- a RNG to generate random choicesblocked
- a Set of Characters that block a tile from being chosenCopyright © 2012–2016. All rights reserved.