/** * Updates all points in the cloud so that their new centroid is at the given point. * * @param origin new centroid * @return itself */ public PointCloud3D center(ReadonlyVec3D origin) { getCentroid(); Vec3D delta = origin != null ? origin.sub(centroid) : centroid.getInverted(); for (Vec3D p : points) { p.addSelf(delta); } min.addSelf(delta); max.addSelf(delta); centroid.addSelf(delta); return this; }