|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrescuecore.tools.mapgenerator.RescueMapToolkit
A toolkit class with useful methods for manipulating RescueMaps.
| Constructor Summary | |
RescueMapToolkit()
|
|
| Method Summary | |
static double |
angle(RescueMap m,
int n1,
int n2,
int n3)
Gets the angle between two connected sets of nodes. |
static int |
area(int[][] api)
Find the area of a building (in 100ths of sqr meters) from the apexes. |
static int[] |
centre(int[][] api)
Gets the centre of a building from its apexes. |
static void |
findIntersections(RescueMap m)
Finds any overlapping roads and creates a new node at their intersection. |
static boolean |
intersects(int x1,
int y1,
int x2,
int y2,
int[][] api)
Finds if an intersection of a line with a polygon exists. |
static boolean |
isLeft(int x,
int y,
int ax,
int ay,
int bx,
int by)
Whether a point is left of a directed line. |
static int |
makeEntrance(RescueMap rm,
int[] centre)
Splits a road to make a new entrance node. |
static int[] |
nearestPoint(RescueMap m,
int x,
int y,
int n1,
int n2)
Gets the closest point on a road to a given point. |
static void |
randomise(RescueMap m,
int uniformity,
int density,
int movement,
boolean nooneway,
java.util.Random rand)
Shifts some nodes in the map by random distances and removes a number of randomly selected roads. |
static void |
rotate(RescueMap m,
double radians)
Rotate all nodes of a RescueMap. |
static void |
smoothRoads(RescueMap m,
int size)
Rounds the corners of wide roads. |
static int[][][] |
split(int[][] build,
int x1,
int y1,
int x2,
int y2)
Splits a building across a line. |
static long |
tArea(int x1,
int y1,
long m1,
int x2,
int y2,
long m2)
Area of the triangle formed by two vectors. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RescueMapToolkit()
| Method Detail |
public static void randomise(RescueMap m,
int uniformity,
int density,
int movement,
boolean nooneway,
java.util.Random rand)
m - The RescueMap to alter.uniformity - Indicates how likely any given node is to be moved, from 0..100.density - Indicates how likely it is that a road be removed, from 0..100.movement - The maximum distance a node will be moved in meters.nooneway - Whether we are allowed to remove roads in only one direction at a time.rand - The random number generator.
public static void rotate(RescueMap m,
double radians)
m - The RescueMap to rotate.radians - The number of radians to rotate by.public static void findIntersections(RescueMap m)
m - The RescueMap to work on.
public static void smoothRoads(RescueMap m,
int size)
m - The RescueMap to smooth the roads of.size - The minimum size of roads to smooth - given in total lanes for both directions.
public static double angle(RescueMap m,
int n1,
int n2,
int n3)
m - The RescueMap holding the nodes.n1 - The first node.n2 - The connecting (middle) node.n3 - The third node.
public static int[] centre(int[][] api)
api - The apexes of the building.
public static int area(int[][] api)
api - The apexes of the building.
public static long tArea(int x1,
int y1,
long m1,
int x2,
int y2,
long m2)
x1 - x coordinate of the first vector.y1 - y coordinate of the first vector.m1 - The magnitude of the first vector.x2 - x coordinate of the second vector.y2 - y coordinate of the second vector.m2 - The magnitude of the second vector.
public static boolean isLeft(int x,
int y,
int ax,
int ay,
int bx,
int by)
x - The x coordinate of the point.y - The y coordinate of the point.ax - The x coordinate of the first point of the line.ay - The y coordinate of the first point of the line.bx - The x coordinate of the second point of the line.by - The y coordinate of the second point of the line.
public static int[] nearestPoint(RescueMap m,
int x,
int y,
int n1,
int n2)
m - The RescueMap holding the road.x - The x coordinate of the point.y - The y coordinate of the point.n1 - The first node of the road.n2 - The second node of the road.
public static int makeEntrance(RescueMap rm,
int[] centre)
rm - The RescueMap to add the entrance node to.centre - The centre of the building that needs an entrance.
public static int[][][] split(int[][] build,
int x1,
int y1,
int x2,
int y2)
build - The apexes of the building.x1 - The x coordinates of the first point on the line.y1 - The y coordinates of the first point on the line.x2 - The x coordinates of the second point on the line.y2 - The y coordinates of the second point on the line.
public static boolean intersects(int x1,
int y1,
int x2,
int y2,
int[][] api)
x1 - x coordinate of the first point on the line.y1 - y coordinate of the first point on the line.x2 - x coordinate of the second point on the line.y2 - y coordinate of the second point on the line.api - The apexes of the polygon to check.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||