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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -672,3 +672,4 @@ python/update_bindings.py
tests/data
notebooks/*.png
CMakeGraphVizOptions.cmake
.zed/*
6 changes: 3 additions & 3 deletions docs/source/tutorials/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ The ``Candidates`` class represents the culled set of candidate pairs and is bui
#include <ipc/candidates/candidates.hpp>

ipc::Candidates candidates;
ipc::HashGrid broad_phase;
ipc::LBVH broad_phase;
candidates.build(
mesh, vertices_t0, vertices_t1, /*inflation_radius=*/0.0, broad_phase);

Expand All @@ -529,9 +529,9 @@ The ``Candidates`` class represents the culled set of candidate pairs and is bui

candidates = ipctk.Candidates()
candidates.build(
mesh, vertices_t0, vertices_t1, broad_phase=ipctk.HashGrid())
mesh, vertices_t0, vertices_t1, broad_phase=ipctk.LBVH())

Possible values for ``broad_phase`` are: ``BruteForce`` (parallel brute force culling), ``HashGrid`` (default), ``SpatialHash`` (implementation from the original IPC codebase), ``LBVH`` (CPU implementation of :cite:t:`Karras2012HPG` using TBB), ``SweepAndPrune`` (a.k.a. Sort-and-Sweep from :cite:t:`Baraff1992PhD`), or ``SweepAndTiniestQueue`` (method of :cite:t:`Belgrod2023Time`; requires CUDA).
Possible values for ``broad_phase`` are: ``BruteForce`` (parallel brute force culling), ``HashGrid``, ``SpatialHash`` (implementation from the original IPC codebase), ``LBVH`` (CPU implementation of :cite:t:`Karras2012HPG` using TBB), ``SweepAndPrune`` (a.k.a. Sort-and-Sweep from :cite:t:`Baraff1992PhD`), or ``SweepAndTiniestQueue`` (method of :cite:t:`Belgrod2023Time`; requires CUDA). The default is ``LBVH``.

Narrow-Phase
^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/broad_phase/default_broad_phase.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include <ipc/broad_phase/hash_grid.hpp>
#include <ipc/broad_phase/lbvh.hpp>

#include <memory>

namespace ipc {

inline std::unique_ptr<BroadPhase> make_default_broad_phase()
{
return std::make_unique<HashGrid>();
return std::make_unique<LBVH>();
}

} // namespace ipc
6 changes: 3 additions & 3 deletions src/ipc/broad_phase/lbvh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ void LBVH::detect_candidates(
void LBVH::detect_vertex_vertex_candidates(
std::vector<VertexVertexCandidate>& candidates) const
{
if (!has_vertices()) {
if (vertex_bvh.size() <= 1) { // Need at least 2 vertices for a collision
return;
}

Expand Down Expand Up @@ -690,7 +690,7 @@ void LBVH::detect_edge_vertex_candidates(
void LBVH::detect_edge_edge_candidates(
std::vector<EdgeEdgeCandidate>& candidates) const
{
if (!has_edges()) {
if (edge_bvh.size() <= 1) { // Need at least 2 edges for a collision
return;
}

Expand Down Expand Up @@ -734,7 +734,7 @@ void LBVH::detect_edge_face_candidates(
void LBVH::detect_face_face_candidates(
std::vector<FaceFaceCandidate>& candidates) const
{
if (!has_faces()) {
if (face_bvh.size() <= 1) { // Need at least 2 faces for a collision
return;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/src/tests/broad_phase/brute_force_comparison.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ void save_candidates(
bool load_candidates(const std::string& filename, ipc::Candidates& candidates)
{
std::ifstream f(filename);
if (!f)
if (!f) {
return false;
}

nlohmann::json in;
f >> in;
Expand Down
3 changes: 2 additions & 1 deletion tests/src/tests/potential/test_barrier_potential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ TEST_CASE(

double dhat = -1;
std::string mesh_name;
bool all_vertices_on_surface = true;
SECTION("cube")
{
dhat = sqrt(2.0);
Expand Down Expand Up @@ -210,6 +209,8 @@ TEST_CASE(
< dhat * dhat);
}

REQUIRE(vertices.size() > 0);

const CollisionMesh mesh(vertices, edges, faces);

NormalCollisions collisions;
Expand Down