Struct graphics::deform::DeformGrid

source ·
pub struct DeformGrid {
    pub cols: usize,
    pub rows: usize,
    pub rect: [Scalar; 4],
    pub vertices: Vec<Vec2d>,
    pub indices: Vec<usize>,
    pub texture_coords: Vec<[f32; 2]>,
    pub ps: Vec<[Scalar; 2]>,
    pub qs: Vec<[Scalar; 2]>,
    pub wis: Vec<Scalar>,
}
Expand description

Represents a deformed grid.

Fields

cols: usize

The number of columns in the grid.

rows: usize

The 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.

Implementations

Creates a new DeformGrid.

Sets current control position.

Sets original control position.

Removes all control points.

Sets vertices and texture coords back to default.

Finds original coordinate. If the deformed grid is overlapping itself, multiple hits might occur. Returns the first hit it finds.

Draws deformed image using default method.

Draws deformed image using triangulation.

Adds a control point, in original coordinates.

Draw vertical grid lines.

Draw horizontal grid lines.

Updates the grid, by deforming the vertices.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.