com.partnersoft.geometry.xyz
Class XyzBounds

java.lang.Object
  extended by com.partnersoft.geometry.xyz.XyzBounds
All Implemented Interfaces:
Immutable

public class XyzBounds
extends java.lang.Object
implements Immutable

Three-dimensional box bounds, expressed as minimum and maximum x, y, and z.

While a box shape may serve these purposes just as well, having a purpose-specific class does improve code semantics. With that in mind, this class intentionally does not currently implement XyzShape - however I am considering the pros and cons of that decision.

Copyright 2007 Partner Software, Inc.

Version:
$Id: XyzBounds.java 1012 2007-11-24 18:30:02Z paul $
Author:
Paul Reavis

Field Summary
 double maximumX
           
 double maximumY
           
 double maximumZ
           
 double minimumX
           
 double minimumY
           
 double minimumZ
           
 
Constructor Summary
XyzBounds(double x, double y, double z)
          Creates a degenerate bounds containing a single point.
XyzBounds(double x1, double y1, double z1, double... additionalCoords)
          Creates a bounds from the given x1, y1, and z1 plus additional coordinate pairs.
XyzBounds(java.lang.Iterable<XyzPoint> points)
          Creates a bounds containing the given points.
XyzBounds(XyzPoint... points)
          Creates a bounds containing the given points.
XyzBounds(XyzPoint point)
          Creates a degenerate bounds containing a single XyzPoint.
 
Method Summary
 boolean contains(double x, double y, double z)
          Returns true if the given point's are greater than or equal to the minimums and less than (but not equal to) the maximums.
 boolean contains(XyzPoint point)
          Returns true if the given point's are greater than or equal to the minimums and less than (but not equal to) the maximums.
 boolean equals(java.lang.Object nother)
           
 XyzPoint getCenter()
          The center point.
 double getDepth()
          Depth of these bounds (z dimension).
 double getHeight()
          Height of these bounds (y dimension).
 XyzPoint getMaximumPoint()
          Returns a point with maximum x, y, and z.
 double getMaximumX()
           
 double getMaximumY()
           
 double getMaximumZ()
           
 XyzPoint getMinimumPoint()
          Returns a point with minimum x, y, and z.
 double getMinimumX()
           
 double getMinimumY()
           
 double getMinimumZ()
           
 double getWidth()
          Width of these bounds (x dimension).
 XyzBounds stretchedToInclude(double x, double y, double z)
          Returns a new XyzBounds that is expanded to include the given point.
 XyzBounds stretchedToInclude(XyzBounds nother)
          Returns a new XyzBounds that is expanded to include the given bounds.
 XyzBounds stretchedToInclude(XyzPoint point)
          Returns a new XyzBounds that is expanded to include the given point.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minimumX

public double minimumX

minimumY

public double minimumY

minimumZ

public double minimumZ

maximumX

public double maximumX

maximumY

public double maximumY

maximumZ

public double maximumZ
Constructor Detail

XyzBounds

public XyzBounds(double x,
                 double y,
                 double z)
Creates a degenerate bounds containing a single point.


XyzBounds

public XyzBounds(double x1,
                 double y1,
                 double z1,
                 double... additionalCoords)
Creates a bounds from the given x1, y1, and z1 plus additional coordinate pairs. X, Y, Z must alternate.


XyzBounds

public XyzBounds(XyzPoint point)
Creates a degenerate bounds containing a single XyzPoint.


XyzBounds

public XyzBounds(XyzPoint... points)
Creates a bounds containing the given points.


XyzBounds

public XyzBounds(java.lang.Iterable<XyzPoint> points)
Creates a bounds containing the given points.

Method Detail

stretchedToInclude

public XyzBounds stretchedToInclude(double x,
                                    double y,
                                    double z)
Returns a new XyzBounds that is expanded to include the given point.


stretchedToInclude

public XyzBounds stretchedToInclude(XyzPoint point)
Returns a new XyzBounds that is expanded to include the given point.


stretchedToInclude

public XyzBounds stretchedToInclude(XyzBounds nother)
Returns a new XyzBounds that is expanded to include the given bounds.

Parameters:
nother - other bounds to include.

contains

public boolean contains(XyzPoint point)
Returns true if the given point's are greater than or equal to the minimums and less than (but not equal to) the maximums.

Returns:
true if point is inside bounds

contains

public boolean contains(double x,
                        double y,
                        double z)
Returns true if the given point's are greater than or equal to the minimums and less than (but not equal to) the maximums.

Returns:
true if point is inside bounds

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object nother)
Overrides:
equals in class java.lang.Object

getMinimumX

public double getMinimumX()

getMinimumY

public double getMinimumY()

getMinimumZ

public double getMinimumZ()

getMaximumX

public double getMaximumX()

getMaximumY

public double getMaximumY()

getMaximumZ

public double getMaximumZ()

getMinimumPoint

public XyzPoint getMinimumPoint()
Returns a point with minimum x, y, and z.

Returns:
minimum point

getMaximumPoint

public XyzPoint getMaximumPoint()
Returns a point with maximum x, y, and z.

Returns:
maximum point

getCenter

public XyzPoint getCenter()
The center point.

Returns:
center

getWidth

public double getWidth()
Width of these bounds (x dimension).


getHeight

public double getHeight()
Height of these bounds (y dimension).


getDepth

public double getDepth()
Depth of these bounds (z dimension).