File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
include/geode/geometry/basic_objects
src/geode/geometry/basic_objects Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 2828
2929namespace geode
3030{
31+ FORWARD_DECLARATION_DIMENSION_CLASS ( BoundingBox );
32+ FORWARD_DECLARATION_DIMENSION_CLASS ( Frame );
3133 FORWARD_DECLARATION_DIMENSION_CLASS ( OwnerEllipse );
3234 FORWARD_DECLARATION_DIMENSION_CLASS ( Point );
33- FORWARD_DECLARATION_DIMENSION_CLASS ( Frame );
3435
3536 template < index_t dimension >
3637 using RefPoint = std::reference_wrapper< const Point< dimension > >;
@@ -60,6 +61,7 @@ namespace geode
6061
6162 [[nodiscard]] const Point< dimension >& center () const ;
6263 [[nodiscard]] const Frame< dimension >& axes () const ;
64+ [[nodiscard]] BoundingBox< dimension > bounding_box () const ;
6365
6466 private:
6567 PointType center_;
Original file line number Diff line number Diff line change @@ -63,6 +63,22 @@ namespace geode
6363 return axes_;
6464 }
6565
66+ template < typename PointType, typename FrameType, index_t dimension >
67+ BoundingBox< dimension >
68+ GenericEllipse< PointType, FrameType, dimension >::bounding_box() const
69+ {
70+ BoundingBox< dimension > bbox;
71+ const Point< dimension >& point = center_;
72+ const Frame< dimension >& axes = axes_;
73+ for ( const auto d : LRange{ dimension } )
74+ {
75+ const auto & axe = axes.direction ( d );
76+ bbox.add_point ( point + axe );
77+ bbox.add_point ( point - axe );
78+ }
79+ return bbox;
80+ }
81+
6682 template < index_t dimension >
6783 OwnerEllipse< dimension >::OwnerEllipse(
6884 Point< dimension > center, Frame< dimension > axes )
You can’t perform that action at this time.
0 commit comments