Giter VIP home page Giter VIP logo

Comments (6)

acdean avatar acdean commented on June 1, 2024

// small example of the error
import megamu.mesh.*;

float[][] p = {
{142.78653, 364.8811},
{142.80171, 361.90747},
{142.8004, 361.91183},
{141.72589, 363.63394},
};

Voronoi v = new Voronoi(p);

from mesh.

acdean avatar acdean commented on June 1, 2024

// if called with 0 then this creates a non-array
public MPolygon(int points){
coords = new float[points][2];
count = 0;
}

// which this then tries to access element 0 of, causing the error.
public void add(float x, float y){
coords[count][0] = x;
coords[count++][1] = y;
}

from mesh.

acdean avatar acdean commented on June 1, 2024

but i think that the problem is actually that the MPolygon is ever being called with 0

problem in Voronoi constructor?
//regions[i] = new MPolygon(pointBuckets[i].length); // wrong?
// should that be this?
regions[i] = new MPolygon(faceOrder.length);

from mesh.

lquinn2015 avatar lquinn2015 commented on June 1, 2024

I can confirm that this seems to fix the issue. I can try and create a pull request for this but is @leebyron still around to accept it. I ran into this when trying to regularize Voronoi graphs.

from mesh.

leebyron avatar leebyron commented on June 1, 2024

PR it!

from mesh.

lquinn2015 avatar lquinn2015 commented on June 1, 2024

@leebyron I made a pull and it fixed that issue that I was having and the issue that acdean was defining however if you have some more test cases to but it through that's probably smart. I've only been using the library for a week so my testing code is pretty limited

from mesh.

Related Issues (4)

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.