[−][src]Struct bevy_math::Vec3A
Implementations
impl Vec3A
[src]
pub fn new(x: f32, y: f32, z: f32) -> Vec3A
[src]
Creates a new Vec3A
.
pub const fn zero() -> Vec3A
[src]
Creates a Vec3A
with all elements set to 0.0
.
pub const fn one() -> Vec3A
[src]
Creates a Vec3A
with all elements set to 1.0
.
pub const fn unit_x() -> Vec3A
[src]
Creates a Vec3A
with values [x: 1.0, y: 0.0, z: 0.0]
.
pub const fn unit_y() -> Vec3A
[src]
Creates a Vec3A
with values [x: 0.0, y: 1.0, z: 0.0]
.
pub const fn unit_z() -> Vec3A
[src]
Creates a Vec3A
with values [x: 0.0, y: 0.0, z: 1.0]
.
pub fn splat(v: f32) -> Vec3A
[src]
Creates a Vec3A
with all elements set to v
.
pub fn extend(self, w: f32) -> Vec4
[src]
Creates a Vec4
from self
and the given w
value.
pub fn truncate(self) -> Vec2
[src]
Creates a Vec2
from the x
and y
elements of self
, discarding z
.
Truncation may also be performed by using self.xy()
or Vec2::from()
.
pub fn dot(self, other: Vec3A) -> f32
[src]
Computes the dot product of self
and other
.
pub fn cross(self, other: Vec3A) -> Vec3A
[src]
Computes the cross product of self
and other
.
pub fn length(self) -> f32
[src]
Computes the length of self
.
pub fn length_squared(self) -> f32
[src]
Computes the squared length of self
.
This is generally faster than Vec3A::length()
as it avoids a square
root operation.
pub fn length_recip(self) -> f32
[src]
Computes 1.0 / Vec3A::length()
.
For valid results, self
must not be of length zero.
pub fn distance(self, other: Vec3A) -> f32
[src]
Computes the Euclidean distance between two points in space.
pub fn distance_squared(self, other: Vec3A) -> f32
[src]
Compute the squared euclidean distance between two points in space.
pub fn normalize(self) -> Vec3A
[src]
Returns self
normalized to length 1.0.
For valid results, self
must not be of length zero.
pub fn min(self, other: Vec3A) -> Vec3A
[src]
Returns the vertical minimum of self
and other
.
In other words, this computes
[x: min(x1, x2), y: min(y1, y2), z: min(z1, z2)]
,
taking the minimum of each element individually.
pub fn max(self, other: Vec3A) -> Vec3A
[src]
Returns the vertical maximum of self
and other
.
In other words, this computes
[x: max(x1, x2), y: max(y1, y2), z: max(z1, z2)]
,
taking the maximum of each element individually.
pub fn min_element(self) -> f32
[src]
Returns the horizontal minimum of self
's elements.
In other words, this computes min(x, y, z)
.
pub fn max_element(self) -> f32
[src]
Returns the horizontal maximum of self
's elements.
In other words, this computes max(x, y, z)
.
pub fn cmpeq(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical ==
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 == x2, y1 == y2, z1 == z2, w1 == w2]
.
pub fn cmpne(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical !=
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 != x2, y1 != y2, z1 != z2, w1 != w2]
.
pub fn cmpge(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical >=
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 >= x2, y1 >= y2, z1 >= z2, w1 >= w2]
.
pub fn cmpgt(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical >
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 > x2, y1 > y2, z1 > z2, w1 > w2]
.
pub fn cmple(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical <=
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 <= x2, y1 <= y2, z1 <= z2, w1 <= w2]
.
pub fn cmplt(self, other: Vec3A) -> Vec3AMask
[src]
Performs a vertical <
comparison between self
and other
,
returning a Vec3AMask
of the results.
In other words, this computes [x1 < x2, y1 < y2, z1 < z2, w1 < w2]
.
pub fn from_slice_unaligned(slice: &[f32]) -> Vec3A
[src]
Creates a Vec3A
from the first four values in slice
.
Panics
Panics if slice
is less than three elements long.
pub fn write_to_slice_unaligned(self, slice: &mut [f32])
[src]
Writes the elements of self
to the first three elements in slice
.
Panics
Panics if slice
is less than three elements long.
pub fn abs(self) -> Vec3A
[src]
Returns a Vec3A
containing the absolute value of each element of self
.
pub fn round(self) -> Vec3A
[src]
Returns a Vec3A
containing the nearest integer to a number for each element of self
.
Round half-way cases away from 0.0.
pub fn floor(self) -> Vec3A
[src]
Returns a Vec3A
containing the largest integer less than or equal to a number for each
element of self
.
pub fn ceil(self) -> Vec3A
[src]
Returns a Vec3A
containing the smallest integer greater than or equal to a number for each
element of self
.
pub fn exp(self) -> Vec3A
[src]
Returns a Vec3A
containing e^self
(the exponential function) for each element of self
.
pub fn powf(self, n: f32) -> Vec3A
[src]
Returns a Vec3A
containing each element of self
raised to the power of n
.
pub fn is_nan_mask(self) -> Vec3AMask
[src]
Performs is_nan()
on each element of self, returning a Vec3AMask
of the results.
In other words, this computes [x.is_nan(), y.is_nan(), z.is_nan()]
.
pub fn signum(self) -> Vec3A
[src]
Returns a Vec3A
with elements representing the sign of self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
pub fn recip(self) -> Vec3A
[src]
Returns a Vec3A
containing the reciprocal 1.0/n
of each element of self
.
pub fn lerp(self, other: Vec3A, s: f32) -> Vec3A
[src]
Performs a linear interpolation between self
and other
based on
the value s
.
When s
is 0.0
, the result will be equal to self
. When s
is 1.0
, the result will be equal to other
.
pub fn is_normalized(self) -> bool
[src]
Returns whether self
of length 1.0
or not.
Uses a precision threshold of 1e-6
.
pub fn is_finite(self) -> bool
[src]
Returns true
if, and only if, all elements are finite.
If any element is either NaN
, positive or negative infinity, this will return false
.
pub fn is_nan(self) -> bool
[src]
Returns true
if any elements are NaN
.
pub fn abs_diff_eq(self, other: Vec3A, max_abs_diff: f32) -> bool
[src]
Returns true if the absolute difference of all elements between self
and other
is less than or equal to max_abs_diff
.
This can be used to compare if two Vec3A
's contain similar elements. It
works best when comparing with a known value. The max_abs_diff
that
should be used used depends on the values being compared against.
For more on floating point comparisons see https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
pub fn angle_between(self, other: Vec3A) -> f32
[src]
Returns the angle between two vectors, in radians.
The vectors do not need to be unit length, but this function does
perform a sqrt
.
Trait Implementations
impl Add<Vec3A> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the +
operator.
pub fn add(self, other: Vec3A) -> Vec3A
[src]
impl AddAssign<Vec3A> for Vec3A
[src]
pub fn add_assign(&mut self, other: Vec3A)
[src]
impl AsMut<[f32; 3]> for Vec3A
[src]
impl AsRef<[f32; 3]> for Vec3A
[src]
impl Clone for Vec3A
[src]
impl Copy for Vec3A
[src]
impl Debug for Vec3A
[src]
impl Default for Vec3A
[src]
impl Deref for Vec3A
[src]
type Target = XYZ
The resulting type after dereferencing.
pub fn deref(&self) -> &<Vec3A as Deref>::Target
[src]
impl DerefMut for Vec3A
[src]
impl<'de> Deserialize<'de> for Vec3A
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<Vec3A, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Vec3A, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Display for Vec3A
[src]
impl Div<Vec3A> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the /
operator.
pub fn div(self, other: Vec3A) -> Vec3A
[src]
impl Div<f32> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the /
operator.
pub fn div(self, other: f32) -> Vec3A
[src]
impl DivAssign<Vec3A> for Vec3A
[src]
pub fn div_assign(&mut self, other: Vec3A)
[src]
impl DivAssign<f32> for Vec3A
[src]
pub fn div_assign(&mut self, other: f32)
[src]
impl From<[f32; 3]> for Vec3A
[src]
impl From<(f32, f32, f32)> for Vec3A
[src]
impl From<Vec3> for Vec3A
[src]
impl From<Vec3A> for Vec2
[src]
pub fn from(v: Vec3A) -> Vec2
[src]
Creates a Vec2
from the x
and y
elements of the Vec3A
, discarding z
.
impl From<Vec3A> for Vec3
[src]
impl From<Vec4> for Vec3A
[src]
pub fn from(v: Vec4) -> Vec3A
[src]
Creates a Vec3
from the x
, y
and z
elements of the Vec4
, discarding z
.
On architectures where SIMD is supported such as SSE2 on x86_64 this conversion is a noop.
impl From<__m128> for Vec3A
[src]
impl Index<usize> for Vec3A
[src]
type Output = f32
The returned type after indexing.
pub fn index(&self, index: usize) -> &<Vec3A as Index<usize>>::Output
[src]
impl IndexMut<usize> for Vec3A
[src]
impl Mul<Vec3A> for Quat
[src]
type Output = Vec3A
The resulting type after applying the *
operator.
pub fn mul(self, other: Vec3A) -> <Quat as Mul<Vec3A>>::Output
[src]
impl Mul<Vec3A> for Mat3
[src]
type Output = Vec3A
The resulting type after applying the *
operator.
pub fn mul(self, other: Vec3A) -> Vec3A
[src]
impl Mul<Vec3A> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the *
operator.
pub fn mul(self, other: Vec3A) -> Vec3A
[src]
impl Mul<f32> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the *
operator.
pub fn mul(self, other: f32) -> Vec3A
[src]
impl MulAssign<Vec3A> for Vec3A
[src]
pub fn mul_assign(&mut self, other: Vec3A)
[src]
impl MulAssign<f32> for Vec3A
[src]
pub fn mul_assign(&mut self, other: f32)
[src]
impl Neg for Vec3A
[src]
impl PartialEq<Vec3A> for Vec3A
[src]
pub fn eq(&self, other: &Vec3A) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Vec3A> for Vec3A
[src]
pub fn partial_cmp(&self, other: &Vec3A) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> Product<&'a Vec3A> for Vec3A
[src]
impl Serialize for Vec3A
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl Sub<Vec3A> for Vec3A
[src]
type Output = Vec3A
The resulting type after applying the -
operator.
pub fn sub(self, other: Vec3A) -> Vec3A
[src]
impl SubAssign<Vec3A> for Vec3A
[src]
pub fn sub_assign(&mut self, other: Vec3A)
[src]
impl<'a> Sum<&'a Vec3A> for Vec3A
[src]
impl Vec3ASwizzles for Vec3A
[src]
pub fn xxxx(self) -> Vec4
[src]
pub fn xxxy(self) -> Vec4
[src]
pub fn xxxz(self) -> Vec4
[src]
pub fn xxyx(self) -> Vec4
[src]
pub fn xxyy(self) -> Vec4
[src]
pub fn xxyz(self) -> Vec4
[src]
pub fn xxzx(self) -> Vec4
[src]
pub fn xxzy(self) -> Vec4
[src]
pub fn xxzz(self) -> Vec4
[src]
pub fn xyxx(self) -> Vec4
[src]
pub fn xyxy(self) -> Vec4
[src]
pub fn xyxz(self) -> Vec4
[src]
pub fn xyyx(self) -> Vec4
[src]
pub fn xyyy(self) -> Vec4
[src]
pub fn xyyz(self) -> Vec4
[src]
pub fn xyzx(self) -> Vec4
[src]
pub fn xyzy(self) -> Vec4
[src]
pub fn xyzz(self) -> Vec4
[src]
pub fn xzxx(self) -> Vec4
[src]
pub fn xzxy(self) -> Vec4
[src]
pub fn xzxz(self) -> Vec4
[src]
pub fn xzyx(self) -> Vec4
[src]
pub fn xzyy(self) -> Vec4
[src]
pub fn xzyz(self) -> Vec4
[src]
pub fn xzzx(self) -> Vec4
[src]
pub fn xzzy(self) -> Vec4
[src]
pub fn xzzz(self) -> Vec4
[src]
pub fn yxxx(self) -> Vec4
[src]
pub fn yxxy(self) -> Vec4
[src]
pub fn yxxz(self) -> Vec4
[src]
pub fn yxyx(self) -> Vec4
[src]
pub fn yxyy(self) -> Vec4
[src]
pub fn yxyz(self) -> Vec4
[src]
pub fn yxzx(self) -> Vec4
[src]
pub fn yxzy(self) -> Vec4
[src]
pub fn yxzz(self) -> Vec4
[src]
pub fn yyxx(self) -> Vec4
[src]
pub fn yyxy(self) -> Vec4
[src]
pub fn yyxz(self) -> Vec4
[src]
pub fn yyyx(self) -> Vec4
[src]
pub fn yyyy(self) -> Vec4
[src]
pub fn yyyz(self) -> Vec4
[src]
pub fn yyzx(self) -> Vec4
[src]
pub fn yyzy(self) -> Vec4
[src]
pub fn yyzz(self) -> Vec4
[src]
pub fn yzxx(self) -> Vec4
[src]
pub fn yzxy(self) -> Vec4
[src]
pub fn yzxz(self) -> Vec4
[src]
pub fn yzyx(self) -> Vec4
[src]
pub fn yzyy(self) -> Vec4
[src]
pub fn yzyz(self) -> Vec4
[src]
pub fn yzzx(self) -> Vec4
[src]
pub fn yzzy(self) -> Vec4
[src]
pub fn yzzz(self) -> Vec4
[src]
pub fn zxxx(self) -> Vec4
[src]
pub fn zxxy(self) -> Vec4
[src]
pub fn zxxz(self) -> Vec4
[src]
pub fn zxyx(self) -> Vec4
[src]
pub fn zxyy(self) -> Vec4
[src]
pub fn zxyz(self) -> Vec4
[src]
pub fn zxzx(self) -> Vec4
[src]
pub fn zxzy(self) -> Vec4
[src]
pub fn zxzz(self) -> Vec4
[src]
pub fn zyxx(self) -> Vec4
[src]
pub fn zyxy(self) -> Vec4
[src]
pub fn zyxz(self) -> Vec4
[src]
pub fn zyyx(self) -> Vec4
[src]
pub fn zyyy(self) -> Vec4
[src]
pub fn zyyz(self) -> Vec4
[src]
pub fn zyzx(self) -> Vec4
[src]
pub fn zyzy(self) -> Vec4
[src]
pub fn zyzz(self) -> Vec4
[src]
pub fn zzxx(self) -> Vec4
[src]
pub fn zzxy(self) -> Vec4
[src]
pub fn zzxz(self) -> Vec4
[src]
pub fn zzyx(self) -> Vec4
[src]
pub fn zzyy(self) -> Vec4
[src]
pub fn zzyz(self) -> Vec4
[src]
pub fn zzzx(self) -> Vec4
[src]
pub fn zzzy(self) -> Vec4
[src]
pub fn zzzz(self) -> Vec4
[src]
pub fn xxx(self) -> Vec3A
[src]
pub fn xxy(self) -> Vec3A
[src]
pub fn xxz(self) -> Vec3A
[src]
pub fn xyx(self) -> Vec3A
[src]
pub fn xyy(self) -> Vec3A
[src]
pub fn xzx(self) -> Vec3A
[src]
pub fn xzy(self) -> Vec3A
[src]
pub fn xzz(self) -> Vec3A
[src]
pub fn yxx(self) -> Vec3A
[src]
pub fn yxy(self) -> Vec3A
[src]
pub fn yxz(self) -> Vec3A
[src]
pub fn yyx(self) -> Vec3A
[src]
pub fn yyy(self) -> Vec3A
[src]
pub fn yyz(self) -> Vec3A
[src]
pub fn yzx(self) -> Vec3A
[src]
pub fn yzy(self) -> Vec3A
[src]
pub fn yzz(self) -> Vec3A
[src]
pub fn zxx(self) -> Vec3A
[src]
pub fn zxy(self) -> Vec3A
[src]
pub fn zxz(self) -> Vec3A
[src]
pub fn zyx(self) -> Vec3A
[src]
pub fn zyy(self) -> Vec3A
[src]
pub fn zyz(self) -> Vec3A
[src]
pub fn zzx(self) -> Vec3A
[src]
pub fn zzy(self) -> Vec3A
[src]
pub fn zzz(self) -> Vec3A
[src]
pub fn xx(self) -> Vec2
[src]
pub fn xy(self) -> Vec2
[src]
pub fn xz(self) -> Vec2
[src]
pub fn yx(self) -> Vec2
[src]
pub fn yy(self) -> Vec2
[src]
pub fn yz(self) -> Vec2
[src]
pub fn zx(self) -> Vec2
[src]
pub fn zy(self) -> Vec2
[src]
pub fn zz(self) -> Vec2
[src]
Auto Trait Implementations
impl RefUnwindSafe for Vec3A
[src]
impl Send for Vec3A
[src]
impl Sync for Vec3A
[src]
impl Unpin for Vec3A
[src]
impl UnwindSafe for Vec3A
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Component for T where
T: 'static + Send + Sync,
T: 'static + Send + Sync,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> FromResources for T where
T: Default,
T: Default,
pub fn from_resources(_resources: &Resources) -> T
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Resource for T where
T: 'static + Send + Sync,
T: 'static + Send + Sync,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
T: Serialize + ?Sized,
pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
[src]
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
[src]
T: 'static + Send + Sync + Clone,
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,