Library/Graphics/Points

From Athile

Jump to:navigation, search

Contents


Overview

A point is position in space. In a 3-dimensional world, a point is usually 3-tuple of x, y, and z coordinates.

Differentiating Points and Vectors

A graphics API may choose to distinguish between a point and vector class. Although the structures are both 3-tuples of the same layout and members, their usage can vary. For example, interpolating between two points and interpolating between two vectors often requires different algorithms to result in smooth, natural looking interpolation. Likewise, transforming a point versus a normal vector at that point (both 3-tuples) by a transformation matrix requires different algorithms. Differentiating the types in the compiler can help prevent inadvertent misuse of the algorithms.

On the other hand, additional classes and differentiation can add complexity and detail that is not strictly necessary to the system.

Interface

Functions


Extended Functions

Variations

2D points

Even in a 3D world, there are many instances were a 2D position is meaningful: for example, the coordinate on a the surface of a 3-dimensional object can be represented by a 2D point.

4-tuples

A point may be represented by a 4-tuple with a w component as well. Useful for clip space / perpsective projection, etc. to be completed.

Navigation
Toolbox