aboutsummaryrefslogtreecommitdiff
path: root/src/transformable.rs
blob: b8212f946e018acd3a372f03631bdd4ce05a5d22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Traits for items that can be modified using a variety of matrix transformations.
//!
//! Items in the world may be resizable or rotateable etc. in a variety of different ways. This
//! module contains the traits that are used to interact with such objects in a way, that ensures the
//! item is not transformed illegaly. For example, an item may be scaleable by a factor, but that does
//! not necessarily mean that it can be scaled by different factors in x and y direction (stretched).
//! If need be, this module contains the different types of transformations and transformation
//! restrictions to make these features available and restricting them reliably.

use nalgebra::Matrix3;

/// Trait for things that can be stretched and rotated etc. as one pleases without
/// becoming invalid. A room for instance would fall into this category, while an icon might not.
pub trait NonRigidTransformable {
    /// Applies the provided matrix to all vertices of this transformable element.
    fn apply_matrix(&mut self, matrix: &Matrix3<f64>);
}