Class BoxBoundary

java.lang.Object
  extended by BoxBoundary
All Implemented Interfaces:
IBoundary

public class BoxBoundary
extends java.lang.Object
implements IBoundary

An n-dimensional box, the simplest possible boundary environment for robots.

Since:
1.0

Nested Class Summary
 class BoxBoundary.DimensionMismatchException
          Indicates that box boundaries were set with mismatched dimensionality.
 
Constructor Summary
BoxBoundary()
          Constructor -- box dimensions specified elsewhere
BoxBoundary(double[] arrLfMin, double[] arrLfMax)
          Constructor -- specifies dimensions and extents of box
 
Method Summary
 double[] bboxMaxCorner()
          gets bounding box max corner
 double[] bboxMinCorner()
          gets bounding box min corner
 double[] closestBoundaryPoint(double[] arrPoint)
          Finds the closest point on the boundary to a given point, or a minimally close point if multiple such points exist.
 double distToBoundary(double[] arrRayOrigin, double[] arrRayDir)
          Finds distance to boundary along a ray from a start point, returns negative number if outside boundary
 int getNumDimensions()
          Mostly just a safety check, since the environment should have this anyway
 boolean isPointInside(double[] arrPoint)
          Inside / outside query.
 void setFromCenterAndExtents(double[] arrLfCenter, double[] arrLfExtents)
          Sets box boundaries from center and box extents.
 void setFromMinMax(double[] arrLfMin, double[] arrLfMax)
          Sets box boundaries from min and max coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoxBoundary

public BoxBoundary()
Constructor -- box dimensions specified elsewhere


BoxBoundary

public BoxBoundary(double[] arrLfMin,
                   double[] arrLfMax)
Constructor -- specifies dimensions and extents of box

Method Detail

bboxMinCorner

public double[] bboxMinCorner()
gets bounding box min corner

Specified by:
bboxMinCorner in interface IBoundary
Returns:
min corner of bounding box

bboxMaxCorner

public double[] bboxMaxCorner()
gets bounding box max corner

Specified by:
bboxMaxCorner in interface IBoundary
Returns:
max corner of bounding box

getNumDimensions

public int getNumDimensions()
Mostly just a safety check, since the environment should have this anyway

Specified by:
getNumDimensions in interface IBoundary

isPointInside

public boolean isPointInside(double[] arrPoint)
Inside / outside query.

Specified by:
isPointInside in interface IBoundary

distToBoundary

public double distToBoundary(double[] arrRayOrigin,
                             double[] arrRayDir)
Finds distance to boundary along a ray from a start point, returns negative number if outside boundary

Specified by:
distToBoundary in interface IBoundary
Parameters:
arrRayOrigin - origin of ray
arrRayDir - direction of ray
Returns:
distance along arrRayDir from arrRayOrigin to boundary, negative if arrRayOrigin is outside boundary

closestBoundaryPoint

public double[] closestBoundaryPoint(double[] arrPoint)
Finds the closest point on the boundary to a given point, or a minimally close point if multiple such points exist.

Specified by:
closestBoundaryPoint in interface IBoundary
Parameters:
arrPoint - point to find closest point to
Returns:
closest point to arrPoint

setFromMinMax

public void setFromMinMax(double[] arrLfMin,
                          double[] arrLfMax)
Sets box boundaries from min and max coordinates


setFromCenterAndExtents

public void setFromCenterAndExtents(double[] arrLfCenter,
                                    double[] arrLfExtents)
Sets box boundaries from center and box extents. Box extents are from center to corner