Skip to content

Commit 22dd645

Browse files
committed
fix(BoundingBox): allow extension
1 parent 984400a commit 22dd645

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/geode/geometry/bounding_box.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ namespace geode
5757

5858
void add_point( const Point< dimension >& point );
5959

60+
void extends( double length );
61+
6062
bool contains( const Point< dimension >& point ) const;
6163

6264
[[nodiscard]] bool intersects(

src/geode/geometry/bounding_box.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ namespace geode
176176
}
177177
}
178178

179+
template < index_t dimension >
180+
void BoundingBox< dimension >::extends( double length )
181+
{
182+
for( const auto i : LRange{ dimension } )
183+
{
184+
min_.set_value( i, min_.value( i ) - length );
185+
max_.set_value( i, max_.value( i ) + length );
186+
}
187+
}
188+
179189
template < index_t dimension >
180190
void BoundingBox< dimension >::add_box(
181191
const BoundingBox< dimension >& box )

0 commit comments

Comments
 (0)