Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::QuickHull Class Reference

QuickHull convex hull algorithm. More...

#include <geom_algorithms.H>

Public Member Functions

Polygon operator() (DynList< Point > &point_set)
 Compute the convex hull of a point set.
 

Private Member Functions

Point get_fartest_point (DynList< Point > &point_set, const Segment &s)
 
std::pair< DynList< Point >, DynList< Point > > get_right_points (DynList< Point > &point_set, const Point &a, const Point &b, const Point &c)
 
DynList< Pointquick_hull (DynList< Point > &point_set, const Point &a, const Point &b)
 
std::pair< Point, Pointsearch_extremes (DynList< Point > &point_set)
 
std::pair< DynList< Point >, DynList< Point > > partition (DynList< Point > &point_set, const Point &a, const Point &b)
 

Detailed Description

QuickHull convex hull algorithm.

Computes the convex hull using a divide-and-conquer approach similar to QuickSort. Recursively finds the farthest point from a line and partitions the remaining points.

Algorithm

  1. Find leftmost and rightmost points (guaranteed on hull)
  2. Partition points into those above and below the line
  3. For each partition, find the farthest point from the line
  4. Recursively process the sub-partitions

Complexity

  • Time: O(n log n) average, O(n²) worst case
  • Space: O(n) for recursive calls

Use Cases

  • General-purpose convex hull computation
  • Large point sets
  • When average-case performance matters more than worst-case
Author
Alejandro J. Mujica

Definition at line 586 of file geom_algorithms.H.

Member Function Documentation

◆ get_fartest_point()

Point Aleph::QuickHull::get_fartest_point ( DynList< Point > &  point_set,
const Segment s 
)
inlineprivate

◆ get_right_points()

std::pair< DynList< Point >, DynList< Point > > Aleph::QuickHull::get_right_points ( DynList< Point > &  point_set,
const Point a,
const Point b,
const Point c 
)
inlineprivate

◆ operator()()

Polygon Aleph::QuickHull::operator() ( DynList< Point > &  point_set)
inline

Compute the convex hull of a point set.

Parameters
point_setThe input points.
Returns
A closed polygon representing the convex hull.

Definition at line 699 of file geom_algorithms.H.

References Aleph::DynList< T >::append(), Aleph::HTList::concat(), Aleph::HTList::Iterator::has_curr(), Aleph::maps(), partition(), quick_hull(), and search_extremes().

◆ partition()

std::pair< DynList< Point >, DynList< Point > > Aleph::QuickHull::partition ( DynList< Point > &  point_set,
const Point a,
const Point b 
)
inlineprivate

◆ quick_hull()

DynList< Point > Aleph::QuickHull::quick_hull ( DynList< Point > &  point_set,
const Point a,
const Point b 
)
inlineprivate

◆ search_extremes()

std::pair< Point, Point > Aleph::QuickHull::search_extremes ( DynList< Point > &  point_set)
inlineprivate

The documentation for this class was generated from the following file: