#[repr(C)]pub struct Vector3 {
pub x: f32,
pub y: f32,
pub z: f32,
}Fields§
§x: f32§y: f32§z: f32Implementations§
Source§impl Vector3
impl Vector3
Sourcepub const fn new(x: f32, y: f32, z: f32) -> Vector3
pub const fn new(x: f32, y: f32, z: f32) -> Vector3
Returns a new Vector3 with specified components.
pub fn up() -> Vector3
pub fn forward() -> Vector3
pub fn right() -> Vector3
pub fn left() -> Vector3
Sourcepub fn cross(&self, v: Vector3) -> Vector3
pub fn cross(&self, v: Vector3) -> Vector3
Returns a new Vector3 containing the cross product between self and vector v.
Sourcepub fn perpendicular(&self) -> Vector3
pub fn perpendicular(&self) -> Vector3
Returns a new Vector3 perpendicular to self.
Sourcepub fn distance_to(&self, v: Vector3) -> f32
pub fn distance_to(&self, v: Vector3) -> f32
Calculates the distance towards vector v.
Sourcepub fn scale_by(&self, scale: f32) -> Vector3
pub fn scale_by(&self, scale: f32) -> Vector3
Returns a new Vector3 with components scaled by scale.
Sourcepub fn normalized(&self) -> Vector3
pub fn normalized(&self) -> Vector3
Returns a new Vector3 with normalized components from the current vector.
Sourcepub fn ortho_normalize(&mut self, v: &mut Vector3)
pub fn ortho_normalize(&mut self, v: &mut Vector3)
Normalizes and changes both self and v to be orthogonal to eachother.
Sourcepub fn transform_with(&self, mat: Matrix) -> Vector3
pub fn transform_with(&self, mat: Matrix) -> Vector3
Returns a new Vector3 containing components transformed by Matrix mat.
Sourcepub fn rotate(&mut self, q: Quaternion)
pub fn rotate(&mut self, q: Quaternion)
Rotates the current vector using Quaternion q.
Sourcepub fn rotate_by(&self, q: Quaternion) -> Vector3
pub fn rotate_by(&self, q: Quaternion) -> Vector3
Returns a new Vector3 with components rotated by Quaternion q.
Sourcepub fn lerp(&self, v: Vector3, amount: f32) -> Vector3
pub fn lerp(&self, v: Vector3, amount: f32) -> Vector3
Returns a new Vector3 with componenets linearly interpolated by amount towards vector v.
Sourcepub fn reflect_from(&self, normal: Vector3) -> Vector3
pub fn reflect_from(&self, normal: Vector3) -> Vector3
Returns a new Vector3 reflected from the current vector using normal.
Sourcepub fn min(&self, v: Vector3) -> Vector3
pub fn min(&self, v: Vector3) -> Vector3
Returns a new Vector3 containing the minimum of each corresponding component.
Sourcepub fn max(&self, v: Vector3) -> Vector3
pub fn max(&self, v: Vector3) -> Vector3
Returns a new Vector3 containing the maximum of each corresponding component.
Sourcepub fn barycenter(&self, a: Vector3, b: Vector3, c: Vector3) -> Vector3
pub fn barycenter(&self, a: Vector3, b: Vector3, c: Vector3) -> Vector3
Returns barycenter coordinates (u, v, w) from point p (current vector) with respect to triangle (a, b, c).
Trait Implementations§
Source§impl AddAssign<f32> for Vector3
impl AddAssign<f32> for Vector3
Source§fn add_assign(&mut self, value: f32)
fn add_assign(&mut self, value: f32)
+= operation. Read moreSource§impl AddAssign for Vector3
impl AddAssign for Vector3
Source§fn add_assign(&mut self, v: Vector3)
fn add_assign(&mut self, v: Vector3)
+= operation. Read moreSource§impl DivAssign<f32> for Vector3
impl DivAssign<f32> for Vector3
Source§fn div_assign(&mut self, value: f32)
fn div_assign(&mut self, value: f32)
/= operation. Read moreSource§impl DivAssign for Vector3
impl DivAssign for Vector3
Source§fn div_assign(&mut self, v: Vector3)
fn div_assign(&mut self, v: Vector3)
/= operation. Read moreSource§impl MulAssign<f32> for Vector3
impl MulAssign<f32> for Vector3
Source§fn mul_assign(&mut self, value: f32)
fn mul_assign(&mut self, value: f32)
*= operation. Read moreSource§impl MulAssign for Vector3
impl MulAssign for Vector3
Source§fn mul_assign(&mut self, v: Vector3)
fn mul_assign(&mut self, v: Vector3)
*= operation. Read moreSource§impl ShaderV for Vector3
impl ShaderV for Vector3
const UNIFORM_TYPE: ShaderUniformDataType = ShaderUniformDataType::SHADER_UNIFORM_VEC3
unsafe fn value(&self) -> *const c_void
Source§impl SubAssign<f32> for Vector3
impl SubAssign<f32> for Vector3
Source§fn sub_assign(&mut self, value: f32)
fn sub_assign(&mut self, value: f32)
-= operation. Read moreSource§impl SubAssign for Vector3
impl SubAssign for Vector3
Source§fn sub_assign(&mut self, v: Vector3)
fn sub_assign(&mut self, v: Vector3)
-= operation. Read more