Package me.nabdev.pathfinding.structures
Class PathSegment
java.lang.Object
me.nabdev.pathfinding.structures.PathSegment
Represents one segment of a path.
A segment is either a corner or a straightaway between two corners.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new corner segment.PathSegment
(Vertex v1, Vertex v2) Creates a new straightaway segment. -
Method Summary
-
Field Details
-
points
The points that make up this segment. -
corner
public boolean cornerWhether or not this segment is a corner. If true, it is a corner. If false, it is a straightaway.
-
-
Constructor Details
-
PathSegment
public PathSegment()Creates a new corner segment. -
PathSegment
Creates a new straightaway segment.- Parameters:
v1
- The first vertex in the segment.v2
- The second vertex in the segment.
-
-
Method Details
-
end
Get the last vertex in the segment.- Returns:
- The last vertex in the segment.
-
start
Get the first vertex in the segment.- Returns:
- The first vertex in the segment.
-
add
Add a vertex to the segment.- Parameters:
v
- The vertex to add.
-
get
Get a vertex in the segment.- Parameters:
i
- The index of the vertex to get.- Returns:
- The vertex at the given index.
-
replace
Replace the points in the segment with a new set of points.- Parameters:
newArr
- The new set of points.
-