pub fn jarvis_march<O, T>(
points: &[Point2<T>],
voxel_size: Option<O>,
) -> Option<Vec<Point2<T>>>where
O: AsPrimitive<isize> + ComplexField + Copy + Real,
T: AsPrimitive<O> + NumAssign + PartialOrd + Scalar,
usize: AsPrimitive<T>,
Expand description
Computes the convex hull of a set of points using the Jarvis March algorithm. This algorithm uses a pivot point to find the next point in the convex hull by selecting for each point, the point which makes the largest outwards turn that is less than 180 degrees.
§Arguments
points
- A slice of points to compute the convex hull ofvoxel_size
- An optional parameter specifying the voxel size by which to downsample the point cloud before computing the convex hull, useful in reducing errors due to close or identical vertices.
§Genericsoc -
O
- The output type of the trigonometric functions, essentially the precision of the calculationsT
- The type of the points, can be of any scalar type
§Returns
An Option
of Vec<Point2<T>>
representing the convex hull, or None
if there were not enough points to compute a convex hull, or if all points are collinear