Skip to content

Instantly share code, notes, and snippets.

View stohrendorf's full-sized avatar
🔍
Curious

Steffen Ohrendorf stohrendorf

🔍
Curious
View GitHub Profile
"""
This is based on https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm,
with the requirement that the maximum norm is used for distance calculations.
The algorithm is as follows, described for R^2, but it is easily extensible to
arbitrary dimensions >2:
- given points p_1, ..., p_n, we start by constructing our funnel
by calculating
dp_1 = (p_2 - p_1)
x_1_top = (dp_1_y + epsilon) / dp_1_x