us.ihmc.utilities.math.geometry
Class Box3d

java.lang.Object
  extended by us.ihmc.utilities.math.geometry.Box3d
All Implemented Interfaces:
Shape3d
Direct Known Subclasses:
YawableBoxTerrainObject

public class Box3d
extends java.lang.Object
implements Shape3d


Nested Class Summary
static class Box3d.FaceName
           
 
Field Summary
static int NUM_SIDES
           
static int NUM_VERTICES
           
static int NUM_VERTICES_PER_FACE
           
 
Constructor Summary
Box3d()
           
Box3d(Box3d other)
           
Box3d(double lengthX, double widthY, double heightZ)
           
Box3d(javax.media.j3d.Transform3D configuration, double[] dimensions)
           
Box3d(javax.media.j3d.Transform3D configuration, double lengthX, double widthY, double heightZ)
           
 
Method Summary
 void applyTransform(javax.media.j3d.Transform3D transform)
          Apply the given transform to translate and rotate this shape.
 Box3d applyTransformCopy(javax.media.j3d.Transform3D transform3D)
          Create a copy of this shape, then apply the given transform to translate and rotate the copy.
 void computeVertices(javax.vecmath.Point3d[] verticesToPack)
           
 void computeVertices(javax.vecmath.Point3d[] verticesToPack, Box3d.FaceName faceName)
           
 double distance(javax.vecmath.Point3d point)
          Find the distance from the closest point on this shape to the given point.
 void getCenter(javax.vecmath.Tuple3d centerToPack)
           
 javax.vecmath.Point3d getCenterCopy()
           
 Plane3d getClosestFace(javax.vecmath.Point3d point)
           
 void getClosestPointAndNormalAt(javax.vecmath.Point3d closestPointToPack, javax.vecmath.Vector3d normalToPack, javax.vecmath.Point3d pointInWorldToCheck)
          Find the closest point on the surface of this shape to the given point as well as the surface normal at that point.
 double getDimension(Direction direction)
           
 Plane3d getFace(Box3d.FaceName faceName)
           
 double getHeight()
           
 double getLength()
           
 void getRotation(javax.vecmath.Matrix3d rotationMatrixToPack)
           
 javax.vecmath.Matrix3d getRotationCopy()
           
 void getTransform(javax.media.j3d.Transform3D transformToPack)
           
 javax.media.j3d.Transform3D getTransformCopy()
           
 javax.vecmath.Point3d[] getVertices()
           
 double getWidth()
           
 boolean isInsideOrOnSurface(javax.vecmath.Point3d point)
          Determine whether the given point is on or inside the surface of this shape.
 boolean isInsideOrOnSurface(javax.vecmath.Point3d point, double epsilon)
          Determine whether the given point is on or inside the surface of this shape, within a given tolerance or error level.
 void orthogonalProjection(javax.vecmath.Point3d point)
          Find the closest point on the surface of this shape to the given point.
 javax.vecmath.Point3d orthogonalProjectionCopy(javax.vecmath.Point3d point)
          Find the closest point on the surface of this shape to the given point.
 void scale(double scale)
           
 void set(Box3d other)
           
 void setDimensions(double lengthX, double widthY, double heightZ)
           
 void setDimensions(java.util.EnumMap<Direction,java.lang.Double> dimensions)
           
 void setRotation(javax.vecmath.Matrix3d rotation)
           
 void setTransform(javax.media.j3d.Transform3D transform)
           
 void setTranslation(javax.vecmath.Tuple3d translation)
           
 void setYawPitchRoll(double yaw, double pitch, double roll)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NUM_VERTICES

public static final int NUM_VERTICES
See Also:
Constant Field Values

NUM_SIDES

public static final int NUM_SIDES
See Also:
Constant Field Values

NUM_VERTICES_PER_FACE

public static final int NUM_VERTICES_PER_FACE
See Also:
Constant Field Values
Constructor Detail

Box3d

public Box3d()

Box3d

public Box3d(javax.media.j3d.Transform3D configuration,
             double lengthX,
             double widthY,
             double heightZ)

Box3d

public Box3d(Box3d other)

Box3d

public Box3d(double lengthX,
             double widthY,
             double heightZ)

Box3d

public Box3d(javax.media.j3d.Transform3D configuration,
             double[] dimensions)
Method Detail

getCenter

public void getCenter(javax.vecmath.Tuple3d centerToPack)

getCenterCopy

public javax.vecmath.Point3d getCenterCopy()

getTransform

public void getTransform(javax.media.j3d.Transform3D transformToPack)

getTransformCopy

public javax.media.j3d.Transform3D getTransformCopy()

getRotation

public void getRotation(javax.vecmath.Matrix3d rotationMatrixToPack)

getRotationCopy

public javax.vecmath.Matrix3d getRotationCopy()

getDimension

public double getDimension(Direction direction)

getLength

public double getLength()

getWidth

public double getWidth()

getHeight

public double getHeight()

getFace

public Plane3d getFace(Box3d.FaceName faceName)

set

public void set(Box3d other)

setDimensions

public void setDimensions(java.util.EnumMap<Direction,java.lang.Double> dimensions)

setDimensions

public void setDimensions(double lengthX,
                          double widthY,
                          double heightZ)

scale

public void scale(double scale)

distance

public double distance(javax.vecmath.Point3d point)
Description copied from interface: Shape3d
Find the distance from the closest point on this shape to the given point.

Specified by:
distance in interface Shape3d
Returns:

orthogonalProjection

public void orthogonalProjection(javax.vecmath.Point3d point)
Description copied from interface: Shape3d
Find the closest point on the surface of this shape to the given point. If the given point is on or inside the shape, then it is not changed.

Specified by:
orthogonalProjection in interface Shape3d
Parameters:
point - both an input parameter (the point to check), and an output parameter (packed with the resulting ortho point).

orthogonalProjectionCopy

public javax.vecmath.Point3d orthogonalProjectionCopy(javax.vecmath.Point3d point)
Description copied from interface: Shape3d
Find the closest point on the surface of this shape to the given point. If the given point is on or inside the shape, then it returned unchanged.

Specified by:
orthogonalProjectionCopy in interface Shape3d
Returns:
a new point on surface of the shape

applyTransform

public void applyTransform(javax.media.j3d.Transform3D transform)
Description copied from interface: Shape3d
Apply the given transform to translate and rotate this shape.

Specified by:
applyTransform in interface Shape3d

applyTransformCopy

public Box3d applyTransformCopy(javax.media.j3d.Transform3D transform3D)
Description copied from interface: Shape3d
Create a copy of this shape, then apply the given transform to translate and rotate the copy.

Specified by:
applyTransformCopy in interface Shape3d
Returns:

setTransform

public void setTransform(javax.media.j3d.Transform3D transform)

setRotation

public void setRotation(javax.vecmath.Matrix3d rotation)

setYawPitchRoll

public void setYawPitchRoll(double yaw,
                            double pitch,
                            double roll)

setTranslation

public void setTranslation(javax.vecmath.Tuple3d translation)

isInsideOrOnSurface

public boolean isInsideOrOnSurface(javax.vecmath.Point3d point)
Description copied from interface: Shape3d
Determine whether the given point is on or inside the surface of this shape.

Specified by:
isInsideOrOnSurface in interface Shape3d
Returns:

isInsideOrOnSurface

public boolean isInsideOrOnSurface(javax.vecmath.Point3d point,
                                   double epsilon)
Description copied from interface: Shape3d
Determine whether the given point is on or inside the surface of this shape, within a given tolerance or error level.

Specified by:
isInsideOrOnSurface in interface Shape3d
Returns:

getClosestPointAndNormalAt

public void getClosestPointAndNormalAt(javax.vecmath.Point3d closestPointToPack,
                                       javax.vecmath.Vector3d normalToPack,
                                       javax.vecmath.Point3d pointInWorldToCheck)
Description copied from interface: Shape3d
Find the closest point on the surface of this shape to the given point as well as the surface normal at that point.

Specified by:
getClosestPointAndNormalAt in interface Shape3d
Parameters:
closestPointToPack - out parameter packed with the resulting closest point on the shape
normalToPack - out parameter packed with the resulting normal vector

getClosestFace

public Plane3d getClosestFace(javax.vecmath.Point3d point)

getVertices

public javax.vecmath.Point3d[] getVertices()

computeVertices

public void computeVertices(javax.vecmath.Point3d[] verticesToPack)

computeVertices

public void computeVertices(javax.vecmath.Point3d[] verticesToPack,
                            Box3d.FaceName faceName)

toString

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