public class Polyline3D extends java.lang.Object implements Shape3D, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
int |
npoints
The total number of points.
|
double[] |
xpoints
The array of x coordinates.
|
double[] |
ypoints
The array of y coordinates.
|
double[] |
zpoints
The array of z coordinates.
|
| Constructor and Description |
|---|
Polyline3D()
Creates an empty Polyline3D.
|
Polyline3D(double[] xpoints,
double[] ypoints,
double[] zpoints,
int npoints)
Constructs and initializes a
Polyline3D from the specified parameters. |
Polyline3D(int[] xpoints,
int[] ypoints,
int[] zpoints,
int npoints)
Constructs and initializes a
Polyline3D from the specified parameters. |
Polyline3D(Line3D line) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPoint(double x,
double y,
double z)
Appends the specified coordinates to this
Polyline3D. |
void |
addPoint(Point3D p)
Appends the specified coordinates to this
Polyline3D. |
void |
calculateLines() |
java.lang.Object |
clone() |
boolean |
contains(double x,
double y,
double z)
Tests if the specified 3D coordinates are inside the boundary of the
Shape3D. |
boolean |
contains(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the interior of the
Shape3D entirely contains the specified 3D rectangular area. |
boolean |
contains(Point3D p)
Tests if a specified
Point3D is inside the boundary
of the Shape3D. |
boolean |
contains(Rectangle3D r)
Tests if the interior of the
Shape3D entirely contains the specified Rectangle3D. |
Rectangle3D |
getBounds()
Returns the bounding box of the
Shape3D. |
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. |
void |
reset()
Resets this
Polyline3D object to an empty polygon. |
public int npoints
npoints represents the number of points in this
Polyline3D.public double[] xpoints
npoints is equal to the
number of points in this Polyline3D.public double[] ypoints
npoints is equal to the
number of points in this Polyline3D.public Polyline3D()
public Polyline3D(double[] xpoints, double[] ypoints, double[] zpoints, int npoints)
Polyline3D from the specified parameters.xpoints - an array of x coordinatesypoints - an array of y coordinateszpoints - an array of z coordinatesnpoints - the total number of points in the Polyline3Djava.lang.NegativeArraySizeException - if the value of npoints is negative.java.lang.IndexOutOfBoundsException - if npoints is greater than the length of points array.java.lang.NullPointerException - if one of the points array is null.public Polyline3D(int[] xpoints, int[] ypoints, int[] zpoints, int npoints)
Polyline3D from the specified parameters.xpoints - an array of x coordinatesypoints - an array of y coordinateszpoints - an array of z coordinatesnpoints - the total number of points in the Polyline3Djava.lang.NegativeArraySizeException - if the value of npoints is negative.java.lang.IndexOutOfBoundsException - if npoints is greater than the length of points array.java.lang.NullPointerException - if one of the points array is null.public Polyline3D(Line3D line)
public void reset()
Polyline3D object to an empty polygon.
The coordinate arrays and the data in them are left untouched
but the number of points is reset to zero to mark the old
vertex data as invalid and to start accumulating new vertex
data at the beginning.
All internally-cached data relating to the old vertices
are discarded.
Note that since the coordinate arrays from before the reset
are reused, creating a new empty Polyline3D might
be more memory efficient than resetting the current one if
the number of vertices in the new polyline data is significantly
smaller than the number of vertices in the data from before the
reset.public java.lang.Object clone()
clone in class java.lang.Objectpublic void calculateLines()
public void addPoint(Point3D p)
Polyline3D.
If an operation that calculates the bounding box of this Polyline3D has already been performed, such
as getBounds or contains, then this method updates the bounding box.
p - the point to addpublic void addPoint(double x, double y, double z)
Polyline3D.
If an operation that calculates the bounding box of this Polyline3D has already been performed, such
as getBounds or contains, then this method updates the bounding box.
x - the specified x coordinatey - the specified y coordinatez - the specified z coordinatepublic Rectangle3D getBounds()
Shape3DShape3D.
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 boolean contains(Point3D p)
Shape3DPoint3D is inside the boundary
of the Shape3D.public boolean contains(double x, double y, double z)
Shape3DShape3D.public boolean intersects(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Shape3DShape3D 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 Shape3Dx - 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)
Shape3DShape3D 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 Shape3Dr - the specified Rectangle3Dtrue 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 boolean contains(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Shape3DShape3D entirely contains the specified 3D rectangular area. All
coordinates that lie inside the 3D rectangular area must lie within the Shape3D for the entire
3D rectangular area to be considered contained within the Shape3D.
The Shape3D.contains() method allows a Shape3D implementation to conservatively return
false when:
intersect method returns true and
Shape3D entirely contains the 3D rectangular
area are prohibitively expensive.
Shapes this method might return false even though the Shape3D
contains the 3D rectangular area.contains in interface Shape3Dx - 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 entirely contains the specified rectangular
area; false otherwise or, if the Shape3D contains the 3D rectangular area and
the intersects method returns true and the containment calculations would be
too expensive to perform.public boolean contains(Rectangle3D r)
Shape3DShape3D entirely contains the specified Rectangle3D.
The Shape3D.contains() method allows a Shape3D implementation to conservatively return
false when:
intersect method returns true and
Shape3D entirely contains the
Rectangle3D are prohibitively expensive.
Shapes this method might return false even though the Shape3D
contains the Rectangle3D.contains in interface Shape3Dr - The specified Rectangle3Dtrue if the interior of the Shape3D entirely contains the
Rectangle3D; false otherwise or, if the Shape3D contains the
Rectangle3D and the intersects method returns true and the
containment calculations would be too expensive to perform.Shape3D.contains(double, double, double, double, double, double)