pub struct Vector3<S> {
pub x: S,
pub y: S,
pub z: S,
}
Construct a new vector, using the provided values.
Negate this vector in-place (multiply by -1).
Component-wise casting to another type
Operations specific to numeric three-dimensional vectors.
A unit vector in the x
direction.
A unit vector in the y
direction.
A unit vector in the w
direction.
Returns the cross product of the vector and other
.
Create a Vector4
, using the x
, y
and z
values from this vector, and the
provided w
.
Create a Vector2
, dropping the z
value.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The resulting type after applying the +
operator.
The sum of the elements of the array.
The product of the elements of the array.
The minimum element of the array.
The maximum element of the array.
Get the pointer to the first element of the array.
Get a mutable pointer to the first element of the array.
Swap the elements at indices i
and j
in-place.
Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Deserialize a value using a Decoder
.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
The resulting type after applying the /
operator.
Serialize a value using an Encoder
.
The angle between the vector and other
, in radians.
Returns true
if the vector is perpendicular (at right angles) to the
other vector.
Returns the squared length of the vector. This does not perform an
expensive square root operation like in the length
method and can
therefore be more efficient for comparing the lengths of two vectors.
The norm of the vector.
Returns a vector with the same direction, but with a length
(or
norm
) of 1
.
Returns a vector with the same direction and a given length
.
Returns the result of linarly interpolating the length of the vector
towards the length of other
by the specified amount.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The returned type after indexing.
Performs the indexing (
container[index]
) operation.
Read more
The returned type after indexing.
Performs the indexing (
container[index]
) operation.
Read more
The returned type after indexing.
Performs the indexing (
container[index]
) operation.
Read more
The returned type after indexing.
Performs the indexing (
container[index]
) operation.
Read more
The returned type after indexing.
Performs the indexing (
container[index]
) operation.
Read more
Performs the mutable indexing (
container[index]
) operation.
Read more
Performs the mutable indexing (
container[index]
) operation.
Read more
Performs the mutable indexing (
container[index]
) operation.
Read more
Performs the mutable indexing (
container[index]
) operation.
Read more
Performs the mutable indexing (
container[index]
) operation.
Read more
Converts this type into the (usually inferred) input type.
Converts this type into the (usually inferred) input type.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the *
operator.
The resulting type after applying the -
operator.
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.
Generates a random instance of this type using the specified source of
randomness.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the %
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The resulting type after applying the -
operator.
The associated scalar.
Construct a vector from a single value, replicating it.
Vector dot product
The additive identity vector. Adding this vector with another has no effect.
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.