Skip to main content

TilePattern

Trait TilePattern 

Source
pub trait TilePattern {
    type Offset;
    type Diagonal;

    // Required methods
    fn is_legal(&self, offset: &Self::Offset, to: &Self) -> bool;
    fn is_legal_diagonal(&self, offset: &Self::Diagonal, to: &Self) -> bool;
}
Expand description

For the purposes of autotiling, tiles are represented by patterns that hold the data which determines whether two tiles are permitted to appear adjacent to each other. Therefore autotile algorithms place patterns rather than tiles, and translating those patterns into actual tiles is a later step.

Required Associated Types§

Source

type Offset

A pattern is capable of being adjacent to other patterns in several directions. The pattern’s offset type is the type of the offset between a pattern’s position and the position of an adjacent pattern.

Source

type Diagonal

A pattern may connect to another pattern by touching their corners. This creates a diagonal connection where the patterns are touching but not adjacent, and in some contexts there may be rules regarding which patterns may be diagonally connected to which other patterns.

Required Methods§

True if this pattern may be adjacent the given other pattern of this type when that other pattern is positioned at offset relative to this pattern.

True if this pattern may be diagonal to the given other pattern when that other pattern is positioned at offset relative to this pattern.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§