Skip to content

Commit 01727d3

Browse files
committed
Add missing changes to quad PDF code
1 parent 4cd4480 commit 01727d3

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

books/RayTracingTheRestOfYourLife.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,21 @@
26032603
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
26042604
class quad : public hittable {
26052605
public:
2606+
quad(const point3& _Q, const vec3& _u, const vec3& _v, shared_ptr<material> m)
2607+
: Q(_Q), u(_u), v(_v), mat(m)
2608+
{
2609+
auto n = cross(u, v);
2610+
normal = unit_vector(n);
2611+
D = -dot(normal, Q);
2612+
w = n / dot(n,n);
2613+
2614+
2615+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
2616+
area = n.length();
2617+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2618+
2619+
set_bounding_box();
2620+
}
26062621
...
26072622

26082623

@@ -2623,7 +2638,18 @@
26232638
return p - origin;
26242639
}
26252640
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2626-
...
2641+
2642+
protected:
2643+
point3 Q;
2644+
vec3 u, v;
2645+
shared_ptr<material> mat;
2646+
vec3 normal;
2647+
double D;
2648+
vec3 w;
2649+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
2650+
double area;
2651+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2652+
aabb bbox;
26272653
};
26282654
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26292655
[Listing [quad-pdf]: <kbd>[quad.h]</kbd> quad with pdf]

0 commit comments

Comments
 (0)