Ring

Struct Ring 

Source
pub struct Ring { /* private fields */ }
Expand description

An owned closed ring.

Implementations§

Source§

impl Ring

Source

pub fn rect(&self) -> Rect

Source

pub fn num_points(&self) -> usize

Source

pub fn point_at(&self, index: usize) -> Option<Point>

Source

pub fn points(&self) -> &[Point]

Source

pub fn num_segments(&self) -> usize

Source

pub fn segment_at(&self, index: usize) -> Option<Segment>

Source

pub fn convex(&self) -> bool

Source

pub fn clockwise(&self) -> bool

Source

pub fn area(&self) -> f64

Source

pub fn perimeter(&self) -> f64

Source

pub fn nearest_segment<RD, SD, I>( &self, rect_dist: RD, seg_dist: SD, iter: I, ) -> bool
where RD: FnMut(Rect) -> (f64, bool), SD: FnMut(Segment) -> (f64, bool), I: FnMut(Segment, f64, usize) -> bool,

Iterates segments by distance. Returns true if completed.

Source

pub fn new(points: &[Point]) -> Result<Self>

Source

pub fn new_ix(points: &[Point], ix: IndexKind) -> Result<Self>

Source

pub unsafe fn from_raw(ptr: *mut tg_ring) -> Option<Self>

§Safety

The pointer must be valid and not owned elsewhere.

Source

pub fn as_ptr(&self) -> *const tg_ring

Source

pub fn into_raw(self) -> *mut tg_ring

Source

pub fn copy(&self) -> Result<Self>

Source

pub fn clone_ref(&self) -> Result<Self>

Source

pub fn memsize(&self) -> usize

Source

pub fn index_spread(&self) -> i32

Source

pub fn index_num_levels(&self) -> i32

Source

pub fn index_level_num_rects(&self, level: i32) -> i32

Source

pub fn index_level_rect(&self, level: i32, rect_idx: i32) -> Rect

Source

pub fn iter_points(&self) -> impl Iterator<Item = Point> + '_

Source

pub fn iter_segments(&self) -> impl Iterator<Item = Segment> + '_

Return false to stop iteration.

Return false to stop iteration.

Trait Implementations§

Source§

impl Debug for Ring

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Ring

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Ring

Source§

impl Sync for Ring

Auto Trait Implementations§

§

impl Freeze for Ring

§

impl RefUnwindSafe for Ring

§

impl Unpin for Ring

§

impl UnwindSafe for Ring

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.