[−][src]Struct graphics::deform::DeformGrid
Represents a deformed grid.
Fields
cols: usizeThe number of columns in the grid.
rows: usizeThe number of rows in the grid.
rect: [Scalar; 4]The grid undeformed, which is a plain rectangle.
vertices: Vec<Vec2d>The vertices, deformed.
indices: Vec<usize>The triangle indices.
texture_coords: Vec<[f32; 2]>The texture coordinates.
ps: Vec<[Scalar; 2]>Initial position of control points.
qs: Vec<[Scalar; 2]>The current position of control points.
wis: Vec<Scalar>A weight computation buffer, one for each control point.
Methods
impl DeformGrid[src]
impl DeformGridpub fn new(rect: Rectangle, cols: usize, rows: usize) -> DeformGrid | [src] |
Creates a new DeformGrid.
pub fn set_current(&mut self, i: usize, pos: Vec2d) | [src] |
Sets current control position.
pub fn set_original(&mut self, i: usize, pos: Vec2d) | [src] |
Sets original control position.
pub fn reset_control_points(&mut self) | [src] |
Removes all control points.
pub fn reset_vertices_and_texture_coords(&mut self) | [src] |
Sets vertices and texture coords back to default.
pub fn hit(&self, pos: Vec2d) -> Option<Vec2d> | [src] |
Finds original coordinate. If the deformed grid is overlapping itself, multiple hits might occur. Returns the first hit it finds.
pub fn draw_image<G>( | [src] |
Draws deformed image using default method.
pub fn draw_image_tri<G>( | [src] |
Draws deformed image using triangulation.
pub fn add_control_point(&mut self, pos: Vec2d) | [src] |
Adds a control point, in original coordinates.
pub fn draw_vertical_lines<G>( | [src] |
Draw vertical grid lines.
pub fn draw_horizontal_lines<G>( | [src] |
Draw horizontal grid lines.
pub fn update(&mut self) | [src] |
Updates the grid, by deforming the vertices.
Trait Implementations
impl Clone for DeformGrid[src]
impl Clone for DeformGridfn clone(&self) -> DeformGrid | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Send for DeformGrid
impl Send for DeformGridimpl Sync for DeformGrid
impl Sync for DeformGridBlanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T> From for T[src]
impl<T> From for Timpl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T | [src] |