Source codes/GLUT OpenGL(R) programs for the
"Visual Computing: Geometry, Graphics, and Vision" book:


Go back to the Visual Computing Book web page (there are many more command-line programs!).
Source code Snapshot(s)
Line Segment Intersection Detection (Shamos-Hoey algorithm)
(ShamosHoey.cpp source code)

Sweep-line paradigm for detecting whether a set of line segments intersect or not in optimal O(n log n) time
Geometric Traits Class
(traits-geometrykernel.cpp source code)

Geometric traits class are useful for encapsulating the geometric kernel and the predicates of algorithms. This code computes the convex hull of a point set using Andrew's algorithm (traits adapted from the class notes of Lutz Kettner). (This code is not robust. See chapter Robustness for more.)
Segment Intersection (Projective Geometry)
(segmentintersection-projective.cpp source code)

Compute the potential intersection point of two line segments using the cross-product: cross-product for defining supporting lines and cross-product of the line vectors for determining the intersection projective point
2D Polygon Transformations
(PolygonTransform.cpp source code)

2D polygon transformations (rotations, symmetries, shears, etc.)
3D Transformations
(3dtransformations.cpp source code)

3D mesh transformations (rotations, symmetries, shears, etc.). Require the Stanford bunny mesh in the include file bunny.h.
Isometric Projection
(isometricprojection.cpp source code)

Choosing the view direction and hence the projection plane for getting an isometric projection of cube(s).
Several Viewports
(openglviewport.cpp source code)

Render several views onto a same device display using viewport mappings.
Color RGB Cube
(colorcube.cpp source code)

Display the RGB color cube
Osculating Circle
(osculatingcircle.cpp source code)

An interactive demo of osculating circles used to define a parametric curve curvature.
Sphere Subdivision
(spheresubdivision.cpp source code)

Approximating the sphere by a subdivision mesh. Start from the icosahedron base mesh and iteratively refine the subdivision.
SLERP interpolation
(slerp.cpp source code)

Interactive demo of the spherical linear interpolation (SLERP) scheme.
Clustering by k-Means
(kmeans.cpp source code)

Implementation of the k-means iterative clusteriing method of Lloyd (vector quantization).
Orientation Predicate
(Orient2D.cpp source code)

Graphical interactive illustration of the geometric predicate Orient2D.
Segment Intersection Predicate
(segmentintersection-primitive.cpp source code)

Define the predicate that answers true if and only if two line segments intersect. The predicate uses only Orient2D orientation tests.
Updated December 2005, (c) Frank Nielsen.