Last active
March 26, 2019 13:42
-
-
Save jackd/22dfc19984443469e117a091e11d9e2b to your computer and use it in GitHub Desktop.
trimesh issue with minimum sphere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import trimesh | |
points = np.load('cloud_data.npy') | |
center, radius = trimesh.nsphere.minimum_nsphere(points) | |
print('data has already been centered/rescaled on minimum_nsphere') | |
print('center=%s, radius=%s' % (center, radius)) | |
print('Largest point norm: %.3f' % np.max(np.linalg.norm(points, axis=-1))) | |
naive_center = (np.min(points, axis=0) + np.max(points, axis=0)) / 2 | |
points = points - naive_center | |
r = np.max(np.linalg.norm(points, axis=-1)) | |
print('Largest point norm after naive recentering: %.3f' % r) | |
# trimesh.points.PointCloud(points).show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment