pub struct Ring { /* private fields */ }Expand description
An owned closed ring.
Implementations§
Source§impl Ring
impl Ring
pub fn rect(&self) -> Rect
pub fn num_points(&self) -> usize
pub fn point_at(&self, index: usize) -> Option<Point>
pub fn points(&self) -> &[Point]
pub fn num_segments(&self) -> usize
pub fn segment_at(&self, index: usize) -> Option<Segment>
pub fn convex(&self) -> bool
pub fn clockwise(&self) -> bool
pub fn area(&self) -> f64
pub fn perimeter(&self) -> f64
Sourcepub fn nearest_segment<RD, SD, I>(
&self,
rect_dist: RD,
seg_dist: SD,
iter: I,
) -> bool
pub fn nearest_segment<RD, SD, I>( &self, rect_dist: RD, seg_dist: SD, iter: I, ) -> bool
Iterates segments by distance. Returns true if completed.
pub fn new(points: &[Point]) -> Result<Self>
pub fn new_ix(points: &[Point], ix: IndexKind) -> Result<Self>
Sourcepub unsafe fn from_raw(ptr: *mut tg_ring) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut tg_ring) -> Option<Self>
§Safety
The pointer must be valid and not owned elsewhere.
pub fn as_ptr(&self) -> *const tg_ring
pub fn into_raw(self) -> *mut tg_ring
pub fn copy(&self) -> Result<Self>
pub fn clone_ref(&self) -> Result<Self>
pub fn memsize(&self) -> usize
pub fn index_spread(&self) -> i32
pub fn index_num_levels(&self) -> i32
pub fn index_level_num_rects(&self, level: i32) -> i32
pub fn index_level_rect(&self, level: i32, rect_idx: i32) -> Rect
pub fn iter_points(&self) -> impl Iterator<Item = Point> + '_
pub fn iter_segments(&self) -> impl Iterator<Item = Segment> + '_
Sourcepub fn line_search<F>(&self, line: &Line, iter: F)
pub fn line_search<F>(&self, line: &Line, iter: F)
Return false to stop iteration.