diff --git a/Copyright.txt b/Copyright.txt index f7fabc9d..d617ae4d 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,3 +1,3 @@ -Copyright © 2022 Robert Marskars +Copyright © 2022 Robert Marskar See LICENSE for redistribution rights. diff --git a/Examples/Sphere/example.cpp b/Examples/Sphere/example.cpp index e8265751..7b4608b2 100644 --- a/Examples/Sphere/example.cpp +++ b/Examples/Sphere/example.cpp @@ -19,7 +19,6 @@ int main() { // Aliases for cutting down on typing. using BV = BoundingVolumes::AABBT; using Vec3 = Vec3T; - using Mesh = MeshT; using Face = FaceT; using slowSDF = SignedDistanceDcel; using fastSDF = SignedDistanceBVH; diff --git a/README.md b/README.md index d8cd92f0..899e0981 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,37 @@ EBGeometry ---------- -Support for signed-distance functions of tesselated surfaces. Used with embedded-boundary (EB) codes. +Support for signed-distance functions of tesselated surfaces. Used with embedded-boundary (EB) codes. + +EBGeometry is a compact code for creating signed distance functions from watertight 3D surface tesselations. +The surface mesh is stored in a doubly-connected edge list (DCEL), i.e. a half-edge data structure. +Since the distance to any feature (facet, edge, vertex) in a surface mesh is well defined, the distance to the mesh can be computed from any point in space. +Naively, this can be done by computing the shortest distance to every facet/edge/vertex in the surface mesh. +For computing the signed distance one needs to define a suitable normal vector for edges and vertices. + +EBGeometry provides bounding volume hierarchies (BVHs) for bounding geometric primitives in space. +The BVHs are tree structures which permit accelerated closest-point searches. +We point out that the BVHs in EBGeometry are shallow implementations without deep performance optimizations. +In the DCEL context the BVHs are used for bounding the facets on the surface mesh, but there are no fundamental limitations on which objects that can be bounded. +Querying the distance to the mesh through the BVH is much faster than directly computing the distance. +On average, if the mesh consists of N facets then a BVH has O(log(N)) complexity while a direct search has O(N) complexity. + +Requirements +------------ + +C++14 + +Usage +----- + +The library is header-only, simple make EBGeometry.hpp visible to your code and include it. +Examples are given in Examples. + +Caveats +------- + +EBGeometry takes, as input, a watertight and orientable surface. +Although EBGeometry will process grids that contain self-intersections, it does not warn about these, and the signed distance functions is not well-defined either. License ------- diff --git a/Source/EBGeometry_DcelFaceImplem.hpp b/Source/EBGeometry_DcelFaceImplem.hpp index fc3a8d12..c343b175 100644 --- a/Source/EBGeometry_DcelFaceImplem.hpp +++ b/Source/EBGeometry_DcelFaceImplem.hpp @@ -99,7 +99,7 @@ namespace Dcel { // This computes the area of any N-side polygon. const auto vertices = this->gatherVertices(); - for (int i = 0; i < vertices.size() - 1; i++){ + for (unsigned int i = 0; i < vertices.size() - 1; i++){ const auto& v1 = vertices[i] ->getPosition(); const auto& v2 = vertices[i+1]->getPosition(); m_area += m_normal.dot(v2.cross(v1)); diff --git a/Source/EBGeometry_DcelParserImplem.hpp b/Source/EBGeometry_DcelParserImplem.hpp index a11182b6..7fdde155 100644 --- a/Source/EBGeometry_DcelParserImplem.hpp +++ b/Source/EBGeometry_DcelParserImplem.hpp @@ -192,7 +192,7 @@ namespace Dcel { // Associate next/previous for the half edges inside the current face. Wish we had a circular iterator // but this will have to do. - for (int i = 0; i < halfEdges.size(); i++){ + for (unsigned int i = 0; i < halfEdges.size(); i++){ auto& curEdge = halfEdges[i]; auto& nextEdge = halfEdges[(i+1)%halfEdges.size()];