Trianglemeshdistance

Header only, single file, simple and efficient C++11 library to compute the signed distance function (SDF) to a triangle mesh
Alternatives To Trianglemeshdistance
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Graphics2,70831a month ago25December 03, 2021147apache-2.0Python
TensorFlow Graphics: Differentiable Graphics Layers for TensorFlow
Yocto Gl2,590
a month ago9C++
Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics
Glitter2,237
4 months ago17CMake
Dead Simple OpenGL
Three Mesh Bvh1,7588714 days ago36June 20, 202266mitJavaScript
A BVH implementation to speed up raycasting and enable spatial queries against three.js meshes.
Three Gpu Pathtracer950
14 days ago5July 16, 2022107mitJavaScript
Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
Gltfast916
20 days ago114apache-2.0C#
Efficient glTF 3D import / export package for Unity
Fauxgl615113 years agoJune 10, 20218mitGo
Software-only 3D renderer written in Go.
Texturepanner598
a year ago2mitC#
This repository hosts a shader for Unity3D whose main goal is to facilitate the creation of neon-like signs, conveyor belts and basically whatever based on scrolling textures
Mesh Processing Library540
2 months agomitC++
C++ libraries and programs demonstrating mesh processing research published in ACM SIGGRAPH (1992-1998)
Cuda_voxelizer426
2 months ago9mitC++
CUDA Voxelizer to convert polygon meshes into annotated voxel grids
Alternatives To Trianglemeshdistance
Select To Compare


Alternative Project Comparisons
Readme

TriangleMeshDistance

Header only, single file, simple and efficient C++11 library to compute the signed distance function (SDF) to a triangle mesh.

The distance computation to the triangle collection is accelerated with a sphere bounding volume hierarchy. The sign of the distance is resolved with the method presented in "Generating Signed Distance Fields From Triangle Meshes" by Brentzen, Andreas & Aans, Henrik. (2002).

Assuming triangle normals point outwards from the enclosed volume, the sign of the distance will be positive outside and negative inside.

Example

// Declare mesh vertices and triangles
std::vector<std::array<double, 3>> vertices;
std::vector<std::array<int, 3>> triangles;

// (... fill the `vertices` and `triangles` with the mesh data ...)

// Initialize TriangleMeshDistance
tmd::TriangleMeshDistance mesh_distance(vertices, triangles);

// Query TriangleMeshDistance
tmd::Result result = mesh_distance.signed_distance({ x, y, z });

// Print result
std::cout << "Signed distance: " << result.distance << std::endl;
std::cout << "Nearest point: " << result.nearest_point << std::endl;
std::cout << "Nearest entity: " << result.nearest_entity << std::endl;
std::cout << "Nearest triangle index: " << result.triangle_id << std::endl;

What you need to know about TriangleMeshDistance

  • The input triangle mesh must be fully connected and watertight. Triangle soups and meshes with holes will return the correct distance but the sign will be undefined.
  • Triangle winding (consistent normals orientation) is not verified. The input mesh is required to have consistent normals.
  • TriangleMeshDistance keeps a copy of the vertex and triangle data.
  • The pseudonormals required to compute signed distances are calculated and stored at building time.
  • TriangleMeshDistance can be declared empty and constructed multiple times with different meshes. If the new mesh needs less memory than the curent one, memory allocations will be avoided.

Projects using TriangleMeshDistance

  • 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.
  • PBD - A C++ library for physically-based simulation of rigid bodies, deformables, cloth and fluids using Position-Based Dynamics.
  • SPlisHSPlasH - A C++ library for the physically-based simulation of fluids using Smoothed Particle Hydrodynamics.
Popular Mesh Projects
Popular Graphics Projects
Popular Graphics Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
C Plus Plus
Graphics
Mesh
Geometry
Collision Detection