math.geom3d
Class PointSet3D

java.lang.Object
  extended by math.geom3d.PointSet3D
All Implemented Interfaces:
java.lang.Iterable<Point3D>, Shape3D

public class PointSet3D
extends java.lang.Object
implements Shape3D, java.lang.Iterable<Point3D>

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom3d.Shape3D
ACCURACY
 
Constructor Summary
PointSet3D()
           
PointSet3D(java.util.Collection<? extends Point3D> points)
          Points must be a collection of java.awt.Point.
PointSet3D(int n)
          Creates a new point set and allocate memory for storing the points.
PointSet3D(Point3D[] points)
          Instances of Point3D are directly added, other Point are converted to Point3D with the same location.
 
Method Summary
 void addPoint(Point3D point)
          Adds a new point to the set of point.
 void addPoints(java.util.Collection<Point3D> points)
           
 void addPoints(Point3D[] points)
          Add a series of points
 Box3D boundingBox()
           
 void clearPoints()
          Removes all points of the set.
 Shape3D clip(Box3D box)
           
 boolean contains(Point3D point)
           
 double distance(Point3D p)
          Gets the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.
 java.util.Iterator<Point3D> getPoints()
          Returns an iterator on the internal point collection.
 boolean isBounded()
          Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape.
 boolean isEmpty()
           
 java.util.Iterator<Point3D> iterator()
           
 int pointNumber()
          Returns the number of points in the set.
 Shape3D transform(AffineTransform3D trans)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointSet3D

public PointSet3D()

PointSet3D

public PointSet3D(int n)
Creates a new point set and allocate memory for storing the points.

Parameters:
n - the number of points to store

PointSet3D

public PointSet3D(Point3D[] points)
Instances of Point3D are directly added, other Point are converted to Point3D with the same location.


PointSet3D

public PointSet3D(java.util.Collection<? extends Point3D> points)
Points must be a collection of java.awt.Point. Instances of Point3D are directly added, other Point are converted to Point3D with the same location.

Parameters:
points -
Method Detail

addPoint

public void addPoint(Point3D point)
Adds a new point to the set of point. If point is not an instance of Point3D, a Point3D with same location is added instead of point.

Parameters:
point -

addPoints

public void addPoints(Point3D[] points)
Add a series of points

Parameters:
points - an array of points

addPoints

public void addPoints(java.util.Collection<Point3D> points)

getPoints

public java.util.Iterator<Point3D> getPoints()
Returns an iterator on the internal point collection.

Returns:
the collection of points

clearPoints

public void clearPoints()
Removes all points of the set.


pointNumber

public int pointNumber()
Returns the number of points in the set.

Returns:
the number of points

clip

public Shape3D clip(Box3D box)
Specified by:
clip in interface Shape3D

boundingBox

public Box3D boundingBox()
Specified by:
boundingBox in interface Shape3D

distance

public double distance(Point3D p)
Description copied from interface: Shape3D
Gets the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.

Specified by:
distance in interface Shape3D

contains

public boolean contains(Point3D point)
Specified by:
contains in interface Shape3D

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Shape3D

isBounded

public boolean isBounded()
Description copied from interface: Shape3D
Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape. For example, a straight line or a parabola are not bounded.

Specified by:
isBounded in interface Shape3D

transform

public Shape3D transform(AffineTransform3D trans)
Specified by:
transform in interface Shape3D

iterator

public java.util.Iterator<Point3D> iterator()
Specified by:
iterator in interface java.lang.Iterable<Point3D>