Constructor and Description |
---|
Line3D()
Constructs and initializes a Line with coordinates (0, 0, 0) -> (0, 0, 0).
|
Line3D(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Constructs and initializes a Line from the specified coordinates.
|
Line3D(Line3D l)
Constructs and initializes a
Line3D from the specified Line3D object. |
Line3D(Point3D p1,
Point3D p2)
Constructs and initializes a
Line3D from the specified Point3D objects. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a new object of the same class as this object.
|
boolean |
contains(double x,
double y,
double z)
Tests if a specified coordinate is inside the boundary of this
Line3D . |
boolean |
contains(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the interior of this
Line3D entirely contains the specified set of rectangular coordinates. |
boolean |
contains(Point3D p)
Tests if a given
Point3D is inside the boundary of this Line3D . |
boolean |
contains(Rectangle3D r)
Tests if the interior of this
Line3D entirely contains the specified Rectangle3D . |
Rectangle3D |
getBounds()
Returns the bounding box of the
Shape3D . |
Point3D |
getP1()
Returns the start
Point3D of this Line3D . |
Point3D |
getP2()
Returns the end
Point3D of this Line3D . |
Point3D |
getVector()
Returns the vector representing this
Line3D . |
double |
getX1()
Returns the X coordinate of the start point in double precision.
|
double |
getX2()
Returns the X coordinate of the end point in double precision.
|
double |
getY1()
Returns the Y coordinate of the start point in double precision.
|
double |
getY2()
Returns the Y coordinate of the end point in double precision.
|
double |
getZ1()
Returns the Z coordinate of the start point in double precision.
|
double |
getZ2()
Returns the Z coordinate of the end point in double precision.
|
boolean |
intersects(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the interior of the
Shape3D intersects the interior of a specified 3D rectangular area. |
boolean |
intersects(Rectangle3D r)
Tests if the interior of the
Shape3D intersects the
interior of a specified Rectangle3D . |
boolean |
intersectsLine(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Tests if the line segment from
(x1,y1,z1) to (x2,y2,z2) intersects this line segment. |
boolean |
intersectsLine(Line3D l)
Tests if the specified line segment intersects this line segment.
|
static boolean |
linesIntersect(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double x3,
double y3,
double z3,
double x4,
double y4,
double z4)
Tests if the line segment from
(x1,y1,z1) to (x2,y2,z2) intersects the line segment from
(x3,y3,z3) to (x4,y4,z4) . |
double |
ptLineDist(double px,
double py,
double pz)
Returns the distance from a point to this line.
|
static double |
ptLineDist(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the distance from a point to a line.
|
double |
ptLineDist(Point3D pt)
Returns the distance from a
Point3D to this line. |
double |
ptLineDistSq(double px,
double py,
double pz)
Returns the square of the distance from a point to this line.
|
static double |
ptLineDistSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the square of the distance from a point to a line.
|
double |
ptLineDistSq(Point3D pt)
Returns the square of the distance from a specified
Point3D to this line. |
double |
ptSegDist(double px,
double py,
double pz)
Returns the distance from a point to this line segment.
|
static double |
ptSegDist(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the distance from a point to a line segment.
|
double |
ptSegDist(Point3D pt)
Returns the distance from a
Point3D to this line segment. |
double |
ptSegDistSq(double px,
double py,
double pz)
Returns the square of the distance from a point to this line segment.
|
static double |
ptSegDistSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the square of the distance from a point to a line segment.
|
double |
ptSegDistSq(Point3D pt)
Returns the square of the distance from a
Point3D to this line segment. |
void |
setLine(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Sets the location of the end points of this
Line3D to the specified double coordinates. |
void |
setLine(Line3D l)
Sets the location of the end points of this
Line3D to
the same as those end points of the specified Line3D . |
void |
setLine(Point3D p1,
Point3D p2)
Sets the location of the end points of this
Line3D to
the specified Point3D coordinates. |
public Line3D()
public Line3D(double x1, double y1, double z1, double x2, double y2, double z2)
x1
- the X coordinate of the start pointy1
- the Y coordinate of the start pointz1
- the Z coordinate of the start pointx2
- the X coordinate of the end pointy2
- the Y coordinate of the end pointz2
- the Z coordinate of the end pointpublic Line3D(Point3D p1, Point3D p2)
Line3D
from the specified Point3D
objects.p1
- the start Point3D
of this line segmentp2
- the end Point3D
of this line segmentpublic double getX1()
Line3D
object.public double getY1()
Line3D
object.public double getZ1()
Line3D
object.public Point3D getP1()
Point3D
of this Line3D
.Point3D
of this Line3D
.public double getX2()
Line3D
object.public double getY2()
Line3D
object.public double getZ2()
Line3D
object.public Point3D getP2()
Point3D
of this Line3D
.Point3D
of this Line3D
.public Point3D getVector()
Line3D
.Line3D
.public void setLine(double x1, double y1, double z1, double x2, double y2, double z2)
Line3D
to the specified double coordinates.x1
- the X coordinate of the start pointy1
- the Y coordinate of the start pointz1
- the Z coordinate of the start pointx2
- the X coordinate of the end pointy2
- the Y coordinate of the end pointz2
- the Z coordinate of the start pointpublic Rectangle3D getBounds()
Shape3D
Shape3D
.
Note that there is no guarantee that the returned Rectangle3D
is the smallest bounding box that encloses
the Shape3D
, only that the Shape3D
lies entirely within the indicated
Rectangle3D
.public void setLine(Point3D p1, Point3D p2)
Line3D
to
the specified Point3D
coordinates.p1
- the start Point3D
of the line segmentp2
- the end Point3D
of the line segmentpublic void setLine(Line3D l)
Line3D
to
the same as those end points of the specified Line3D
.l
- the specified Line3D
public static boolean linesIntersect(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
(x1,y1,z1)
to (x2,y2,z2)
intersects the line segment from
(x3,y3,z3)
to (x4,y4,z4)
.x1
- the X coordinate of the start point of the first line segmenty1
- the Y coordinate of the start point of the first line segmentz1
- the Z coordinate of the start point of the first line segmentx2
- the X coordinate of the end point of the first line segmenty2
- the Y coordinate of the end point of the first line segmentz2
- the Z coordinate of the end point of the first line segmentx3
- the X coordinate of the start point of the end line segmenty3
- the Y coordinate of the start point of the end line segmentz3
- the Z coordinate of the start point of the end line segmentx4
- the X coordinate of the end point of the end line segmenty4
- the Y coordinate of the end point of the end line segmentz4
- the Z coordinate of the end point of the end line segmenttrue
if the first specified line segment and the second specified line segment intersect
each other; false
otherwise.public boolean intersectsLine(double x1, double y1, double z1, double x2, double y2, double z2)
(x1,y1,z1)
to (x2,y2,z2)
intersects this line segment.x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentfalse
otherwise.public boolean intersectsLine(Line3D l)
l
- the specified Line3D
true
if this line segment and the specified line
segment intersect each other; false
otherwise.public static double ptSegDistSq(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentpx
- the X coordinate of the specified point being measured against the specified line segmentpy
- the Y coordinate of the specified point being measured against the specified line segmentpz
- the Z coordinate of the specified point being measured against the specified line segmentptLineDistSq(double,double,double,double, double, double, double, double, double)
public static double ptSegDist(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified line segmenty1
- the Y coordinate of the start point of the specified line segmentz1
- the Z coordinate of the start point of the specified line segmentx2
- the X coordinate of the end point of the specified line segmenty2
- the Y coordinate of the end point of the specified line segmentz2
- the Z coordinate of the end point of the specified line segmentpx
- the X coordinate of the specified point being measured against the specified line segmentpy
- the Y coordinate of the specified point being measured against the specified line segmentpz
- the Z coordinate of the specified point being measured against the specified line segmentptLineDist(double, double, double, double,double, double, double, double, double)
public double ptSegDistSq(double px, double py, double pz)
px
- the X coordinate of the specified point being measured against this line segmentpy
- the Y coordinate of the specified point being measured against this line segmentpz
- the Z coordinate of the specified point being measured against this line segmentptLineDistSq(double, double,double)
public double ptSegDistSq(Point3D pt)
Point3D
to this line segment.
The distance measured is the distance between the specified point and the closest point between the current
line's end points. If the specified point intersects the line segment in between the end points, this method
returns 0.0.pt
- the specified Point3D
being measured against this line segment.Point3D
to the current
line segment.ptLineDistSq(Point3D)
public double ptSegDist(double px, double py, double pz)
px
- the X coordinate of the specified point being measured against this line segmentpy
- the Y coordinate of the specified point being measured against this line segmentpz
- the Z coordinate of the specified point being measured against this line segmentptLineDist(double, double, double)
public double ptSegDist(Point3D pt)
Point3D
to this line segment.
The distance measured is the distance between the specified point and the closest point between the current
line's end points. If the specified point intersects the line segment in between the end points, this method
returns 0.0.pt
- the specified Point3D
being measured against this line segmentPoint3D
to the current line segment.ptLineDist(Point3D)
public static double ptLineDistSq(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified liney1
- the Y coordinate of the start point of the specified linez1
- the Z coordinate of the start point of the specified linex2
- the X coordinate of the end point of the specified liney2
- the Y coordinate of the end point of the specified linez2
- the Z coordinate of the end point of the specified linepx
- the X coordinate of the specified point being measured against the specified linepy
- the Y coordinate of the specified point being measured against the specified linepz
- the Z coordinate of the specified point being measured against the specified lineptSegDistSq(double, double, double, double,double, double, double, double, double)
public static double ptLineDist(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified liney1
- the Y coordinate of the start point of the specified linez1
- the Z coordinate of the start point of the specified linex2
- the X coordinate of the end point of the specified liney2
- the Y coordinate of the end point of the specified linez2
- the Z coordinate of the end point of the specified linepx
- the X coordinate of the specified point being measured against the specified linepy
- the Y coordinate of the specified point being measured against the specified linepz
- the Z coordinate of the specified point being measured against the specified lineptSegDist(double, double, double, double, double, double, double, double, double)
public double ptLineDistSq(double px, double py, double pz)
Line3D
. If the specified point intersects the line, this
method returns 0.0.px
- the X coordinate of the specified point being measured against the specified linepy
- the Y coordinate of the specified point being measured against the specified linepz
- the Z coordinate of the specified point being measured against the specified lineptSegDistSq(double, double, double)
public double ptLineDistSq(Point3D pt)
Point3D
to this line.
The distance measured is the distance between the specified point and the closest point on the
infinitely-extended line defined by this Line3D
. If the specified point intersects the line, this
method returns 0.0.pt
- the specified Point3D
being measured against this linePoint3D
to the current
line.ptSegDistSq(Point3D)
public double ptLineDist(double px, double py, double pz)
Line3D
. If the specified point intersects the line, this
method returns 0.0.px
- the X coordinate of the specified point being measured against this linepy
- the Y coordinate of the specified point being measured against this linepz
- the Z coordinate of the specified point being measured against this lineptSegDist(double, double, double)
public double ptLineDist(Point3D pt)
Point3D
to this line.
The distance measured is the distance between the specified point and the closest point on the
infinitely-extended line defined by this Line3D
. If the specified point intersects the line, this
method returns 0.0.pt
- the specified Point3D
being measuredPoint3D
to the current line.ptSegDist(Point3D)
public boolean contains(double x, double y, double z)
Line3D
. This method is required to
implement the Shape3D
interface, but in the case of Line3D
objects it always returns
false
since a line contains no area.public boolean contains(Point3D p)
Point3D
is inside the boundary of this Line3D
.
This method is required to implement the Shape3D
interface, but in the case of Line3D
objects it always returns false
since a line contains no area.public boolean contains(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Line3D
entirely contains the specified set of rectangular coordinates.
This method is required to implement the Shape3D
interface, but in the case of Line3D
objects it always returns false since a line contains no area.contains
in interface Shape3D
x
- the X coordinate of the closest-upper-left corner of the specified 3D rectangular areay
- the Y coordinate of the closest-upper-left corner of the specified 3D rectangular areaz
- the Z coordinate of the closest-upper-left corner of the specified 3D rectangular areasizeX
- the width of the specified 3D rectangular areasizeY
- the height of the specified 3D rectangular areasizeZ
- the depth of the specified 3D rectangular areafalse
because a Line3D
contains
no area.public boolean contains(Rectangle3D r)
Line3D
entirely contains the specified Rectangle3D
.
This method is required to implement the Shape3D
interface, but in the case of Line3D
objects it always returns false
since a line contains no area.contains
in interface Shape3D
r
- the specified Rectangle3D
to be testedfalse
because a Line3D
contains no area.Shape3D.contains(double, double, double, double, double, double)
public boolean intersects(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Shape3D
Shape3D
intersects the interior of a specified 3D rectangular area.
The rectangular area is considered to intersect the Shape3D
if any point is contained in both the
interior of the Shape3D
and the specified 3D rectangular area.
The Shape3D.intersects()
method allows a Shape3D
implementation to conservatively return
true
when:
Shape3D
intersect, but
Shapes
this method might return true
even though the 3D rectangular area
does not intersect the Shape3D
.intersects
in interface Shape3D
x
- the X coordinate of the closest-upper-left corner of the specified 3D rectangular areay
- the Y coordinate of the closest-upper-left corner of the specified 3D rectangular areaz
- the Z coordinate of the closest-upper-left corner of the specified 3D rectangular areasizeX
- the width of the specified 3D rectangular areasizeY
- the height of the specified 3D rectangular areasizeZ
- the depth of the specified 3D rectangular areatrue
if the interior of the Shape3D
and the interior of the 3D rectangular area
intersect, or are both highly likely to intersect and intersection calculations would be too expensive to
perform; false
otherwise.public boolean intersects(Rectangle3D r)
Shape3D
Shape3D
intersects the
interior of a specified Rectangle3D
.
The Shape3D.intersects()
method allows a Shape3D
implementation to conservatively return
true
when:
Rectangle3D
and the Shape3D
intersect, but
Shapes
this method might return true
even though the Rectangle3D
does not intersect the Shape3D
.intersects
in interface Shape3D
r
- the specified Rectangle3D
true
if the interior of the Shape3D
and the interior of the specified
Rectangle3D
intersect, or are both highly likely to intersect and intersection calculations
would be too expensive to perform; false
otherwise.Shape3D.intersects(double, double, double, double, double, double)
public java.lang.Object clone()
clone
in class java.lang.Object
java.lang.OutOfMemoryError
- if there is not enough memory.Cloneable