-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""This file is used to generate the "ground truth" SDFs for the crate tests.""" | ||
|
||
|
||
# Load some mesh (don't necessarily need trimesh) | ||
import trimesh | ||
mesh = trimesh.load("assets/suzanne.glb").geometry['Suzanne'] | ||
|
||
query_points = [[0, 0, 0], [1 ,1 ,1 ], [0.1, 0.2, 0.2]] | ||
|
||
# pysdf | ||
from pysdf import SDF | ||
sdf = SDF(mesh.vertices, mesh.faces); | ||
sdf_multi_point = sdf(query_points) | ||
print("pysdf", sdf_multi_point) | ||
#pysdf [0.45216727 -0.6997909 0.45411023] # negative is outside in pysdf | ||
|
||
|
||
import mesh_to_sdf | ||
import numpy as np | ||
query_points = np.array(query_points) | ||
sdf = mesh_to_sdf.mesh_to_sdf(mesh, query_points, surface_point_method='scan', sign_method='normal', bounding_radius=None, scan_count=100, scan_resolution=400, sample_point_count=10000000, normal_sample_count=11) | ||
print("mesh_to_sdf", sdf) | ||
# mesh_to_sdf [-0.40961263 0.6929414 -0.46345082] # negative is inside in mesh_to_sdf | ||
|