public class Contour extends Object implements Comparable<Contour>, Iterable<Point>
Comparable
interface for sorting contours by length.
It supports iteration over the points along the contour,
e.g., by
Contour C = ...; for (Point p : C) { // process p ... }
Constructor and Description |
---|
Contour(int label)
Creates a new (empty) contour with the given region label.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPoint(Point p) |
int |
compareTo(Contour c2) |
int |
getLabel()
Get the region label associated with this contour.
|
int |
getLength()
Get the length of the contour.
|
Point[] |
getPointArray()
Get the contour points as an array.
|
List<Point> |
getPointList()
Get the list of contour points.
|
Path2D |
getPolygonPath()
Get the polygon for this contour (for subsequent drawing).
|
Path2D |
getPolygonPath(double xOffset,
double yOffset)
Get the polygon for this contour (for subsequent drawing).
|
Iterator<Point> |
iterator() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Contour(int label)
label
- the region label for this contour.public List<Point> getPointList()
public Point[] getPointArray()
public int getLength()
public int getLabel()
public Path2D getPolygonPath()
public Path2D getPolygonPath(double xOffset, double yOffset)
xOffset
- the horizontal offset.yOffset
- the vertical offset.public int compareTo(Contour c2)
compareTo
in interface Comparable<Contour>
Copyright © 2006–2017, Wilhelm Burger, Mark J. Burge (BSD 2-Clause Simplified License)