Search Unity

Question Recalculate a mesh

Discussion in 'General Graphics' started by KaesarSEIT, May 17, 2022.

  1. KaesarSEIT

    KaesarSEIT

    Joined:
    May 17, 2022
    Posts:
    2
    I have a mesh that is created by a third party code. He is able to make a line using triangles, but I would need to figure out how to fill in the inner part.

    Any suggestions?
     

    Attached Files:

  2. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Not 100% clear the question.

    You want to triangulate the polygon formed by the red line as a Unity mesh?
     
  3. KaesarSEIT

    KaesarSEIT

    Joined:
    May 17, 2022
    Posts:
    2
    Tnx for support and sorry I try to explain myself better.
    I retrieve a list of vector2 points of the boundaries of a municipality.
    I want to color fill the resulting shape.
    Using a third party software, I can use this vector2 list as parameter to get a mesh shaped as closed line, representing the boundaries.
    But said method does not support coloring the inner part.

    By taking this wrong mesh is it possible to fill the missing face(s)?
    Or maybe there's a different way to draw a shape and fill it with a color, considering I have the list of all the vector2 points that make the target shape?
     
    Last edited: May 18, 2022
  4. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    It’s probably better to take the original points and make a new mesh if you want to fill the shape. It’s not really worth trying to change the original. Sounds like you need to triangulate the polygon the points form and convert to a Unity mesh.

    There’s heaps of open source code that can do this. Clipper is one. LibTessDotNet Another.

    It’s WIP but I also have some code that can do this called CGALDotNet. Only 64 bit windows support however.

    I would need to write some example code as I don’t think Theres any examples of this in the demo project.