graphene/auto/
frustum.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Box, Point3D, Sphere};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// A 3D volume delimited by 2D clip planes.
10    ///
11    /// The contents of the [`Frustum`][crate::Frustum] are private, and should not be
12    /// modified directly.
13    pub struct Frustum(BoxedInline<ffi::graphene_frustum_t>);
14
15    match fn {
16        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_frustum_get_type(), ptr as *mut _) as *mut ffi::graphene_frustum_t,
17        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_frustum_get_type(), ptr as *mut _),
18        type_ => || ffi::graphene_frustum_get_type(),
19    }
20}
21
22impl Frustum {
23    /// Checks whether a point is inside the volume defined by the given
24    /// [`Frustum`][crate::Frustum].
25    /// ## `point`
26    /// a [`Point3D`][crate::Point3D]
27    ///
28    /// # Returns
29    ///
30    /// `true` if the point is inside the frustum
31    #[doc(alias = "graphene_frustum_contains_point")]
32    pub fn contains_point(&self, point: &Point3D) -> bool {
33        unsafe {
34            ffi::graphene_frustum_contains_point(self.to_glib_none().0, point.to_glib_none().0)
35        }
36    }
37
38    #[doc(alias = "graphene_frustum_equal")]
39    fn equal(&self, b: &Frustum) -> bool {
40        unsafe { ffi::graphene_frustum_equal(self.to_glib_none().0, b.to_glib_none().0) }
41    }
42
43    /// Checks whether the given `box_` intersects a plane of
44    /// a [`Frustum`][crate::Frustum].
45    /// ## `box_`
46    /// a [`Box`][crate::Box]
47    ///
48    /// # Returns
49    ///
50    /// `true` if the box intersects the frustum
51    #[doc(alias = "graphene_frustum_intersects_box")]
52    pub fn intersects_box(&self, box_: &Box) -> bool {
53        unsafe {
54            ffi::graphene_frustum_intersects_box(self.to_glib_none().0, box_.to_glib_none().0)
55        }
56    }
57
58    /// Checks whether the given `sphere` intersects a plane of
59    /// a [`Frustum`][crate::Frustum].
60    /// ## `sphere`
61    /// a [`Sphere`][crate::Sphere]
62    ///
63    /// # Returns
64    ///
65    /// `true` if the sphere intersects the frustum
66    #[doc(alias = "graphene_frustum_intersects_sphere")]
67    pub fn intersects_sphere(&self, sphere: &Sphere) -> bool {
68        unsafe {
69            ffi::graphene_frustum_intersects_sphere(self.to_glib_none().0, sphere.to_glib_none().0)
70        }
71    }
72}
73
74impl PartialEq for Frustum {
75    #[inline]
76    fn eq(&self, other: &Self) -> bool {
77        self.equal(other)
78    }
79}
80
81impl Eq for Frustum {}