Skip to content

Concepts

tesla33io edited this page Aug 23, 2024 · 5 revisions

CORE CONCEPTS

Ray

Ray (3D vector): A ray in 3D space is defined by two components: an origin and a direction. The origin is the starting point of the ray, often representing the position of the camera or the point where the ray is cast from. The direction is a 3D vector that indicates the path along which the ray travels.

Unlike a line, which extends infinitely in both directions, a ray extends infinitely in only one direction from its origin.

Mathematically, a ray can be expressed as:

$$\mathbf{P}(t) = \mathbf{O} + t\mathbf{D}$$

where $t \geq 0$ is a parameter that scales the direction vector $\mathbf{D}$. Here, $\mathbf{P}(t)$ gives the position of a point along the ray.

3D vector (Ray)

Sphere

Sphere - is a set of points in 3D space that are all at the same distance, called the radius ($r$), from a central point known as the sphere's origin or center.

Mathematically, a point $(x, y, z)$ lies on the surface of a sphere if it satisfies the equation:

$$(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 = r^2$$

is inside a sphere if:

$$(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 < r^2$$

and is outside a sphere if:

$$(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 > r^2$$

where $(x_0, y_0, z_0)$ are the coordinates of the sphere's origin, and $r$ is the radius.

Camera

near_plane and far_plane - determine the zone, objects within which would be rendered, objects outside are ignored

Near and Far Planes


OnUpdate(time_t ts) - function that will control movement of the camera independent of frame-rate.

OnResize(int nw, int nh) - function that will control re-rendering of the image on resize event.

BONUS CONCEPTS

ABOVE AND BEYOND CONCEPTS

  • Ray Marching

Clone this wiki locally