Coder Social home page Coder Social logo

stubbiali / meshsimplification Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 212.43 MB

A C++ library implementing an edge collapse-based simplification routine for three-dimensional surface grids with distributed data

Makefile 0.05% R 0.08% C++ 83.01% CMake 1.80% C 2.03% Shell 0.17% Cuda 1.14% Fortran 11.50% Python 0.08% JavaScript 0.07% CSS 0.05% MATLAB 0.02%

meshsimplification's Introduction

An iterative simplification procedure for surface grids augmented with distributed data

For a detailed description of the method, please refer to:

[1] Dassi F., Ettinger B., Perotto S., Sangalli L. M. "A mesh simplification strategy for a spatial regression analysis over the cortical surface of the brain". Applied Numerical Mathematics 90:111-131, 2015.

C++ library

The main output is the meshsimplification library. The C++ code for the library, as well as that one for the applications and the tests, comes with the following folders:

  • include/ : header files for the meshsimplification library; even for template classes, declarations have been separated from implementations, with the former stored in include/implementation/ (for non inlined methods and functions) and include/inline/ (for inlined methods and functions);
  • src/ : source files for the meshsimplification library;
  • main/ : source files for the applications;
  • test/ : source files for the tests;
  • spike/ : extra code which may be useful in the future.

To compile the library libmeshsimplification.so and compile and link the applications using the GNU C++ compiler, from the project root folder type:

make [DEBUG=yes] [ENABLE_SELF_INTERSECTIONS=yes] [STATIC=yes] [EIGEN_DIR=<path>]

Square brackets delimit options and arguments to, respectively:

  • disable compile-time optimizations and enable debug symbols;
  • disable controls on grid self intersections throughout the simplification routine;
  • build and link against the static version of the meshsimplification library;
  • specify the path to the include directory of Eigen library. By default:
  • compile-time optimizations are enabled;
  • grid self-intersections are forbidden;
  • the executable are linked against the dynamic version of meshsimplification, which is built;
  • path to Eigen include directory is supposed to be specified by the environmental variable mkEigenInc, respectively. Please observe that Eigen is the only third-party library the code relies on. In case Eigen is not available on the current workstation, or the environmental variable mkEigenInc is not set, or the location specified by command line is incorrect, the header files provided in lib/Eigen are used for the compilation.

The aforementioned command generates the following folders:

  • build/ : object files for the static (build/static) and shared (build/dynamic) version of meshsimplification library, the executables (build/main) and the tests (build/test);
  • bin/ : binaries for the executables (bin/main) and the tests (bin/test). Furthermore, the meshsimplification library is placed in the lib/ folder.

To ease the usability of the library, three executables accepting options and arguments from command line are provided in the directory bin/main:

  • main_geo : perform the simplification procedure for a purely geometric mesh, i.e. a mesh without distributed data;

  • main_onlygeo : perform the simplification procedure for a mesh with distributed data; at each iteration, the selection of the edge to collapse derives from a purely geometric cost function (see Equation (3) in [1]);

  • main_datageo : perform the simplification procedure for a mesh augmented with distributed data; at each iteration, the selection of the edge to contract derives from an edge cost function accounting for both geometric and statistical properties of the mesh (see Equation (3),(4),(6),(7) in [1]). To get the list of available options and respective arguments for each executable, simply call the executable itself without any argument to print the help. For instance, to run the simplification routine on a pawn geometry, reducing the number of grid points from 2522 to 1000, and finally print the output grid to file, from the project root folder type:

    ./bin/main/main_datageo -i mesh/pawn.inp -n 1000 -o results/out_pawn.inp

where mesh/ contains some grids which may be input to the simplification routine, while results stores some simplified grids obtained through the meshsimplification library.

Other Makefile targets are:

  • folders : create output folders;
  • static : build the static meshsimplification library;
  • dynamic : build the shared meshsimplification library;
  • install : install the shared meshsimplification library; you may need root privileges;
  • test : compile and link tests executable;
  • main : compile and link applications;
  • doc : create code documentation through Doxygen and place it in doc/; the online documentation can then be accessed through doc/html/index.html.

Typing

make clean

from the current folder, the folders build/, bin/ and /doc and the compiled library meshsimplification get removed. To clean and disinstall the meshsimplification library, type

make distclean

Administrator access rights might be required.

R package

This project comes also with the R package MeshDataSimplification, wrapping the C++ library meshsimplification, thus providing a high-level access to its functionalities. The files for the package are placed in the folder RPackage/MeshDataSimplification; for further details, please refer to the README file therein.

meshsimplification's People

Stargazers

Jeffrey Castellano avatar Jinghao Hu avatar  avatar

Watchers

James Cloos avatar Stefano Ubbiali avatar

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.