|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.pathing.PathSynth
public class PathSynth
This class contains machinery to synthesize a list of "CV" polygons and their arcs starting with a boundary polygon and a collection of obstacles in or overlapping with that boundary.
Nested Class Summary | |
---|---|
static class |
PathSynth.HullLine
A line in a convex hull - - just a pair of HullPoints |
static class |
PathSynth.HullPoint
A class that represents points around a convex hull. |
Field Summary | |
---|---|
static float |
epsilon
If a distance squared between a pair of AOVector points is less than epsilon, they are considered the same point. |
protected static float |
insideDistance
|
protected static Logger |
log
|
Constructor Summary | |
---|---|
PathSynth(PathPolygon boundary,
java.util.List<PathPolygon> obstacles)
|
Method Summary | |
---|---|
protected void |
addCornersInRange(java.util.List<AOVector> newCorners,
java.util.List<AOVector> oldCorners,
int firstOldCorner,
int lastOldCorner,
int incr)
Add the corners from the first to the last corner numbers to the newCorners list, wrapping if first is greater than last. |
protected PathPolygon |
breakBoundaryAroundObstacle(PathPolygon boundaryPoly,
PathPolygon obstacle)
Break a boundary polygon into two pieces around a convex obstacle which it wholly contains, changing the corner set of the original boundary polygon, and returning a new polygon. |
protected void |
combineBoundaryAndObstacles_old(PathPolygon boundaryPoly,
java.util.List<PathPolygon> obstacles)
Merge the boundary polygon with those obstacles whose sides intersect the sides of the boundary, and for obstacles that are wholly contained in the boundary, add them one-by-one, splitting the containing boundary polygons into two polygons for each one, so that the boundary polygons do not contain holes. |
protected void |
combineBoundaryAndObstacles(PathPolygon boundaryPoly,
java.util.List<PathPolygon> obstacles)
If there is more than one obstacle, start by computing the convex hull of all the obstacles, yielding a single obstacle. |
java.util.List<PathSynth.HullLine> |
computeConvexHull(java.util.List<PathPolygon> obstacles)
N**3 algorithm to compute the convex hull of a set of polygons. |
protected static java.lang.Float |
computeSlope(AOVector point1,
AOVector point2)
Compute the slope of a pair of points, or return null if the slope would be infinite. |
protected void |
dumpPolygonsAndArcs(java.lang.String description)
|
protected void |
generateConvexPolygons(PathPolygon poly)
Updates the list of polygons, each of which is convex, and portals between the polygons required make the input polygon convex. |
protected static PathSynth.HullPoint |
hullVertex(PathSynth.HullPoint[] points,
AOVector p)
Returns the HullLine containing the point if the point is a vertex of the hull |
static void |
main(java.lang.String[] args)
Calls a set of test cases for the generation of polygons and arcs from a boundary and obstacle. |
protected void |
mergeDoublyIntersectingObstacle(PathPolygon boundary,
PathPolygon obstacle,
java.util.List<PolyIntersection> intersections)
Handle the case of an obstacle which intersects the line segments of the boundary in exactly two places. |
protected static boolean |
onLeft(AOVector point1,
AOVector point2,
java.lang.Float slope,
AOVector p)
Given a point, determine if that point is lying on the left side or right side of the first point of the line. |
protected java.util.List<AOVector> |
pointsInside(PathPolygon boundary,
PathPolygon obstacle)
Return true if all vertices of the obstacle are contained in the boundary; false otherwise. |
protected static PathSynth.HullPoint[] |
sortHullPoints(java.util.List<PathSynth.HullLine> lines)
Produces an array of sorted HullPoint objects such that the points are in order around the perimeter of the hull. |
protected java.util.List<PathPolygon> |
spliceOutIntersections(PathPolygon boundary,
java.util.List<PathPolygon> obstacles)
For obstacles whose sides intersect the sides of the boundary, change the boundary by adding appropriate vertices. |
protected boolean |
whollyContained(PathPolygon boundary,
PathPolygon obstacle)
Returns true if the boundary contains every vertex of the obstacle; false otherwise. |
static int |
wrap(int index,
int size)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float epsilon
protected static float insideDistance
protected static final Logger log
Constructor Detail |
---|
public PathSynth(PathPolygon boundary, java.util.List<PathPolygon> obstacles)
Method Detail |
---|
protected void combineBoundaryAndObstacles(PathPolygon boundaryPoly, java.util.List<PathPolygon> obstacles)
protected void combineBoundaryAndObstacles_old(PathPolygon boundaryPoly, java.util.List<PathPolygon> obstacles)
protected PathPolygon breakBoundaryAroundObstacle(PathPolygon boundaryPoly, PathPolygon obstacle)
protected void addCornersInRange(java.util.List<AOVector> newCorners, java.util.List<AOVector> oldCorners, int firstOldCorner, int lastOldCorner, int incr)
public static int wrap(int index, int size)
protected static java.lang.Float computeSlope(AOVector point1, AOVector point2)
protected static boolean onLeft(AOVector point1, AOVector point2, java.lang.Float slope, AOVector p)
protected static PathSynth.HullPoint hullVertex(PathSynth.HullPoint[] points, AOVector p)
protected static PathSynth.HullPoint[] sortHullPoints(java.util.List<PathSynth.HullLine> lines)
public java.util.List<PathSynth.HullLine> computeConvexHull(java.util.List<PathPolygon> obstacles)
protected java.util.List<PathPolygon> spliceOutIntersections(PathPolygon boundary, java.util.List<PathPolygon> obstacles)
protected boolean whollyContained(PathPolygon boundary, PathPolygon obstacle)
protected void mergeDoublyIntersectingObstacle(PathPolygon boundary, PathPolygon obstacle, java.util.List<PolyIntersection> intersections)
protected java.util.List<AOVector> pointsInside(PathPolygon boundary, PathPolygon obstacle)
protected void generateConvexPolygons(PathPolygon poly)
protected void dumpPolygonsAndArcs(java.lang.String description)
public static void main(java.lang.String[] args)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |