Struct vek::geom::repr_c::Rect3

source ·
pub struct Rect3<P, E> {
    pub x: P,
    pub y: P,
    pub z: P,
    pub w: E,
    pub h: E,
    pub d: E,
}
Expand description

A Rect extended to 3D.

This would have been named Box, but it was “taken” by the standard library already.

You should probably use Aabb because it is less confusing. See also Rect for a short discussion on the topic.

Fields§

§x: P

X position of the bottom-left-near corner.

§y: P

Y position of the bottom-left-near corner.

§z: P

Z position of the bottom-left-near corner.

§w: E

Width.

§h: E

Height, with Y axis going upwards.

§d: E

Depth, with Z axis going forwards.

Implementations§

Creates a new rectangle from position elements and extent elements.

Gets this rectangle’s position.

Sets this rectangle’s position.

Gets this rectangle’s extent (size).

Sets this rectangle’s extent (size).

Gets this rectangle’s position and extent (size).

Returns this rectangle, converted with the given closures (one for position elements, the other for extent elements).

Converts this rectangle to a rectangle of another type, using the as conversion.

Converts this into the matching axis-aligned bounding shape representation.

Does this rectangle contain the given point ?

Does this rectangle fully contain the given one ?

Does this rectangle collide with another ?

Gets this rectangle’s center.

Returns this shape so that it contains the given point.

Expands this shape so that it contains the given point.

Gets the smallest rectangle that contains both this one and another.

Gets the largest rectangle contained by both this one and another.

Sets this rectangle to the union of itself with another.

Sets this rectangle to the intersection of itself with another.

Gets a vector that tells how much self penetrates other.

Splits this shape in two, by a straight plane along the x axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the x axis that is within this shape’s bounds.

Splits this shape in two, by a straight plane along the y axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the y axis that is within this shape’s bounds.

Splits this shape in two, by a straight plane along the z axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the z axis that is within this shape’s bounds.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. 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.