toxi.geom
Class PointCloud

java.lang.Object
  extended by toxi.geom.PointCloud
All Implemented Interfaces:
java.lang.Iterable<Vec3D>

public class PointCloud
extends java.lang.Object
implements java.lang.Iterable<Vec3D>


Constructor Summary
PointCloud()
           
PointCloud(int numPoints)
           
 
Method Summary
 PointCloud addAll(java.util.List<? extends Vec3D> plist)
           
 PointCloud addPoint(Vec3D p)
           
 PointCloud applyMatrix(Matrix4x4 m)
          Applies the given transformation matrix to all points in the cloud.
 PointCloud center()
          Updates all points in the cloud so that their new centroid is at the origin.
 PointCloud center(ReadonlyVec3D origin)
          Updates all points in the cloud so that their new centroid is at the given point.
 PointCloud clear()
          Removes all points from the cloud and resets the bounds and centroid.
 PointCloud copy()
          Creates a deep copy of the cloud
 AABB getBoundingBox()
           
 Sphere getBoundingSphere()
           
 Vec3D getCentroid()
           
 java.util.Iterator<Vec3D> iterator()
           
 boolean removePoint(ReadonlyVec3D p)
          Removes the point from the cloud, but doesn't update the bounds automatically.
 int size()
           
 PointCloud updateBounds()
          Recalculates the bounding box, bounding sphere and centroid of the cloud.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointCloud

public PointCloud()

PointCloud

public PointCloud(int numPoints)
Method Detail

addAll

public PointCloud addAll(java.util.List<? extends Vec3D> plist)

addPoint

public PointCloud addPoint(Vec3D p)

applyMatrix

public PointCloud applyMatrix(Matrix4x4 m)
Applies the given transformation matrix to all points in the cloud.

Parameters:
m - transformation matrix
Returns:
itself

center

public PointCloud center()
Updates all points in the cloud so that their new centroid is at the origin.

Returns:
itself

center

public PointCloud center(ReadonlyVec3D origin)
Updates all points in the cloud so that their new centroid is at the given point.

Parameters:
origin - new centroid
Returns:
itself

clear

public PointCloud clear()
Removes all points from the cloud and resets the bounds and centroid.

Returns:
itself

copy

public PointCloud copy()
Creates a deep copy of the cloud

Returns:
copied instance

getBoundingBox

public AABB getBoundingBox()

getBoundingSphere

public Sphere getBoundingSphere()

getCentroid

public Vec3D getCentroid()
Returns:
the cloud centroid

iterator

public java.util.Iterator<Vec3D> iterator()
Specified by:
iterator in interface java.lang.Iterable<Vec3D>
Returns:
an iterator for the backing point collection.
See Also:
Iterable.iterator()

removePoint

public boolean removePoint(ReadonlyVec3D p)
Removes the point from the cloud, but doesn't update the bounds automatically.

Parameters:
p -
Returns:
true, if point has been removed.

size

public int size()
Returns:
the current number of points in the cloud

updateBounds

public PointCloud updateBounds()
Recalculates the bounding box, bounding sphere and centroid of the cloud.

Returns:
itself