## Basic Shape Interface

All shapes are defined in coordinate space,in order to place them to world space,a transformation must be provided.
Shapes take parameter *reverseOrientation* to indicates their surface normal direction,and store *SwapHandedness* for their object-to-world transformation.

### Bounding

As the render process is often expensive,it’s useful to have a 3D bounding volume that encloses the object,which can avoid process things the volumes didn’t evolved.

Here use axis-aligned bounding boxes,which require six floating-point values to store,and the render provides two methods:

- ObjectBound():returns a bounding box in shape’s object space.
- WorldBound():returns a bounding box in world space.
Note:The default implementation of the WorldBound() is just to transform the object space bounding box to world space,but it’s sometimes sloppy,and it could be better if first transform then fit the bounding box.

### Ray-Bounds Intersections

### Intersection Tests

Few important things about intersection routines:

- Ray::tMax defines the endpoint of the ray,intersection should ignore any intersections that occur after this point.
- If there are multiple intersections along the ray, the closest one should be reported.
- The rays passed into intersection routines are in world space, so shapes are responsible for transforming them to object space if needed for intersection tests. The intersection information returned should be in world space.

### Sidedness

Many rendering system,paricularly those based on scan line or z-buffer algorithms,support the concept of “one-sided”–the shape is visible if seen from the front but disappears when viewd from behind.

## Spheres

A special case of quadrics. Describe as an implict function:

or can also be described parametrically using a function to map 2D points to 3D points on the surface. Like 2D spherical coordinates (θ, ϕ) as follow:

Commonly,we transform this function f (θ, ϕ) into a function f (u, v) over [0, 1]2 and also generalize it slightly to allow partial spheres that only sweep out θ ∈ [θmin, θmax] and ϕ ∈ [0, ϕmax]with the substitution

## Cylinders

Parametric form:

### Bounding:

The method computes a conservative bounding box using the z range but withut taking into account the maximum ϕ

## Disks

Parametric form:

### Bounding

A bounding box centered at the height of the disk along z,with extent of radius in both x and y directions.

### Surface Area

## Other Quadrics

Cones,paraboloids,hyperboloids,which was introduced more detail in http://www.pbr-book.org/3ed-2018/Shapes/Other_Quadrics.html