GithubHelp home page GithubHelp logo

Comments (7)

teseoch avatar teseoch commented on June 3, 2024 2

yes the problem is inside the c++, also confirmed by the issue you mentioned.

regarding the -1, got it, makes sense but is it not a fix.
I tried to push Alec to fix the issue, but it seems stuck :(

The fix suggested in the other issue is FI(i) = FImax; you can do that in python, just set

face_ids[face_ids >= len(faces)] = len(faces)-1

or something similar.

I don't think this is the correct fix, but it is a reasonable walk around.

from libigl-python-bindings.

teseoch avatar teseoch commented on June 3, 2024

could you share the mesh?

from libigl-python-bindings.

maria-korosteleva avatar maria-korosteleva commented on June 3, 2024

No problem, here it is

mesh.zip

from libigl-python-bindings.

teseoch avatar teseoch commented on June 3, 2024

hmhmh it seems to be a windows problem?

I tried your code/mesh and no error.
If the problem is in the C++ version, it needs to be fixed there.

from libigl-python-bindings.

maria-korosteleva avatar maria-korosteleva commented on June 3, 2024

Unfortunately, I'm not sure how to check either of your thoughts, whether it's a windows-specific problem, or it's in c++ version. These questions needs someone with a better understanding of libigl-python-bindings that mine. I'd be happy to provide any extra info upon request though.

I did an additional check if shifting all the output face ids by one could be a workaround, but no, the generator does produce faces with id = 0:
Code

import igl

verts, faces = igl.read_triangle_mesh('D:/Data/mesh.obj')
num_samples = 1000
print(len(faces))

for i in range(100):
    _, face_ids = igl.random_points_on_mesh(num_samples, verts, faces)
    for fid in face_ids:
        if not ((fid-1) < len(faces) and (fid-1) >= 0):
            print('Failed try {} with face {}'.format(i, fid))

Output:

14886
Failed try 18 with face 0
Failed try 44 with face 0
Failed try 45 with face 0
Failed try 93 with face 0
Failed try 94 with face 0
Failed try 98 with face 0

from libigl-python-bindings.

teseoch avatar teseoch commented on June 3, 2024

I think it is a bug in libigl.

Btw, why are you doing fid-1?
Shouldn't be just fid?

from libigl-python-bindings.

maria-korosteleva avatar maria-korosteleva commented on June 3, 2024

@teseoch do you mean c++ version libigl? Were you able to reproduce then?

Regarding fid-1, that was an extra check if the whole range of produced face ids was shifted by one. Say, instead of giving face ids in the correct range of [ 0, len(faces) ) it gives faces in range [ 1, len(faces)+1 ). If that was the case, doing fid-1 will give a workaround

The check confirmed that igl.random_points_on_mesh() produces faces ids in range [ 0, len(faces)+1 ), so doing fid-1 won't help

from libigl-python-bindings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.