Skip to content

Book 2 section "Interior Testing of The Intersection Using UV Coordinates": expand on alternative primitives #1205

@hollasch

Description

@hollasch

The current text reads like so:

Pause a bit here and consider that if you use the (α,β) coordinates to determine if a point lies inside a quadrilateral (parallelogram), it's not too hard to imagine using these same 2D coordinates to determine if the intersection point lies inside any other 2D (planar) primitive!

We'll leave these additional 2D shape possibilities as an exercise to the reader, depending on your desire to explore. Consider triangles, disks, and rings (all of these are surprisingly easy). You could even create cut-out stencils based on the pixels of a texture map, or a Mandelbrot shape!

We should flesh this out just a tiny bit more. Perhaps move this text after the next listing, and mention that one would only need to write a different is_interior(double a, double b, hit_record& rec) function that returns whether a given input coordinate (a,b) is inside the primitive. We might also supply the text describing how we'd do this for disks to get folks thinking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions