Coder Social home page Coder Social logo

severinstrobl / overlap Goto Github PK

View Code? Open in Web Editor NEW
30.0 6.0 14.0 265 KB

Exact calculation of the overlap volume and area of spheres and mesh elements

License: GNU General Public License v3.0

C++ 91.05% CMake 4.18% Python 4.77%
computational-geometry mesh-processing numerical-simulations

overlap's People

Contributors

dependabot[bot] avatar kalekundert avatar severinstrobl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

overlap's Issues

Improve documentation

The documentation needs to be improved significantly regarding at least the following aspects:

  • input format
  • configuration (scalar_t, vector_t)

How to check a meshed medium by multiple spheres

I have found this library today and it will help me a lot in my project. I have read the related article and thanks for the Python library. I have question that how could I get each mesh cells occupied volume by spheres (where is the documentation? Is it existed? Is it just the readme? If so, IMO, it needs to be improved) if we have a medium full of spheres.

  1. Do we have to loop on each cell or sphere and find their corresponding spheres or cells, or we can do it with NumPy at once (not looping)? If we need loop, so we must order each cell nodes as it was explained (right hand rule outward)?
    I would be grateful if put a sample here which be representative to handle such medium, for hexahedron mesh cells (at least 2) and some spheres.
  2. Also, I couldn't understand if the proposed method can handle smaller spheres, which are placed completely inside the cells. Thanks for clarifications.

Overlap area of sphere inside of tetrahedron

I am attempting to use this program to calculate the overlap area of a tetrahedron and a sphere (the example in the README). I notice that it gives the overlap area for each tetrahedron face and sums that up as the total overlap area. Is there also a way to return the overlap area of the sphere (that is, the area of the spherical cap residing inside the tetrahedron)?

Provide Python bindings for `overlap`

Hi there! Your overlap library has many more applications than you might imagine :) I'd like to use it in the data science world which is Python dominated. Is it possible to provide a compiled version of this as a Python package? There are things like pybind that will automatically generate Python bindings from your header file.

I have 0 experience on the C++ side but would be interested to help you out wherever I can on the Python side, testing, packaging etc!

wrong area calculated for tetra-sphere intersection

Hello, I was testing the code and I have found that for the following set of inputs, the area calculated is wrong (even negative).

#include <iostream>
#include "../overlap.hpp"

int main(void) {
    // Sphere data:
    double radius = 0.25;
    vector_t center { 0.5, 0.5, 1.0 };
    Sphere sphere{ center, radius };

    // Tetrahedron vertices.
    vector_t node0 { 0.807798, 0.649062, 1.072417 };
    vector_t node1 { 0.804911, 0.511303, 0.962443 };
    vector_t node2 { 0.687459, 0.655182, 0.976268 };
    vector_t node3 { 0.681356, 0.534586, 1.056372 };
    Tetrahedron tetra{ node0, node1, node2, node3 };
    
    auto intersect_area = overlapArea(sphere, tetra);
  
    for (auto& area: intersect_area) {
        std::cout << area << std::endl;
    }
}

The expected value for the sphere section is around 0.0065m² but the output from the function is -0.160697m², the area of the tetrahedron face sections also does not match the expected data.

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.