Function nalgebra::cast
[−]
[src]
pub fn cast<T, U: Cast<T>>(t: T) -> U
Converts an object from one type to another.
For primitive types, this is the same as the as
keywords.
The following properties are preserved by a cast:
- Type-level geometric invariants cannot be broken (eg. a cast from Rotation3
to Rotation3 is not possible) - A cast to a type with more type-level invariants cannot be done (eg. a cast from Matrix
to Rotation3 is not possible) - For primitive types an unbounded cast is done using the
as
keyword (this is different from the standard library which makes bound-checking to ensure eg. that a i64 is not out of the range of an i32 when a cast from i64 to i32 is done). - A cast does not affect the dimension of an algebraic object. Note that this prevents an
isometric transform to be cast to a raw matrix. Use
to_homogeneous
for that special purpose.