openrndr / orx

A growing library of assorted data structures, algorithms and utilities for OPENRNDR
https://openrndr.org
BSD 2-Clause "Simplified" License
119 stars 35 forks source link

[orx-triangulation] Fix typo in convex hull computation #291

Closed Yvee1 closed 1 year ago

Yvee1 commented 1 year ago

Issue

Index out of bounds exception when calling hull()

Explanation and fix

The 2 * h is left from before refactoring by Edwin when an array was indexed where x and y coordinates of points were stored as two consecutive Doubles in an array. Then 2 * h gave the x-coordinate and 2 * h + 1 gave the y-coordinate. Now, an array storing Vector2s is used, so to retrieve the point one should index simply by h.