// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Vec2, Vec4};
use glib::translate::*;

glib::wrapper! {
    pub struct Vec3(BoxedInline<ffi::graphene_vec3_t>);

    match fn {
        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_vec3_get_type(), ptr as *mut _) as *mut ffi::graphene_vec3_t,
        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_vec3_get_type(), ptr as *mut _),
        type_ => || ffi::graphene_vec3_get_type(),
    }
}

impl Vec3 {
    #[doc(alias = "graphene_vec3_add")]
    #[must_use]
    pub fn add(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_add(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_cross")]
    #[must_use]
    pub fn cross(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_cross(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_divide")]
    #[must_use]
    pub fn divide(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_divide(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_dot")]
    pub fn dot(&self, b: &Vec3) -> f32 {
        unsafe { ffi::graphene_vec3_dot(self.to_glib_none().0, b.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_equal")]
    fn equal(&self, v2: &Vec3) -> bool {
        unsafe { ffi::graphene_vec3_equal(self.to_glib_none().0, v2.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_get_x")]
    #[doc(alias = "get_x")]
    pub fn x(&self) -> f32 {
        unsafe { ffi::graphene_vec3_get_x(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_get_xy")]
    #[doc(alias = "get_xy")]
    pub fn xy(&self) -> Vec2 {
        unsafe {
            let mut res = Vec2::uninitialized();
            ffi::graphene_vec3_get_xy(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_get_xy0")]
    #[doc(alias = "get_xy0")]
    #[must_use]
    pub fn xy0(&self) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_get_xy0(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_get_xyz0")]
    #[doc(alias = "get_xyz0")]
    pub fn xyz0(&self) -> Vec4 {
        unsafe {
            let mut res = Vec4::uninitialized();
            ffi::graphene_vec3_get_xyz0(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_get_xyz1")]
    #[doc(alias = "get_xyz1")]
    pub fn xyz1(&self) -> Vec4 {
        unsafe {
            let mut res = Vec4::uninitialized();
            ffi::graphene_vec3_get_xyz1(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_get_xyzw")]
    #[doc(alias = "get_xyzw")]
    pub fn xyzw(&self, w: f32) -> Vec4 {
        unsafe {
            let mut res = Vec4::uninitialized();
            ffi::graphene_vec3_get_xyzw(self.to_glib_none().0, w, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_get_y")]
    #[doc(alias = "get_y")]
    pub fn y(&self) -> f32 {
        unsafe { ffi::graphene_vec3_get_y(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_get_z")]
    #[doc(alias = "get_z")]
    pub fn z(&self) -> f32 {
        unsafe { ffi::graphene_vec3_get_z(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_interpolate")]
    #[must_use]
    pub fn interpolate(&self, v2: &Vec3, factor: f64) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_interpolate(
                self.to_glib_none().0,
                v2.to_glib_none().0,
                factor,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_length")]
    pub fn length(&self) -> f32 {
        unsafe { ffi::graphene_vec3_length(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_vec3_max")]
    #[must_use]
    pub fn max(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_max(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_min")]
    #[must_use]
    pub fn min(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_min(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_multiply")]
    #[must_use]
    pub fn multiply(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_multiply(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_near")]
    pub fn near(&self, v2: &Vec3, epsilon: f32) -> bool {
        unsafe { ffi::graphene_vec3_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) }
    }

    #[doc(alias = "graphene_vec3_negate")]
    #[must_use]
    pub fn negate(&self) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_negate(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_normalize")]
    #[must_use]
    pub fn normalize(&self) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_normalize(self.to_glib_none().0, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_scale")]
    #[must_use]
    pub fn scale(&self, factor: f32) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0);
            res
        }
    }

    #[doc(alias = "graphene_vec3_subtract")]
    #[must_use]
    pub fn subtract(&self, b: &Vec3) -> Vec3 {
        unsafe {
            let mut res = Vec3::uninitialized();
            ffi::graphene_vec3_subtract(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_vec3_one")]
    pub fn one() -> Vec3 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec3_one()) }
    }

    #[doc(alias = "graphene_vec3_x_axis")]
    pub fn x_axis() -> Vec3 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec3_x_axis()) }
    }

    #[doc(alias = "graphene_vec3_y_axis")]
    pub fn y_axis() -> Vec3 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec3_y_axis()) }
    }

    #[doc(alias = "graphene_vec3_z_axis")]
    pub fn z_axis() -> Vec3 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec3_z_axis()) }
    }

    #[doc(alias = "graphene_vec3_zero")]
    pub fn zero() -> Vec3 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec3_zero()) }
    }
}

impl PartialEq for Vec3 {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.equal(other)
    }
}

impl Eq for Vec3 {}
