Shapes

Back to PastelGeometry

A shape is a closed and simply connected subset of ''RR^n''.

Theory

A shape ''S'' is called convex, if it holds that

''A, B in S => forall t in [0, 1]: A + t(B - A) in S''.

A shape that is not convex is called concave. Shapes overlap if their intersection is non-empty.

Practice

Pastel implements various shapes, of which most are convex. The reason for this is that overlap testing between convex shapes is easier than between concave shapes.

Operator overloading

All shapes overload the operators +=, +, -=, and - to translate by a vector and the operators =, , /=, and / to scale by a real number. The scaling is always defined for a given shape so that it commutes with translation.

References

Geometric Tools for Computer Graphics, Philip J. Schneider, David Eberly, 2003.

Learn more

Axis-aligned box Plane
Axis-aligned plane Polygon
Capsule Ray
Ellipsoid Simplex
Flat Sphere
Line Sphere shape
Line segment Triangle
Oriented box

Files

An aggregate file for geometric shapes

shapes.h