public class PointList extends Object implements GeometricObject2d, Iterable<Point2d>, Cloneable
GeometricObject2d that is a set of
points in space. Even though the points are backed by a list, the class
itself does not make any assumptions about the order of the points (i.e. to
determine connectedness), however, subclasses might.| Modifier and Type | Field and Description |
|---|---|
List<Point2d> |
points
The points in the
PointList |
| Constructor and Description |
|---|
PointList(Collection<? extends Point2d> points)
Construct a
PointList from points |
PointList(Collection<? extends Point2d> points,
boolean copy)
Construct a
PointList from the points, possibly copying the
points first |
PointList(Point2d... points)
Construct a
PointList from points |
| Modifier and Type | Method and Description |
|---|---|
Point2d |
calculateCentroid()
Get the centre of gravity of the
PointList |
Polygon |
calculateConvexHull()
Calculate the convex hull of the points using the Graham Scan algorithm.
|
Rectangle |
calculateRegularBoundingBox()
Compute the regular (oriented to the axes) bounding box of the
PointList. |
PointList |
clone() |
float |
computeIntrinsicScale()
Calculate the intrinsic scale of the shape.
|
static PointList |
computeMean(Collection<PointList> shapes)
Compute the mean of a set of
PointLists. |
Point2d |
get(int i)
Get the ith point
|
double |
getHeight() |
List<Line2d> |
getLines() |
List<Line2d> |
getLines(PointListConnections conns) |
double |
getWidth() |
Iterator<Point2d> |
iterator() |
double |
maxX() |
double |
maxY() |
double |
minX() |
double |
minY() |
void |
rotate(double angle)
Rotate the
PointList about (0,0) with the given angle (in
radians) |
void |
rotate(Point2d origin,
double angle)
Rotate the
PointList about the given origin with the given angle
(in radians) |
void |
scale(float sc)
Scale the
PointList by the given amount about (0,0). |
void |
scale(Point2d centre,
float sc)
Scale the
PointList by the given amount about the given point. |
void |
scaleCentroid(float sc)
Scale the
PointList about its centre of gravity. |
PointList |
scaleX(float sc)
Scale the
PointList only in the x-direction by the given amount
about (0,0). |
PointList |
scaleXY(float scx,
float scy)
Scale the
PointList by the given amount about (0,0). |
PointList |
scaleY(float sc)
Scale the
PointList only in the y-direction by the given amount
about (0,0). |
int |
size() |
String |
toString() |
PointList |
transform(Jama.Matrix transform)
Apply a 3x3 transform matrix to a copy of the
PointList and
return it |
void |
translate(float x,
float y)
Translate the
PointLists position |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic PointList(Point2d... points)
PointList from pointspoints - the pointspublic PointList(Collection<? extends Point2d> points)
PointList from pointspoints - the pointspublic PointList(Collection<? extends Point2d> points, boolean copy)
PointList from the points, possibly copying the
points firstpoints - the pointscopy - should the points be copiedpublic void rotate(Point2d origin, double angle)
PointList about the given origin with the given angle
(in radians)origin - the origin of the rotationangle - the angle in radianspublic void rotate(double angle)
PointList about (0,0) with the given angle (in
radians)angle - the angle in radianspublic Rectangle calculateRegularBoundingBox()
PointList.calculateRegularBoundingBox in interface GeometricObject2dpublic void translate(float x, float y)
PointLists positiontranslate in interface GeometricObject2dx - x-translationy - y-translationpublic void scale(float sc)
PointList by the given amount about (0,0). Scalefactors
between 0 and 1 shrink the PointList.scale in interface GeometricObject2dsc - the scale factor.public PointList scaleX(float sc)
PointList only in the x-direction by the given amount
about (0,0). Scale factors between 0 and 1 will shrink the
PointListsc - The scale factorPointListpublic PointList scaleY(float sc)
PointList only in the y-direction by the given amount
about (0,0). Scale factors between 0 and 1 will shrink the
PointListsc - The scale factorPointListpublic PointList scaleXY(float scx, float scy)
PointList by the given amount about (0,0). Scale
factors between 0 and 1 shrink the PointList.scx - the scale factor in the x directionscy - the scale factor in the y direction.PointListpublic void scale(Point2d centre, float sc)
PointList by the given amount about the given point.
Scalefactors between 0 and 1 shrink the PointList.scale in interface GeometricObject2dcentre - the centre of the scaling operationsc - the scale factorpublic void scaleCentroid(float sc)
scaleCentroid in interface GeometricObject2dsc - the scale factorpublic Point2d calculateCentroid()
PointListcalculateCentroid in interface GeometricObject2dPointListpublic double minX()
minX in interface GeometricObject2dpublic double minY()
minY in interface GeometricObject2dpublic double maxX()
maxX in interface GeometricObject2dpublic double maxY()
maxY in interface GeometricObject2dpublic double getWidth()
getWidth in interface GeometricObject2dpublic double getHeight()
getHeight in interface GeometricObject2dpublic PointList transform(Jama.Matrix transform)
PointList and
return ittransform in interface GeometricObject2dtransform - 3x3 transform matrixPointListpublic Iterator<Point2d> iterator()
iterator in interface Iterable<Point2d>Iterable.iterator()public static PointList computeMean(Collection<PointList> shapes)
PointLists. It is assumed that the
number of points in the PointLists is equal, and that their is a
one-to-one correspondance between the ith point in each list.shapes - the shapes to averagepublic int size()
public float computeIntrinsicScale()
public Point2d get(int i)
i - the index of the pointpublic List<Line2d> getLines()
Line2d assuming the points in this list are
connected in orderpublic List<Line2d> getLines(PointListConnections conns)
conns - PointListConnections.getLines(PointList) with thispublic Polygon calculateConvexHull()
GrahamScan