Exemple #1
0
 public PointCloud3D addPoint(Vec3D p) {
   points.add(p);
   min.minSelf(p);
   max.maxSelf(p);
   centroid.set(min.add(max).scaleSelf(0.5f));
   radiusSquared = MathUtils.max(radiusSquared, p.distanceToSquared(centroid));
   return this;
 }
Exemple #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;
 }