[][src]Struct svgbob::Cell

pub struct Cell {
    pub x: i32,
    pub y: i32,
}
This example is not tested
     0 1 2 3 4           B C D
    0┌─┬─┬─┬─┐        A┌─┬─┬─┬─┐E
    1├─┼─┼─┼─┤         │ │ │ │ │
    2├─┼─┼─┼─┤        F├─G─H─I─┤J
    3├─┼─┼─┼─┤         │ │ │ │ │
    4├─┼─┼─┼─┤        K├─L─M─N─┤O
    5├─┼─┼─┼─┤         │ │ │ │ │
    6├─┼─┼─┼─┤        P├─Q─R─S─┤T
    7├─┼─┼─┼─┤         │ │ │ │ │
    8└─┴─┴─┴─┘        U└─┴─┴─┴─┘Y
```                      V W X
A single element in the terminal that
can fit 1 character.
Describe the exact location of a point/subcell in a grid.

Fields

x: i32y: i32

Methods

impl Cell[src]

pub fn a(&self) -> Point[src]

The point at sepcific cell grid of this cell

pub fn b(&self) -> Point[src]

pub fn c(&self) -> Point[src]

pub fn d(&self) -> Point[src]

pub fn e(&self) -> Point[src]

pub fn f(&self) -> Point[src]

pub fn g(&self) -> Point[src]

pub fn h(&self) -> Point[src]

pub fn i(&self) -> Point[src]

pub fn j(&self) -> Point[src]

pub fn k(&self) -> Point[src]

pub fn l(&self) -> Point[src]

pub fn m(&self) -> Point[src]

pub fn n(&self) -> Point[src]

pub fn o(&self) -> Point[src]

pub fn p(&self) -> Point[src]

pub fn q(&self) -> Point[src]

pub fn r(&self) -> Point[src]

pub fn s(&self) -> Point[src]

pub fn t(&self) -> Point[src]

pub fn u(&self) -> Point[src]

pub fn v(&self) -> Point[src]

pub fn w(&self) -> Point[src]

pub fn x(&self) -> Point[src]

pub fn y(&self) -> Point[src]

pub fn new(x: i32, y: i32) -> Self[src]

pub fn is_adjacent(&self, other: &Self) -> bool[src]

returns true if the other cell is at: top_left, top, top_right, left, right, bottom_left, bottom, bottom_right of self

pub fn snap_point(point: Point) -> (Self, Point)[src]

Derive which cell this points falls into and snap the point closes to any intersection in the cell grid. FIXME: need to find a way to snap a group of point that lies in boundaries to snap together to a common cell.

pub fn snap_group(points: &[Point]) -> Self[src]

pub fn top_left_most(&self) -> Point[src]

The point at the top right of this cell

pub fn bottom_right_most(&self) -> Point[src]

pub fn localize_point(&self, point: Point) -> Point[src]

turn point into relative distance from the top-left of this cell by simply deducting the point p with this cell's top_left_most point

pub fn localize_cell(&self, cell: Cell) -> Cell[src]

pub fn width() -> f32[src]

pub fn height() -> f32[src]

pub fn unit(l: i32) -> f32[src]

pub fn is_intersected(&self, start: Point, end: Point) -> bool[src]

test whether this cell is intersected with the line segment with point start and end

pub fn is_bounded(&self, bound1: Cell, bound2: Cell) -> bool[src]

check if this cell is bounded by the lower bound and upper bound

pub fn snap(p: Point) -> Point[src]

snap point to a closest intersection of this cellgrid

pub fn clip_line_snap(&self, start: Point, end: Point) -> Option<(Point, Point)>[src]

pub fn clip_line_localize(
    &self,
    start: Point,
    end: Point
) -> Option<(Point, Point)>
[src]

clip line then localize the points and snap to the nearest cell grid intersection

pub fn top_left(&self) -> Self[src]

The cell at the top left of this cell

pub fn top(&self) -> Self[src]

pub fn top_right(&self) -> Self[src]

pub fn left(&self) -> Self[src]

The cell at the left of this cell

pub fn right(&self) -> Self[src]

pub fn bottom_left(&self) -> Self[src]

pub fn bottom(&self) -> Self[src]

pub fn bottom_right(&self) -> Self[src]

Trait Implementations

impl Clone for Cell[src]

impl Copy for Cell[src]

impl Debug for Cell[src]

impl Display for Cell[src]

impl Eq for Cell[src]

impl Hash for Cell[src]

impl Ord for Cell[src]

impl PartialEq<Cell> for Cell[src]

impl PartialOrd<Cell> for Cell[src]

impl StructuralPartialEq for Cell[src]

Auto Trait Implementations

impl RefUnwindSafe for Cell

impl Send for Cell

impl Sync for Cell

impl Unpin for Cell

impl UnwindSafe for Cell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<N> NodeTrait for N where
    N: Copy + Ord + Hash
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.