File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 817817 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
818818 [Listing [moving-sphere-bbox]: < kbd > [moving_sphere.h]</ kbd > Moving sphere with bounding box]
819819
820- < div class ='together '>
821- Now we need a new `aabb` constructor that takes two boxes as input:
820+ Now we need a new `aabb` constructor that takes two boxes as input.
821+ First, we'll add a new interval constructor that takes two intervals as input:
822+
823+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
824+ class interval {
825+ public:
826+ ...
827+
828+ interval(const interval& a, const interval& b)
829+ : min(fmin(a.min, b.min)), max(fmax(a.max, b.max)) {}
830+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
831+ [Listing [interval-from-intervals]: < kbd > [interval.h]</ kbd >
832+ Interval constructor from two intervals
833+ ]
834+
835+
836+ Now we can use this to construct an axis-aligned bounding box from two input boxes.
822837
823838 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
824839 class aabb {
835850 };
836851 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
837852 [Listing [aabb-from-two-aabb]: < kbd > [aabb.h]</ kbd > AABB constructor from two AABB inputs]
838- </ div >
839853
840854
841855Creating Bounding Boxes of Lists of Objects
You can’t perform that action at this time.
0 commit comments