Skip to main content

Module array

Module array 

Source
Expand description

Container utilities and vertex sequence types.

Port of agg_array.h and agg_vertex_sequence.h.

Most of AGG’s C++ containers (pod_vector, pod_array, pod_bvector) map directly to Rust’s Vec<T>. This module provides the algorithms and specialized types that don’t have direct Rust equivalents.

Structs§

VertexDist
A vertex with coordinates and the distance to the next vertex. Port of C++ vertex_dist.
VertexDistCmd
Like VertexDist but with an additional path command. Port of C++ vertex_dist_cmd.
VertexSequence
A sequence of vertices that automatically filters coincident points.

Constants§

QUICK_SORT_THRESHOLD
Threshold below which quicksort switches to insertion sort. Matches C++ quick_sort_threshold.

Functions§

binary_search_pos
Binary search for the insertion position of val in a sorted slice. Returns the index where val would be inserted to maintain sort order.
invert_container
Reverse the elements of a slice in place. Port of C++ invert_container.
quick_sort
Sort a mutable slice using AGG’s quicksort algorithm. Uses insertion sort for small partitions.
remove_duplicates
Remove duplicates from a sorted slice. Returns the number of remaining elements. The slice is modified in place (duplicates are overwritten, tail is unchanged).
shorten_path
Shorten a vertex sequence by removing s distance-units from the end.