pub unsafe extern "C" fn tg_ring_nearest_segment(
ring: *const tg_ring,
rect_dist: extern "C" fn(rect: tg_rect, more: *mut c_int, udata: *mut c_void) -> c_double,
seg_dist: extern "C" fn(seg: tg_segment, more: *mut c_int, udata: *mut c_void) -> c_double,
iter: extern "C" fn(seg: tg_segment, dist: c_double, index: c_int, udata: *mut c_void) -> bool,
udata: *mut c_void,
) -> boolExpand description
Iterates over segments from nearest to farthest.
This is a kNN operation.
The caller must provide their own “rect_dist” and “seg_dist” callbacks to do the actual distance calculations.
@param ring Input ring
@param rect_dist Callback that returns the distance to a tg_rect.
@param seg_dist Callback that returns the distance to a tg_segment.
@param iter Callback that returns each segment in the ring in order of nearest to farthest. Caller must return true to continue to the next segment, or return false to stop iterating.
@param udata User-defined data
@return True if operation succeeded, false if out of memory.
@note Though not typical, this operation may need to allocate memory.
It’s recommended to check the return value for success.
@note The *more argument is an optional ref-value that is used for
performing partial step-based or probability-based calculations. A detailed
description of its use is outside the scope of this document. Ignoring it
altogether is the preferred behavior.