Package com.treemap.swing.voronoi
Class Path
java.lang.Object
com.treemap.swing.voronoi.Path
Combines a sequence of directions into a path that is rooted at some point in
the plane. No restrictions are placed on paths; they may be zero length,
open/closed, self-intersecting. Path objects are immutable.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Path
Convenience constructor that converts the supplied direction list into an array which is then passed to another constructor.- Parameters:
startX
- the x coordinate of the path's origin in the planestartY
- the y coordinate of the path's origin in the planedirections
- a list of the directions in the path
-
-
Method Details
-
getDirections
- Returns:
- an immutable list of the directions that compose this path, never null
-
getOriginX
public int getOriginX()- Returns:
- the x coordinate in the plane at which the path begins
-
getOriginY
public int getOriginY()- Returns:
- the y coordinate in the plane at which the path begins
-
getTerminalX
public int getTerminalX()- Returns:
- the x coordinate in the plane at which the path ends
-
getTerminalY
public int getTerminalY()- Returns:
- the y coordinate in the plane at which the path ends
-
getLength
public double getLength()- Returns:
- the length of the path using the standard euclidean metric
-
isClosed
public boolean isClosed()- Returns:
- true if and only if the path's point of origin is the same as that of its point of termination
-
translate
Creates a new path by translating this path in the plane.- Parameters:
deltaX
- the change in the path's x coordinatedeltaY
- the change in the path's y coordinate- Returns:
- a new path whose origin has been translated
-
equals
Two paths are equal if they have the same origin and the same directions. -
hashCode
public int hashCode() -
toString
-