discregrid

A static C++ library for the generation of discrete functions on a box-shaped domain. This is especially suited for the discretization of signed distance fields.

https://github.com/interactivecomputergraphics/discregrid

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    6 of 7 committers (85.7%) from academic institutions
  • Institutional organization owner
    Organization interactivecomputergraphics has institutional domain (animation.rwth-aachen.de)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.5%) to scientific vocabulary

Keywords

collision-detection discretization signed-distance-fields
Last synced: 6 months ago · JSON representation ·

Repository

A static C++ library for the generation of discrete functions on a box-shaped domain. This is especially suited for the discretization of signed distance fields.

Basic Info
  • Host: GitHub
  • Owner: InteractiveComputerGraphics
  • License: mit
  • Language: C++
  • Default Branch: master
  • Homepage:
  • Size: 11.7 MB
Statistics
  • Stars: 303
  • Watchers: 18
  • Forks: 66
  • Open Issues: 2
  • Releases: 0
Topics
collision-detection discretization signed-distance-fields
Created over 8 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

Discregrid

  

Figure 1: Left: Slice of a three-dimensional discrete signed distance field of the Stanford dragon. Right: Density map for SPH boundary handling of Stanford dragon.

Discregrid is a static C++ library for the parallel discretization of (preferably smooth) functions on regular grids. The library generates a (cubic) polynomial discretization given a box-shaped domain, a grid resolution, and a function that maps a three-dimensional position in space to a real scalar value. Isoparametric cubic polynomials of Serendipity type for the cell-wise discretization are employed. The coefficient vector for the discrete polynomial basis is computed using regular sampling of the input function at the higher-order grid's nodes. The algorithm to generate the discretization is moreover fully parallelized using OpenMP and especially well-suited for the discretization of signed distance functions. The library moreover provides the functionality to serialize and deserialize the a generated discrete grid. Discregrid ships with TriangleMeshDistance to directly provide the capability to compute and discretize signed distance fields to triangle meshes.

Besides the library, the project includes three executable programs that serve the following purposes: * GenerateSDF: Computes a discrete (cubic) signed distance field from a triangle mesh in OBJ format. * DiscreteFieldToBitmap: Generates an image in bitmap format of a two-dimensional slice of a previously computed discretization. * GenerateDensityMap: Generates a density map according to the approach presented in [KB17] from a previously generated discrete signed distance field using the widely adopted cubic spline kernel. The program can be easily extended to work with other kernel function by simply replacing the implementation in sph_kernel.hpp.

Author: Dan Koschier, License: MIT

Libraries using Discregrid

  • PBD - A C++ library for physically-based simulation of rigid bodies, deformables, cloth and fluids using Position-Based Dynamics. Discregrid is used to compute discrete signed distance fields of rigid objects for collision handling purposes.
  • SPlisHSPlasH - A C++ library for the physically-based simulation of fluids using Smoothed Particle Hydrodynamics. Discregrid is used to compute density maps according to my paper [KB17] for boundary handling.

Build Instructions

This project is based on CMake. Simply generate project, Makefiles, etc. using CMake and compile the project with the compiler of your choice. The code was tested with the following configurations: - Windows 10 64-bit, CMake 3.8, Visual Studio 2017 - Debian 9 64-bit, CMake 3.8, GCC 6.3.

Usage

In order to use the library, the main header has to be included and the static library has to be compiled and linked against the client program. In this regard a find script for CMake is provided, i.e. FindDiscregrid.cmake. The main header can be included as follows: ```c++

include

```

A base class for the data structure that generates and holds a discretization of a function f: R^3 -> R can be constructed as follows: c++ // Firstly, create a domain on which a discretization will be generated. Eigen::AlignedBox3d domain; // Then specify domain extents using e.g. domain.extend(...). // Secondly, specify a grid resolution. std::array<unsigned int, 3> resolution = {{10, 10, 10}} // Finally, instantiate the grid. Discregrid::CubicLagrangeDiscreteGrid discrete_grid(domain, resolution); Then, an arbitrary number of functions can be discretized on the initiated grid: ```c++ Discregrid::DiscreteGrid::ContinuousFunction func1 = ...; Discregrid::DiscreteGrid::ContinuousFunction func2 = ...;

auto dfindex1 = discretegrid.addFunction(func1); auto dfindex2 = discretegrid.addFunction(func2); Optionally, only coefficients at nodes fulfilling a certain predicate can be generated by specifying the predicate: c++ Discregrid::DiscreteGrid::ContinuousFunction func3 = ...; auto dfindex3 = discretegrid.addFunction(func3, false, & { ... // Return true if a certain criterion for the node location x is fulfilled, e.g. return x.y() > 0.0; }); A value of a discrete field can be evaluated by interpolation. Additionally, the gradient at the given query point can be computed if desired. c++ auto val1 = sdf->interpolate(dfindex1, {0.1, 0.2, 0.3}); Eigen::Vector3d grad2; auto val2 = sdf->interpolate(dfindex2, {0.3, 0.2, 0.1}, &grad2); ```

If a discretization of the input function is only required in certain regions of the given domain, the discretization can be reduced resulting in a sparsely populated grid to save memory: c++ discrete_grid.reduce_field(df_index1, [](Eigen::Vector3d const& x, double v) { // E.g. return x.x() < 0.0 && v > 0.0; }); Here x represents the location of sample point in the grid and v represents the sampled value of the input function. If the predicated function evaluates to true the sample point is kept but discarded otherwise.

Optionally, the data structure can be serialized and deserialized via c++ discrete_grid.save(filename); discrete_grid.load(filename); // or discrete_grid = Discregrid::CubicLagrangeDiscreteGrid(filename);

Citation

To cite DiscreGrid you can use this BibTeX entry:

bibtex @software{Discregrid_Library, author = {Koschier, Dan and others}, license = {MIT}, title = {{Discregrid Library}}, url = {https://github.com/InteractiveComputerGraphics/Discregrid} }

References

  • [KDBB17] D. Koschier, C. Deul, M. Brand and J. Bender, 2017. "An hp-Adaptive Discretization Algorithm for Signed Distance Field Generation", IEEE Transactions on Visualiztion and Computer Graphics 23, 10, 2208-2221.
  • [KB17] D. Koschier and J. Bender, 2017. "Density Maps for Improved SPH Boundary Handling", ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 1-10.

Owner

  • Name: Interactive Computer Graphics
  • Login: InteractiveComputerGraphics
  • Kind: organization
  • Location: Germany

Citation (CITATION.cff)

cff-version: 1.2.0
title: Discregrid Library
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Dan
    family-names: Koschier
  - family-names: others
identifiers:
  - type: url
    value: >-
      https://github.com/InteractiveComputerGraphics/Discregrid
repository-code: >-
  https://github.com/InteractiveComputerGraphics/Discregrid
keywords:
  - Signed Distance Fields
  - discretization
license: MIT

GitHub Events

Total
  • Watch event: 13
  • Fork event: 3
Last Year
  • Watch event: 13
  • Fork event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 29
  • Total Committers: 7
  • Avg Commits per committer: 4.143
  • Development Distribution Score (DDS): 0.414
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jan Bender b****r@c****e 17
Jose Antonio Fernandez Fernandez j****r@g****m 3
Tassilo Kugelstadt k****t@c****e 2
Stefan Jeske s****e@r****e 2
Dan Koschier k****r@g****e 2
Dan Koschier k****r@c****e 2
ruberith r****r@r****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 19
  • Total pull requests: 7
  • Average time to close issues: 3 months
  • Average time to close pull requests: 5 months
  • Total issue authors: 14
  • Total pull request authors: 6
  • Average comments per issue: 2.58
  • Average comments per pull request: 1.14
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • FallenCastle (3)
  • Rouen007 (3)
  • vijaiaeroastro (1)
  • cesss (1)
  • zhangcogito (1)
  • FantasyVR (1)
  • heshijiu (1)
  • lasagnaphil (1)
  • medakk (1)
  • lyd405121 (1)
  • wghou (1)
  • Gornhoth (1)
  • kisu2511 (1)
Pull Request Authors
  • digitalillusions (2)
  • ManosAgelidis (1)
  • Gornhoth (1)
  • andipeer (1)
  • ruberith (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/build-linux.yml actions
  • actions/checkout v1 composite
.github/workflows/build-windows.yml actions
  • actions/checkout v1 composite