Skip to content

Commit c8b2e64

Browse files
committed
Add missing interval from intervals constructor
Resolves #1014
1 parent 88bfa5e commit c8b2e64

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,23 @@
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 {
@@ -835,7 +850,6 @@
835850
};
836851
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
837852
[Listing [aabb-from-two-aabb]: <kbd>[aabb.h]</kbd> AABB constructor from two AABB inputs]
838-
</div>
839853

840854

841855
Creating Bounding Boxes of Lists of Objects

0 commit comments

Comments
 (0)