public class Lines extends Object
| Modifier and Type | Method and Description |
|---|---|
static double |
angle(double sx0,
double sy0,
double ex0,
double ey0,
double sx1,
double sy1,
double ex1,
double ey1)
Computes the angle, in radians, between the given lines, as a value
between 0 and 2PI.
|
static double |
angle(Line2D line0,
Line2D line1)
Computes the angle, in radians, between the given lines, as a value
between 0 and 2PI.
|
static double |
angle(Point2D s0,
Point2D e0,
Point2D s1,
Point2D e1)
Computes the angle, in radians, between the given lines, as a value
between 0 and 2PI.
|
static double |
angleToX(double x0,
double y0,
double x1,
double y1)
Computes the angle, in radians, that the line from (x0,y0) to (x1,y1)
has to the x axis
|
static double |
angleToX(Line2D line)
Computes the angle, in radians, that the line
has to the x axis
|
static double |
angleToX(Point2D p0,
Point2D p1)
Computes the angle, in radians, that the line from p0 to p1
has to the x axis
|
static double |
length(Line2D line)
Returns the length of the given line
|
static double |
lengthSquared(Line2D line)
Returns the squared length of the given line
|
static Line2D |
normalize(Line2D lineSrc,
Line2D lineDst)
Normalize the given line to have unit length, by scaling it with its
inverse length about its starting point, and store the result
in the given destination.
|
static Line2D |
rotate(double angleRad,
Line2D lineSrc,
Line2D lineDst)
Rotate the given source line around its starting point, by
the given angle, and stores the result in the given
destination line.
|
static Line2D |
scale(double factor,
Line2D lineSrc,
Line2D lineDst)
Scale the given line with the given factor, about its starting point,
and store the result in the given destination.
|
static Line2D |
scaleToLength(double length,
Line2D lineSrc,
Line2D lineDst)
Scale the given line to have the given length about its starting
point, and store the result in the given destination.
|
static String |
toString(Line2D line)
Creates a simple string representation of the given line
|
static String |
toString(Line2D line,
String format)
Creates a simple string representation of the given line, using
the given format for the coordinates
|
static Line2D |
transform(AffineTransform at,
Line2D lineSrc,
Line2D lineDst)
Transform the given line with the given transform, and store the
result in the given destination.
|
public static double length(Line2D line)
line - The linepublic static double lengthSquared(Line2D line)
line - The linepublic static Line2D transform(AffineTransform at, Line2D lineSrc, Line2D lineDst)
null, then a new line will be created and returnedat - The affine transformlineSrc - The source linelineDst - The destination linepublic static Line2D scale(double factor, Line2D lineSrc, Line2D lineDst)
null, then a new line will be created and returnedfactor - The scaling factorlineSrc - The source linelineDst - The destination linepublic static Line2D normalize(Line2D lineSrc, Line2D lineDst)
null, then a new line will be created and returnedlineSrc - The source linelineDst - The destination linepublic static Line2D scaleToLength(double length, Line2D lineSrc, Line2D lineDst)
null, then a new line will be created
and returnedlength - The lengthlineSrc - The source linelineDst - The destination linepublic static Line2D rotate(double angleRad, Line2D lineSrc, Line2D lineDst)
null,
then a new line will be created and returned.
Lines.transform(AffineTransform.getRotateInstance(angleRad,
lineSrc.getX1(), lineSrc.getY1()), lineSrc, lineDst);
but may be more efficient and convenientangleRad - The rotation anglelineSrc - The source linelineDst - The destination linepublic static double angle(Line2D line0, Line2D line1)
line0 - The first lineline1 - The second linepublic static double angle(Point2D s0, Point2D e0, Point2D s1, Point2D e1)
s0 - The start point of the first linee0 - The end point of the first lines1 - The start point of the second linee1 - The end point of the second linepublic static double angle(double sx0,
double sy0,
double ex0,
double ey0,
double sx1,
double sy1,
double ex1,
double ey1)
sx0 - The x-coordinate of the start point of the first linesy0 - The y-coordinate of the start point of the first lineex0 - The x-coordinate of the end point of the first lineey0 - The y-coordinate of the end point of the first linesx1 - The x-coordinate of the start point of the second linesy1 - The y-coordinate of the start point of the second lineex1 - The x-coordinate of the end point of the second lineey1 - The y-coordinate of the end point of the second linepublic static double angleToX(Line2D line)
line - The linepublic static double angleToX(Point2D p0, Point2D p1)
p0 - The start point of the linep1 - The end point of the linepublic static double angleToX(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 String toString(Line2D line)
line - The lineCopyright © 2017. All rights reserved.