Code Monkey home page Code Monkey logo

Comments (1)

Pindrought avatar Pindrought commented on May 22, 2024

Just to add - since this is accessing bad data, you can run coacd on the same mesh many times and get different results as far as # of shapes, points, etc.

For now, i've replaced the following...
https://github.com/SarahWeiii/CoACD/blob/main/src/process.cpp#L162-L186

with

if (p1 < costSize)
{
    rowIdx = (addrI * p1) >> 1;
    size_t top_row = erase_idx;
    for (size_t i = 0; i < p1; ++i)
    {
        //I ADDED THIS CHECK BECAUSE OUT OF BOUNDS STUFF WAS HAPPENING UNTIL I CAN FIGURE OUT WHAT IS GOING ON HERE
        if (rowIdx < costMatrix.size() && rowIdx < precostMatrix.size() &&
            top_row < costMatrix.size() && top_row < precostMatrix.size())
        {
            if (i != p2)
            {
                costMatrix[rowIdx] = costMatrix[top_row];
                precostMatrix[rowIdx] = precostMatrix[top_row];
            }
        }
        ++rowIdx;
        ++top_row;
    }

    ++top_row;
    rowIdx += p1;
    for (size_t i = p1 + 1; i < (costSize + 1); ++i)
    {
        //I ADDED THIS CHECK BECAUSE OUT OF BOUNDS STUFF WAS HAPPENING UNTIL I CAN FIGURE OUT WHAT IS GOING ON HERE
        if (rowIdx < costMatrix.size() && rowIdx < precostMatrix.size() &&
            top_row < costMatrix.size() && top_row < precostMatrix.size())
        {
            costMatrix[rowIdx] = costMatrix[top_row];
            precostMatrix[rowIdx] = precostMatrix[top_row];
        }
        top_row++;
        rowIdx += i;
        assert(rowIdx >= 0);
    }
}

Really hoping someone smarter than me can figure out what the proper fix is here though.
I don't know what this is even supposed to be doing or what a cost matrix is so it's hard to fix.

from coacd.

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.