Ejemplo n.º 1
0
 /**
  * Removes all points from the cloud and resets the bounds and centroid.
  *
  * @return itself
  */
 public PointCloud3D clear() {
   points.clear();
   min = Vec3D.MAX_VALUE.copy();
   max = Vec3D.NEG_MAX_VALUE.copy();
   centroid = new Vec3D();
   return this;
 }
Ejemplo n.º 2
0
 /**
  * Recalculates the bounding box, bounding sphere and centroid of the cloud.
  *
  * @return itself
  */
 public PointCloud3D updateBounds() {
   min = Vec3D.MAX_VALUE.copy();
   max = Vec3D.NEG_MAX_VALUE.copy();
   for (Vec3D p : points) {
     min.minSelf(p);
     max.maxSelf(p);
   }
   centroid.set(min.add(max).scaleSelf(0.5f));
   radiusSquared = 0;
   for (ReadonlyVec3D p : points) {
     radiusSquared = MathUtils.max(radiusSquared, p.distanceToSquared(centroid));
   }
   return this;
 }