Code Monkey home page Code Monkey logo

delynoi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delynoi's Issues

Memory issue when returing static Mesh within getConformingDelaunayTriangulation()

Hi! I found another issue during triangulation.

If Delaunay is used consecutively, the mesh was already instantiated (because its singleton-pattern static). Thus, deleting its points and edges (calling our own .clear() method) generates a CxC000005 memory issue. This does not happen with Voronoi, as it does not return a static mesh.

Thus, instead of:

Mesh<Triangle> &TriangleDelaunayGenerator::getConformingDelaunayTriangulation() {
    if (!this->empty) {
        char switches[] = "pzejDQ";
        callTriangle(seedPoints, switches);
    }

    // Dangerous, even if the memory is not cleared, the mesh will not initialize again!
    static Mesh<Triangle> mesh = initializeMesh<Triangle>();
    return mesh;
}

The method returns:

Mesh<Triangle> &TriangleDelaunayGenerator::getConformingDelaunayTriangulation() {
    if (!this->empty) {
        char switches[] = "pzejDQ";
        callTriangle(seedPoints, switches);
    }
    if (this->meshInitialized) return this->mesh;
    this->mesh = initializeMesh<Triangle>();
    this->meshInitialized = true;
    return this->mesh;
}

Where this->mesh and this->meshInitialized class parameters, the problem is solved and works fantastic.

See https://github.com/IE3-CL/Delynoi for the updated version of this library.

Memory leaks due to object initialization in default Mesh() constructor

Hi! I found some critical memory leaks using Valgrind, mainly due to the allocation of:

 Mesh<T>::Mesh() {
    this->edges = new SegmentMap;
    this->pointMap = new PointMap;
}

Also, mesh results should be wiped after computing Delaunay/Voronoi. See https://github.com/IE3-CL/Delynoi for the updated version of this library, which includes full support for linux/macos/windows, as well as a new format of include/namespace. For example, https://github.com/IE3-CL/Delynoi/blob/master/Delynoi/src/voronoi/TriangleVoronoiGenerator.cpp#L22-L25 adds clear() method which should be removed after results were processed.

@aaortizb I'm interested to keep maintaining this project :)

Add namespace to the library

Hi! We're using Qt alongside Delynoi, but as this library does not use a namespace, there are conflicts regarding class names, such as Polygon, or VOID (in triangle.c).

Thus, a namespace (for example, Delynoi) solves the issue.

Clipped Voronoi diagram

As far as I understood, your library can generate Delaunay triangulations on polygonal regions. I would need a clipped Voronoi diagram on that region. It means that all Voronoi cells are finite and their union gives the region. I would need as an output the list of Voronoi cells described by their vertices. Ideally, I would also need the connectivities of the Voronoi cells and that each segment is between which Voronoi cells. Is it possible?

Cross-platform compilation

Your library compiles on Windows with a tiny change.
In triangle.c, before the conditional inclusion

#ifndef NO_TIMER
#include <sys/time.h>
#endif /* not NO_TIMER */

I inserted #define NO_TIMER to be able to compile on Windows. Maybe this definition can be included from within CMakeLists (I don't really know CMake). If you can solve it, your library will work on another platform as well!

Error occur in Test Project

Windows 7 x64, Visual C++ 2017, CMake 3.14.0 generate solution.

compile and link success, Run test.exe , there are error in triangle.c line14122.

in transfernodes function
14121 /* Read the vertex coordinates. */
14122 x = vertexloop[0] = pointlist[coordindex++]; <====0xC0000005 error!
14123 y = vertexloop[1] = pointlist[coordindex++];

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.