IsohedralTiling

Struct IsohedralTiling 

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

Represents a particular isohedral tiling type.

Implementations§

Source§

impl IsohedralTiling

Source

pub fn new(ihtype: TilingType) -> Self

Create a new IsohedralTiling instance for the given tiling type. You can get a valid tiling type by using the get_tiling_type function.

Source

pub fn reset(&mut self, ihtype: TilingType)

Resets the current instance to describe the new given tiling type, and recomputes the internal state as necessary.

Source

pub fn tiling_type(&self) -> TilingType

§Accessors

The tiling type described by this instance.

Source

pub fn num_params(&self) -> usize

The number of parameters that can affect the shape of the prototile. Some tiling types have no parameters (i.e. the prototile is a fixed shape), others have up to 6 parameters.

Source

pub fn num_edge_shapes(&self) -> usize

The number of different edge shapes for the current tiling type’s prototile.

Source

pub fn num_vertices(&self) -> usize

The number of vertices that the current prototile has.

Source

pub fn edge_shape(&self, idx: usize) -> EdgeShape

Returns the shape of the given edge.

See num_edge_shapes for the valid range of values for idx.

Source

pub fn vertex(&self, idx: usize) -> &DVec2

Returns the vertex specified by idx.

See num_vertices for the valid range of values for idx.

Source

pub fn num_aspects(&self) -> usize

The number of aspects that the current tiling type has.

Source

pub fn aspect_transform(&self, idx: usize) -> &DMat3

Returns the aspect transformation matrix for the given aspect index.

See num_aspects for the valid range of values for idx.

Source

pub fn colour(&self, t1: isize, t2: isize, aspect: usize) -> u8

Computes a colour index used for tiling a region.

The return value can be 0, 1, 2, representing one of 3 possible colours. The parameters t1, t2, and aspect can be obtained while iterating over the tiles of a region. See [iterators::FillRegionIterator].

Source

pub fn t1(&self) -> &DVec2

The first translation vector.

Source

pub fn t2(&self) -> &DVec2

The second translation vector.

Source

pub fn shapes(&self) -> TilingShapeIterator<'_>

§Iterators

Iterate over all the edge shapes of the prototile.

Source

pub fn parts(&self) -> TilingShapePartIterator<'_>

Iterate over all the shape parts of the prototile.

Source

pub fn fill_region( &self, xmin: f64, ymin: f64, xmax: f64, ymax: f64, ) -> FillAlgorithm<'_>

Helper to fill a region of the plan with tiles.

The returned object can be turned into an iteretor where each element gives you the necessary transform to apply to the prototile.

Source

pub fn parameters(&self, params: &mut [f64; 6])

Return all the vertex parameters.

Note: not all tiling types have the same number of parameters. Only the first n values of the returned array are valid, where n is the value returned by [`#num_params].

Source

pub fn set_parameters(&mut self, params: &[f64; 6])

Set the vertex parameters.

See also: [#parameters]

Source

pub fn vertices(&self) -> &[DVec2]

Return the vertices for this prototile.

See also: [#parameters]

Trait Implementations§

Source§

impl Debug for IsohedralTiling

Source§

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

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

impl Default for IsohedralTiling

Source§

fn default() -> IsohedralTiling

Returns the “default value” for a type. Read more

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> 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 = Infallible

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

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

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.