Skip to content

Commit a55058a

Browse files
committed
Apply prepare changes
1 parent 59e3f59 commit a55058a

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

include/geode/geometry/detail/aabb_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ namespace geode
458458

459459
// The acceleration is here:
460460
if( !node( node_index1 )
461-
.intersects( other_tree.impl_->node( node_index2 ) ) )
461+
.intersects( other_tree.impl_->node( node_index2 ) ) )
462462
{
463463
return false;
464464
}

src/geode/mesh/helpers/ray_tracing.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ namespace geode
254254
{
255255
distance *= -1.;
256256
}
257+
std::lock_guard< std::mutex > lock{ mutex_ };
257258
results_.emplace_back( polygon_id, distance, result.second,
258259
std::move( intersection_result ) );
259260
}
@@ -272,6 +273,7 @@ namespace geode
272273
{
273274
distance *= -1.;
274275
}
276+
std::lock_guard< std::mutex > lock{ mutex_ };
275277
results_.emplace_back( polygon_id, distance,
276278
result.second, std::move( point ) );
277279
}
@@ -304,6 +306,7 @@ namespace geode
304306
DEBUG_CONST OwnerSegment3D segment_;
305307
mutable std::vector< PolygonDistance > results_;
306308
mutable bool are_results_sorted_{ false };
309+
std::mutex mutex_;
307310
};
308311

309312
RayTracing3D::RayTracing3D( const SurfaceMesh3D& mesh, const Ray3D& ray )

tests/geometry/test-aabb.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ class BoxAABBIntersection
187187
}
188188
bool operator()( geode::index_t box1, geode::index_t box2 )
189189
{
190-
DEBUG( "operator()" );
191190
if( box_contains_box( box1, box2 ) )
192191
{
193192
std::lock_guard< std::mutex > lock( mutex_ );
@@ -417,8 +416,6 @@ void test_self_intersections()
417416
eval_intersection.included_box_.clear();
418417
aabb.compute_self_element_bbox_intersections( eval_intersection );
419418

420-
DEBUG( eval_intersection.included_box_.size() );
421-
DEBUG( nb_boxes * nb_boxes );
422419
OPENGEODE_EXCEPTION(
423420
eval_intersection.included_box_.size() == nb_boxes * nb_boxes,
424421
"[Test] Box self intersection - Every box should have one box "
@@ -438,12 +435,14 @@ class OtherAABBIntersection
438435
public:
439436
bool operator()( geode::index_t box1, geode::index_t box2 )
440437
{
438+
std::lock_guard< std::mutex > lock( mutex_ );
441439
included_box_.push_back( { box1, box2 } );
442440
return false;
443441
}
444442

445443
public:
446444
std::vector< std::pair< geode::index_t, geode::index_t > > included_box_;
445+
std::mutex mutex_;
447446
};
448447

449448
template < geode::index_t dimension >

tests/mesh/test-ray-tracing.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
void test_ray_inside()
3737
{
38+
geode::Logger::info( "Test ray inside" );
3839
auto mesh = geode::SurfaceMesh3D::create();
3940
auto builder = geode::SurfaceMeshBuilder3D::create( *mesh );
4041
builder->create_point( geode::Point3D{ { -1, -1, 1 } } );
@@ -62,26 +63,27 @@ void test_ray_inside()
6263

6364
void test_ray_edge()
6465
{
66+
geode::Logger::info( "Test ray edge" );
6567
auto mesh = geode::SurfaceMesh3D::create();
6668
auto builder = geode::SurfaceMeshBuilder3D::create( *mesh );
6769
builder->create_point( geode::Point3D{ { 1, -1, 0 } } );
6870
builder->create_point( geode::Point3D{ { 1, 1, 0 } } );
69-
builder->create_point( geode::Point3D{ { 1, 0, 1 } } );
71+
builder->create_point( geode::Point3D{ { 1, 0, -1 } } );
7072
builder->create_point( geode::Point3D{ { 1, 0, 3 } } );
7173
builder->create_polygon( { 0, 1, 2 } );
7274
builder->create_polygon( { 1, 0, 3 } );
7375
builder->compute_polygon_adjacencies();
7476

7577
const auto aabb = geode::create_aabb_tree( *mesh );
7678
const geode::Vector3D direction{ { 1, 0, 0 } };
77-
const geode::Point3D origin{ { 0, 0, 0 } };
79+
const geode::Point3D origin{ { 0, 0, 1 } };
7880
const geode::Ray3D ray{ direction, origin };
7981
geode::RayTracing3D tracing{ *mesh, ray };
8082
aabb.compute_ray_element_bbox_intersections( ray, tracing );
8183
const auto result = tracing.closest_polygon();
8284
OPENGEODE_EXCEPTION( result, "[Test] Ray edge no result" );
8385
OPENGEODE_EXCEPTION(
84-
result->polygon == 0, "[Test] Ray edge wrong polygon" );
86+
result->polygon == 1, "[Test] Ray edge wrong polygon" );
8587
OPENGEODE_EXCEPTION(
8688
result->distance == 1, "[Test] Ray edge wrong distance" );
8789
OPENGEODE_EXCEPTION( tracing.all_intersections().size() == 1,
@@ -90,6 +92,7 @@ void test_ray_edge()
9092

9193
void test_ray_parallel()
9294
{
95+
geode::Logger::info( "Test ray parallel" );
9396
auto mesh = geode::SurfaceMesh3D::create();
9497
auto builder = geode::SurfaceMeshBuilder3D::create( *mesh );
9598
builder->create_point( geode::Point3D{ { -1, -1, 0 } } );

0 commit comments

Comments
 (0)