#[repr(C)]pub struct Vector4 {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
Expand description
Vector used for 4D math using floating point coordinates.
4-element structure that can be used to represent any quadruplet of numeric values.
It uses floating-point coordinates of 32-bit precision, unlike the engine’s float
type which
is always 64-bit. The engine can be compiled with the option precision=double
to use 64-bit
vectors; use the gdext library with the double-precision
feature in that case.
See Vector4i
for its integer counterpart.
Fields§
§x: f32
The vector’s X component.
y: f32
The vector’s Y component.
z: f32
The vector’s Z component.
w: f32
The vector’s W component.
Implementations§
§impl Vector4
impl Vector4
§impl Vector4
impl Vector4
pub fn normalized(self) -> Vector4
pub fn normalized(self) -> Vector4
Returns the vector scaled to unit length. Equivalent to self / self.length()
. See
also is_normalized()
.
If the vector is zero, the result is also zero.
§impl Vector4
impl Vector4
pub fn lerp(self, other: Vector4, weight: f32) -> Vector4
pub fn bezier_derivative( self, control_1: Vector4, control_2: Vector4, end: Vector4, t: f32 ) -> Vector4
pub fn bezier_interpolate( self, control_1: Vector4, control_2: Vector4, end: Vector4, t: f32 ) -> Vector4
pub fn cubic_interpolate( self, b: Vector4, pre_a: Vector4, post_b: Vector4, weight: f32 ) -> Vector4
pub fn cubic_interpolate_in_time( self, b: Vector4, pre_a: Vector4, post_b: Vector4, weight: f32, b_t: f32, pre_a_t: f32, post_b_t: f32 ) -> Vector4
pub fn is_zero_approx(self) -> bool
pub fn posmod(self, pmod: f32) -> Vector4
pub fn posmodv(self, modv: Vector4) -> Vector4
pub fn sign(self) -> Vector4
pub fn snapped(self, step: Vector4) -> Vector4
Trait Implementations§
§impl AddAssign for Vector4
impl AddAssign for Vector4
§fn add_assign(&mut self, rhs: Vector4)
fn add_assign(&mut self, rhs: Vector4)
+=
operation. Read more§impl DivAssign<f32> for Vector4
impl DivAssign<f32> for Vector4
§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/=
operation. Read more§impl DivAssign for Vector4
impl DivAssign for Vector4
§fn div_assign(&mut self, rhs: Vector4)
fn div_assign(&mut self, rhs: Vector4)
/=
operation. Read more§impl Export for Vector4
impl Export for Vector4
§fn default_export_info() -> PropertyHintInfo
fn default_export_info() -> PropertyHintInfo
§impl Extend<Vector4> for PackedVector4Array
impl Extend<Vector4> for PackedVector4Array
Extends aPackedVector4Array
with the contents of an iterator
§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Vector4>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Vector4>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl FromGodot for Vector4
impl FromGodot for Vector4
§fn try_from_godot(
via: <Vector4 as GodotConvert>::Via
) -> Result<Vector4, ConvertError>
fn try_from_godot( via: <Vector4 as GodotConvert>::Via ) -> Result<Vector4, ConvertError>
§fn from_godot(via: Self::Via) -> Self
fn from_godot(via: Self::Via) -> Self
§fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
Variant
.§fn from_variant(variant: &Variant) -> Self
fn from_variant(variant: &Variant) -> Self
§impl FromIterator<Vector4> for PackedVector4Array
impl FromIterator<Vector4> for PackedVector4Array
Creates a PackedVector4Array
from an iterator.
§fn from_iter<I>(iter: I) -> PackedVector4Arraywhere
I: IntoIterator<Item = Vector4>,
fn from_iter<I>(iter: I) -> PackedVector4Arraywhere
I: IntoIterator<Item = Vector4>,
§impl GodotConvert for Vector4
impl GodotConvert for Vector4
§impl Index<Vector4Axis> for Vector4
impl Index<Vector4Axis> for Vector4
§impl IndexMut<Vector4Axis> for Vector4
impl IndexMut<Vector4Axis> for Vector4
§fn index_mut(&mut self, axis: Vector4Axis) -> &mut f32
fn index_mut(&mut self, axis: Vector4Axis) -> &mut f32
container[index]
) operation. Read more§impl Mul<Vector4> for Projection
impl Mul<Vector4> for Projection
§impl MulAssign<f32> for Vector4
impl MulAssign<f32> for Vector4
§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*=
operation. Read more§impl MulAssign for Vector4
impl MulAssign for Vector4
§fn mul_assign(&mut self, rhs: Vector4)
fn mul_assign(&mut self, rhs: Vector4)
*=
operation. Read more§impl SubAssign for Vector4
impl SubAssign for Vector4
§fn sub_assign(&mut self, rhs: Vector4)
fn sub_assign(&mut self, rhs: Vector4)
-=
operation. Read more