Jamoma API  0.6.0.a19
hull2D.h File Reference

Compute convex hulls in 2 dimensions. More...

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
+ Include dependency graph for hull2D.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define NEW(p, type)   if ((p=(type *) malloc (sizeof(type))) == NULL) {exit(EXIT_FAILURE);}


typedef double t_xy[2]
 Data structures to store a 2 dimensional convex hull.

Detailed Description

Compute convex hulls in 2 dimensions.

This code is described in "Computational Geometry in C" (Second Edition), Chapter 3. It is not written to be comprehensible without the explanation in that book.

Input: 2n integer coordinates of points in the plane. Output: the convex hull, cw, in PostScript; other output precedes the PS.

NB: The original array storing the points is overwritten.

Compile: gcc -o graham graham.c (or simply: make)

Written by Joseph O'Rourke. Last modified: October 1997 Questions to orour.nosp@m.ke@c.nosp@m.s.smi.nosp@m.th.e.nosp@m.du.

Joseph O'Rourke

Definition in file hull2D.h.