Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Copyright.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Copyright © 2022 Robert Marskars
Copyright © 2022 Robert Marskar

See LICENSE for redistribution rights.
1 change: 0 additions & 1 deletion Examples/Sphere/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ int main() {
// Aliases for cutting down on typing.
using BV = BoundingVolumes::AABBT<precision>;
using Vec3 = Vec3T<precision>;
using Mesh = MeshT<precision>;
using Face = FaceT<precision>;
using slowSDF = SignedDistanceDcel<precision>;
using fastSDF = SignedDistanceBVH<precision, BV, K>;
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
-------
Expand Down
2 changes: 1 addition & 1 deletion Source/EBGeometry_DcelFaceImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion Source/EBGeometry_DcelParserImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()];

Expand Down