ProGAL.geom3d.volumes
Class LSS

java.lang.Object
  extended by ProGAL.geom3d.volumes.LSS
All Implemented Interfaces:
Shape, Volume

public class LSS
extends java.lang.Object
implements Volume

A line-segment swept sphere (also known as a line-swept-sphere, capsule or sometimes 'cigar') class. The LSS is represented by a line-segment and a radius, and is a cylinder capped with hemispheres. Distance calculations (and thereby collision checks) can be performed very fast, but finding the minimum capsule bounding a set of points can be somewhat time-consuming and no well-documented methods exist for doing this. For a heuristic see [Ericsson 05].


Field Summary
 double rad
           
 LineSegment segment
           
 
Constructor Summary
LSS(LineSegment segment, double r)
          Construct a capsule using a line-segment and a radius (used both for hemispheres and cylinder shape).
LSS(Point p1, Point p2, double r)
          Construct a capsule using two endpoints (center of hemispheres) and a radius (used both for hemispheres and cylinder shape).
 
Method Summary
 LSS clone()
          Make a deep clone this volume.
 double closestSegmentPoint(LSS capsule)
           
 boolean contains(Point p)
           
static LSS createBoundingLSS_covariance(PointList points)
           
static LSS createBoundingLSS_MaxDist(LSS v1, LSS v2)
           
static LSS createBoundingLSS(PointList points)
           
 double distanceToPoint(Point point)
           
 Point getCenter()
          Get the geometric center of the shape.
 double getVolume()
          Get the volume.
 boolean overlaps(LSS capsule)
           
 boolean overlaps(Volume vol)
          Determine if this volume overlaps vol.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

segment

public LineSegment segment

rad

public double rad
Constructor Detail

LSS

public LSS(Point p1,
           Point p2,
           double r)
Construct a capsule using two endpoints (center of hemispheres) and a radius (used both for hemispheres and cylinder shape).


LSS

public LSS(LineSegment segment,
           double r)
Construct a capsule using a line-segment and a radius (used both for hemispheres and cylinder shape).

Method Detail

createBoundingLSS

public static LSS createBoundingLSS(PointList points)

createBoundingLSS_covariance

public static LSS createBoundingLSS_covariance(PointList points)

createBoundingLSS_MaxDist

public static LSS createBoundingLSS_MaxDist(LSS v1,
                                            LSS v2)

distanceToPoint

public double distanceToPoint(Point point)

overlaps

public boolean overlaps(LSS capsule)

closestSegmentPoint

public double closestSegmentPoint(LSS capsule)

overlaps

public boolean overlaps(Volume vol)
Description copied from interface: Volume
Determine if this volume overlaps vol. Two volumes overlap if their surfaces touch or if the union of interiors is non-empty.

Specified by:
overlaps in interface Volume

contains

public boolean contains(Point p)

getVolume

public double getVolume()
Description copied from interface: Volume
Get the volume.

Specified by:
getVolume in interface Volume

clone

public LSS clone()
Description copied from interface: Volume
Make a deep clone this volume.

Specified by:
clone in interface Volume
Overrides:
clone in class java.lang.Object

getCenter

public Point getCenter()
Description copied from interface: Shape
Get the geometric center of the shape. The center of a shape can be interpreted in many ways (center of mass, circumcenter, inscribed center etc.). No strict requirement is given here, but typically the circumcenter should be supplied. This method is most prominently used to find the average center-position of a collection of shapes such that scene-viewers can be centered on the scene.

Specified by:
getCenter in interface Shape

toString

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