public class Cylinder extends java.lang.Object implements Extent, Renderable
Cylinder
s are immutable.Modifier and Type | Field and Description |
---|---|
protected Vec4 |
axisUnitDirection |
protected Vec4 |
bottomCenter |
protected double |
cylinderHeight |
protected double |
cylinderRadius |
protected Vec4 |
topCenter |
Constructor and Description |
---|
Cylinder(Vec4 bottomCenter,
Vec4 topCenter,
double cylinderRadius)
Create a Cylinder from two points and a radius.
|
Cylinder(Vec4 bottomCenter,
Vec4 topCenter,
double cylinderRadius,
Vec4 unitDirection)
Create a Cylinder from two points, a radius and an axis direction.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
clipcyl(Vec4 raybase,
Vec4 raycos,
Vec4 bot,
Vec4 top,
Vec4 axis,
double[] tVals) |
static Cylinder |
computeBoundingCylinder(java.lang.Iterable<? extends Vec4> points)
Compute a bounding cylinder for a collection of points.
|
static Cylinder |
computeVerticalBoundingCylinder(Globe globe,
double verticalExaggeration,
Sector sector)
Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a
specified vertical exaggeration, and is oriented such that the cylinder axis is perpendicular to the globe's
surface.
|
static Cylinder |
computeVerticalBoundingCylinder(Globe globe,
double verticalExaggeration,
Sector sector,
double minElevation,
double maxElevation)
Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a
specified vertical exaggeration, and is oriented such that the cylinder axis is perpendicular to the globe's
surface.
|
protected static Cylinder |
computeVerticalBoundsFromSectorLatitudeRange(Globe globe,
Sector sector,
double minHeight,
double maxHeight)
Compute the Cylinder that surrounds the equator, and has height defined by the sector's minumum and maximum
latitudes (including maxHeight).
|
protected static Cylinder |
computeVerticalBoundsFromSectorQuadrilateral(Globe globe,
Sector sector,
double minHeight,
double maxHeight)
Returns a cylinder that minimally surrounds the specified height range in the sector.
|
protected static Cylinder |
computeVerticalBoundsFromSectorVertices(Globe globe,
Sector sector,
double minHeight,
double maxHeight)
Returns a cylinder that surrounds the specified height range in the zero-area sector.
|
boolean |
equals(java.lang.Object o) |
Vec4 |
getAxisUnitDirection()
Returns the unit-length axis of this cylinder.
|
Vec4 |
getBottomCenter()
Returns the this cylinder's bottom-center point.
|
Vec4 |
getCenter()
Return this cylinder's center point.
|
double |
getCylinderHeight()
Returns this cylinder's height.
|
double |
getCylinderRadius()
Returns this cylinder's radius.
|
double |
getDiameter()
Returns the extent's diameter.
|
double |
getEffectiveRadius(Plane plane)
Computes the effective radius of the extent relative to a specified plane.
|
double |
getProjectedArea(View view)
Computes the area in square pixels of this
Extent after it is projected into the specified
view's viewport. |
double |
getRadius()
Returns the extent's radius.
|
Vec4 |
getTopCenter()
Returns the this cylinder's top-center point.
|
double |
getVolume()
Return this cylinder's volume.
|
int |
hashCode() |
protected boolean |
intcyl(Vec4 raybase,
Vec4 raycos,
Vec4 base,
Vec4 axis,
double radius,
double[] tVals) |
Intersection[] |
intersect(Line line)
Computes the intersections of this extent with
line . |
boolean |
intersects(Frustum frustum)
Determines whether or not this
Extent intersects frustum . |
boolean |
intersects(Line line)
Determines whether or not
line intersects this Extent . |
boolean |
intersects(Plane plane)
Calculate whether or not this
Extent is intersected by plane . |
protected double |
intersects(Plane plane,
double effectiveRadius) |
protected double |
intersectsAt(Plane plane,
double effectiveRadius,
Vec4[] endpoints) |
void |
render(DrawContext dc)
Display the cylinder.
|
java.lang.String |
toString() |
protected final Vec4 axisUnitDirection
protected final Vec4 bottomCenter
protected final double cylinderHeight
protected final double cylinderRadius
protected final Vec4 topCenter
public Cylinder(Vec4 bottomCenter, Vec4 topCenter, double cylinderRadius)
bottomCenter
- the center point of of the cylinder's base.topCenter
- the center point of the cylinders top.cylinderRadius
- the cylinder's radius.java.lang.IllegalArgumentException
- if the radius is zero or the top or bottom point is null or they are
coincident.public Cylinder(Vec4 bottomCenter, Vec4 topCenter, double cylinderRadius, Vec4 unitDirection)
bottomCenter
- the center point of of the cylinder's base.topCenter
- the center point of the cylinders top.cylinderRadius
- the cylinder's radius.unitDirection
- the unit-length axis of the cylinder.java.lang.IllegalArgumentException
- if the radius is zero or the top or bottom point is null or they are
coincident.protected boolean clipcyl(Vec4 raybase, Vec4 raycos, Vec4 bot, Vec4 top, Vec4 axis, double[] tVals)
public static Cylinder computeBoundingCylinder(java.lang.Iterable<? extends Vec4> points)
points
- the points to compute a bounding cylinder for.WWMath.computePrincipalAxes(Iterable)
.java.lang.IllegalArgumentException
- if the point list is null or empty.computeVerticalBoundingCylinder(gov.nasa.worldwind.globes.Globe, double, Sector)
public static Cylinder computeVerticalBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector)
globe
- The globe associated with the sector.verticalExaggeration
- the vertical exaggeration to apply to the minimum and maximum elevations when
computing the cylinder.sector
- the sector to return the bounding cylinder for.java.lang.IllegalArgumentException
- if sector
is nullcomputeBoundingCylinder(Iterable)
public static Cylinder computeVerticalBoundingCylinder(Globe globe, double verticalExaggeration, Sector sector, double minElevation, double maxElevation)
globe
- The globe associated with the sector.verticalExaggeration
- the vertical exaggeration to apply to the minimum and maximum elevations when
computing the cylinder.sector
- the sector to return the bounding cylinder for.minElevation
- the minimum elevation of the bounding cylinder.maxElevation
- the maximum elevation of the bounding cylinder.java.lang.IllegalArgumentException
- if sector
is nullcomputeBoundingCylinder(Iterable)
protected static Cylinder computeVerticalBoundsFromSectorLatitudeRange(Globe globe, Sector sector, double minHeight, double maxHeight)
globe
- The globe associated with the sector.sector
- the sector to return the bounding cylinder for.minHeight
- the minimum height to include in the bounding cylinder.maxHeight
- the maximum height to include in the bounding cylinder.java.lang.IllegalArgumentException
- if sector
is nullprotected static Cylinder computeVerticalBoundsFromSectorQuadrilateral(Globe globe, Sector sector, double minHeight, double maxHeight)
globe
- The globe associated with the sector.sector
- the sector to return the bounding cylinder for.minHeight
- the minimum height to include in the bounding cylinder.maxHeight
- the maximum height to include in the bounding cylinder.java.lang.IllegalArgumentException
- if sector
is nullprotected static Cylinder computeVerticalBoundsFromSectorVertices(Globe globe, Sector sector, double minHeight, double maxHeight)
computeBoundsFromSectorQuadrilateral
.globe
- The globe associated with the sector.sector
- the sector to return the bounding cylinder for.minHeight
- the minimum height to include in the bounding cylinder.maxHeight
- the maximum height to include in the bounding cylinder.java.lang.IllegalArgumentException
- if sector
is nullpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public Vec4 getAxisUnitDirection()
public Vec4 getBottomCenter()
public Vec4 getCenter()
public double getCylinderHeight()
public double getCylinderRadius()
public double getDiameter()
getDiameter
in interface Extent
public double getEffectiveRadius(Plane plane)
getEffectiveRadius
in interface Extent
plane
- the plane.public double getProjectedArea(View view)
Extent
after it is projected into the specified
view's
viewport. The returned value is the screen area that this Extent
covers in the
infinite plane defined by the view's
viewport. This area is not limited to the size of the
view's
viewport, and portions of this Extent
are not clipped by the view's
frustum.
This returns Double.POSITIVE_INFINITY
if the view's
eye point is inside this
Extent
, or if any portion of this Extent
is behind the eye point. In either case, this
Extent
has no finite projection on the view
.getProjectedArea
in interface Extent
view
- the View
for which to compute a projected screen area.Extent
in square pixels, or
Double.POSITIVE_INFINITY
if the view's
eye point is inside this
Extent
or part of this Extent
is behind the view's
eye point.public double getRadius()
public Vec4 getTopCenter()
public double getVolume()
public int hashCode()
hashCode
in class java.lang.Object
protected boolean intcyl(Vec4 raybase, Vec4 raycos, Vec4 base, Vec4 axis, double radius, double[] tVals)
public Intersection[] intersect(Line line)
line
. The returned array may be either null or of
zero length if no intersections are discovered. It does not contain null elements. Tangential intersections are
marked as such. line
is considered to have infinite length in both directions.public boolean intersects(Frustum frustum)
Extent
intersects frustum
. Returns true if any part of
these two objects intersect, including the case where either object wholly contains the other, false otherwise.intersects
in interface Extent
frustum
- the Frustum
with which to test for intersection.public boolean intersects(Line line)
line
intersects this Extent
. This method may be faster than
checking the size of the array returned by intersect(Line)
. Implementing methods must ensure that
this method returns true if and only if intersect(Line)
returns a non-null array containing at least
one element.intersects
in interface Extent
line
- the Line
with which to test for intersection.public boolean intersects(Plane plane)
Extent
is intersected by plane
.intersects
in interface Extent
plane
- the Plane
with which to test for intersection.plane
is found to intersect this Extent
.protected double intersects(Plane plane, double effectiveRadius)
public void render(DrawContext dc)
render
in interface Renderable
dc
- the current draw context.java.lang.IllegalArgumentException
- if the draw context is null.DrawContext
public java.lang.String toString()
toString
in class java.lang.Object