Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I met with erratic results #5

Open
zb12138 opened this issue Jul 21, 2022 · 1 comment
Open

I met with erratic results #5

zb12138 opened this issue Jul 21, 2022 · 1 comment

Comments

@zb12138
Copy link

zb12138 commented Jul 21, 2022

I encounter unstable results when I run Python code. Is there any randomness to this method?
This is my code:

import numpy as np
from pysdf import SDF
import trimesh
o = trimesh.load('aa.obj')
o.vertices = o.vertices - o.vertices.min()
resolution = 100

tick = np.expand_dims(np.linspace((o.vertices).min(),(o.vertices).max(),resolution),1)
[x,y,z] = np.meshgrid(tick,tick,tick)
queryPoint = np.c_[x.reshape(-1),y.reshape(-1),z.reshape(-1)]

f = SDF(o.vertices, o.faces)
sdf0 = f(queryPoint)
f1 = SDF(o.vertices, o.faces)
sdf1 = f1(queryPoint)
print((sdf0 - sdf1).max())

environment:
Intel(R) Core(TM) i5-9500 CPU; Windows 10; pyhton 3.7.9; No GPUs

expected output: 0
actual output: 37.03153 (stochastic)

Can you provide a method without randomness? Thank you!

@omaralvarez
Copy link

omaralvarez commented Apr 8, 2024

I have the same issue, is there a way to obtain always same results? Some points randomly have incorrect distances.

I have non watertight mesh, could that be the cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants