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

mcxsvmc isosurface normal direction is flipped in octave compared to matlab #221

Closed
fangq opened this issue May 18, 2024 · 0 comments
Closed

Comments

@fangq
Copy link
Owner

fangq commented May 18, 2024

This was initially reported by Josef Probst, and lately by Vincent in the below mailing list thread

https://groups.google.com/g/mcx-users/c/OYRhYRAyFg8

Apparently, the isosurface function produces opposite clock-wise node orders in the output isosurface mesh. this makes the octave surface normal direction flipped compared to the expected direction as those computed in matlab.

here is an example

[xi,yi,zi]=meshgrid(0:60,0:60,0:60);
vol=((xi-30).*(xi-30)+(yi-30).*(yi-30)+(zi-30).*(zi-30))<400;
vol((xi-30).*(xi-30)+(yi-30).*(yi-30)+(zi-30).*(zi-30)<100)=0;
iso=isosurface(double(vol));
nn=nodesurfnorm(iso.vertices, iso.faces);
plotmesh(iso.vertices, iso.faces, 'z<40', 'facealpha', 0.4)
hold on
plotmesh(iso.vertices+nn*0.3, 'z<40', 'r.')

the below plot shows the discrepancy - in matlab, normal direction points from low-to-high across the isosurface threshold, but octave points from high-to-low

image

@fangq fangq closed this as completed in 0a76d17 May 18, 2024
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

1 participant