public class Points extends Object
| Modifier and Type | Method and Description |
|---|---|
static Point2D |
add(Point2D p0,
Point2D p1,
Point2D result)
Computes the sum the given points and stores the
result in the given result point.
|
static Point2D |
addScaled(Point2D p0,
double factor,
Point2D p1,
Point2D result)
Computes
p0 + factor * p1 and stores the
result in the given result point. |
static Comparator<Point2D> |
byAngleComparator(double centerX,
double centerY)
Creates a comparator that compares points by the angle that the line
between the specified center and the point has to the x-axis.
|
static Comparator<Point2D> |
byAngleComparator(Point2D center)
Creates a comparator that compares points by the angle that the line
between the given center and the point has to the x-axis.
|
static Comparator<Point2D> |
byDistanceComparator(double x,
double y)
Returns a comparator that compares points by their distance to
the specified reference point
|
static Comparator<Point2D> |
byDistanceComparator(Point2D reference)
Returns a comparator that compares points by their distance to
the given reference point
|
static Comparator<Point2D> |
byDistanceToLineComparator(double x0,
double y0,
double x1,
double y1)
Returns a comparator that compares points by their distance to
the specified line
|
static Comparator<Point2D> |
byDistanceToLineComparator(Line2D line)
Returns a comparator that compares points by their distance to
the specified line
|
static Comparator<Point2D> |
byDistanceToLineComparator(Point2D p0,
Point2D p1)
Returns a comparator that compares points by their distance to
the specified line
|
static Comparator<Point2D> |
byDistanceToOriginComparator()
Returns a comparator that compares points by their distance to
the origin
|
static Comparator<Point2D> |
colexicographicalComparator()
Returns a comparator that compares points colexicographically.
|
static Rectangle2D |
computeBounds(Iterable<? extends Point2D> points)
Compute the bounding box of the given points
|
static Point2D |
computeCenterOfGravity(Iterable<? extends Point2D> points)
Computes the center of gravity of the given sequence of points.
|
static Point2D |
interpolate(double x0,
double y0,
double x1,
double y1,
double alpha,
Point2D result)
Interpolates linearly between the specified points, and stores the
result in the given result point.
|
static Point2D |
interpolate(Point2D p0,
Point2D p1,
double alpha,
Point2D result)
Interpolates linearly between the given points, and stores the
result in the given result point.
|
static Point2D |
inverseTransform(AffineTransform at,
Point2D pSrc,
Point2D pDst)
Transforms the given point with the inverse of the given transform,
and stores the result in the given destination point.
|
static Comparator<Point2D> |
lexicographicalComparator()
Returns a comparator that compares points lexicographically.
|
static Point2D |
scale(Point2D p0,
double factor,
Point2D result)
Scales the given point with the given factor and stores the
result in the given result point.
|
static Point2D |
sub(Point2D p0,
Point2D p1,
Point2D result)
Computes the difference between the given points and stores the
result in the given result point.
|
static String |
toString(Point2D point)
Creates a short string representation of the given point
|
static String |
toString(Point2D point,
Locale locale,
String format)
Creates a short string representation of the given point, using
the given format for the coordinates
|
static String |
toString(Point2D point,
String format)
Creates a short string representation of the given point, using
the given format for the coordinates
|
static List<Point2D> |
transform(AffineTransform at,
Iterable<? extends Point2D> points)
Transforms all the given points with the given affine transform,
and returns the results
|
public static Comparator<Point2D> colexicographicalComparator()
public static Comparator<Point2D> lexicographicalComparator()
public static Comparator<Point2D> byAngleComparator(Point2D center)
center - The centerpublic static Comparator<Point2D> byAngleComparator(double centerX, double centerY)
centerX - The x-coordinate of the centercenterY - The y-coordinate of the centerpublic static Comparator<Point2D> byDistanceComparator(double x, double y)
x - The x-coordinate of the reference pointy - The y-coordinate of the reference pointpublic static Comparator<Point2D> byDistanceComparator(Point2D reference)
reference - The reference pointpublic static Comparator<Point2D> byDistanceToOriginComparator()
public static Comparator<Point2D> byDistanceToLineComparator(Line2D line)
line - The linepublic static Comparator<Point2D> byDistanceToLineComparator(Point2D p0, Point2D p1)
p0 - The start point of the linep1 - The end point of the linepublic static Comparator<Point2D> byDistanceToLineComparator(double x0, double y0, double x1, double y1)
x0 - The x-coordinate of the start point of the liney0 - The y-coordinate of the start point of the linex1 - The x-coordinate of the end point of the liney1 - The y-coordinate of the end point of the linepublic static Point2D sub(Point2D p0, Point2D p1, Point2D result)
null, a new point will be created and returned.p0 - The first pointp1 - The second pointresult - The resultpublic static Point2D add(Point2D p0, Point2D p1, Point2D result)
null, a new point will be created and returned.p0 - The first pointp1 - The second pointresult - The resultpublic static Point2D scale(Point2D p0, double factor, Point2D result)
null, a new point will be created and returned.p0 - The pointfactor - The scaling factorresult - The resultpublic static Point2D addScaled(Point2D p0, double factor, Point2D p1, Point2D result)
p0 + factor * p1 and stores the
result in the given result point. If the given result point
is null, a new point will be created and returned.p0 - The first pointfactor - The scaling factor for the second pointp1 - The second pointresult - The resultpublic static Point2D interpolate(Point2D p0, Point2D p1, double alpha, Point2D result)
null, a new point will be created and returned.p0 - The first pointp1 - The second pointalpha - The position between the points (usually between 0 and 1)result - The resultpublic static Point2D interpolate(double x0, double y0, double x1, double y1, double alpha, Point2D result)
null, a new point will be created and returned.x0 - The x-coordinate of the first pointy0 - The y-coordinate of the first pointx1 - The x-coordinate of the second pointy1 - The y-coordinate of the second pointalpha - The position between the points (usually between 0 and 1)result - The resultpublic static Point2D inverseTransform(AffineTransform at, Point2D pSrc, Point2D pDst)
null, a new point will be created
and returned.at - The affine transformpSrc - The source pointpDst - The destination pointIllegalArgumentException - If the given transform is not
invertiblepublic static List<Point2D> transform(AffineTransform at, Iterable<? extends Point2D> points)
at - The affine transformpoints - The input pointspublic static Rectangle2D computeBounds(Iterable<? extends Point2D> points)
points - The input pointspublic static Point2D computeCenterOfGravity(Iterable<? extends Point2D> points)
null is returned.points - The pointspublic static String toString(Point2D point)
point - The pointpublic static String toString(Point2D point, String format)
point - The pointformat - The formatCopyright © 2017. All rights reserved.