Package toxi.geom

Class PointCloud3D

java.lang.Object
toxi.geom.PointCloud3D
All Implemented Interfaces:
Iterable<Vec3D>

public class PointCloud3D extends Object implements Iterable<Vec3D>
  • Constructor Details

    • PointCloud3D

      public PointCloud3D()
    • PointCloud3D

      public PointCloud3D(int numPoints)
  • Method Details

    • addAll

      public PointCloud3D addAll(List<? extends Vec3D> plist)
    • addPoint

      public PointCloud3D addPoint(Vec3D p)
    • applyMatrix

      public PointCloud3D applyMatrix(Matrix4x4 m)
      Applies the given transformation matrix to all points in the cloud.
      Parameters:
      m - transformation matrix
      Returns:
      itself
    • center

      public PointCloud3D center()
      Updates all points in the cloud so that their new centroid is at the origin.
      Returns:
      itself
    • center

      public PointCloud3D 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 PointCloud3D clear()
      Removes all points from the cloud and resets the bounds and centroid.
      Returns:
      itself
    • copy

      public PointCloud3D 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 Iterator<Vec3D> iterator()
      Specified by:
      iterator in interface Iterable<Vec3D>
      Returns:
      an iterator for the backing point collection.
      See Also:
    • 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 PointCloud3D updateBounds()
      Recalculates the bounding box, bounding sphere and centroid of the cloud.
      Returns:
      itself