pub struct RectPacker<T>where
    T: NumAssign + Scalar + PartialOrd + Copy,
{ /* private fields */ }
Expand description

See module docs.

Implementations§

Creates new instance of rectangle packer with given bounds.

How to choose bounds

If you have a set of rectangles and you need to calculate average side length of a square, then calculate total area of your triangles by sum of width*height and then take square root out of area. You’ll get side length of a square which can be used as width and height parameters.

Clears packer and prepares it for another run. It is much cheaper than create new packer, because it reuses previously allocated memory.

Tries to find free place to put rectangle with given size. Returns None if there insufficient space.

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
Casts self to a &dyn Any

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
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.