trim_2D_hull - Removes redundant points from a 2D hull.


#include "h/h_misc.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

Hull *trim_2D_hull
	const Hull *hp,
	double tolerance


This routine creates a new hull, similar to the argument hull, but with redundant points removed. A point is considered redundant if removing the point does not change the hull too much. Slightly more specifically, it is considered redundant if it is almost colinear with two other vertices. The gory details are as follows.
    Let D be the distance between two vertices P1, P2.
    Consider some other vertex, V.
    Let the perpendicular distance from V to the segment P1--P2 be d.
    Then, the point is redundant if d/D < tolerance.
When a redundant point is found, then it is removed, and then the remaining points are considered as a group (without the removed ones). It would be faster to condider each point to be removed in the context of the complete set of vertices, but this could lead to all points being deleted. However, no effort is currently made to remove the "most" redundant point first. This may be a reasonable improvement to the routine.


A pointer to a new hull on success and NULL on failure.


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


get_interior_distance_to_hull , get_distance_to_hull , expand_hull , get_approximate_error_hull_data