Skip to main content

ObstacleLayoutHelper

Struct ObstacleLayoutHelper 

Source
pub struct ObstacleLayoutHelper;
Expand description

Geometry utilities for carving horizontal text slots from exclusion shapes.

Implementations§

Source§

impl ObstacleLayoutHelper

Source

pub fn carve_text_line_slots( base_slot: Interval, blocked: impl IntoIterator<Item = Interval>, min_slot_width: f64, ) -> Vec<Interval>

Carve all blocked intervals, then discard slots narrower than the minimum. The surviving intervals remain ordered from left to right.

Source

pub fn circle_interval_for_band( cx: f64, cy: f64, radius: f64, band_top: f64, band_bottom: f64, horizontal_padding: f64, vertical_padding: f64, ) -> Option<Interval>

The widest horizontal intersection of a circle with the entire line band. A tangent band has no occupied area and yields None.

Source

pub fn ellipse_interval_for_band( cx: f64, cy: f64, radius_x: f64, radius_y: f64, band_top: f64, band_bottom: f64, horizontal_padding: f64, vertical_padding: f64, ) -> Option<Interval>

Source

pub fn get_rect_intervals_for_band( rects: &[RectObstacle], band_top: f64, band_bottom: f64, horizontal_padding: f64, vertical_padding: f64, ) -> Vec<Interval>

Source

pub fn pick_slot( slots: &[Interval], prefer_right_on_tie: bool, ) -> Option<Interval>

Pick the widest usable slot and resolve equal widths by horizontal order. Empty inputs return None instead of indexing an absent first interval.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.