graphene/auto/
sphere.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};
6use glib::translate::*;
7
8glib::wrapper! {
9    pub struct Sphere(BoxedInline<ffi::graphene_sphere_t>);
10
11    match fn {
12        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_sphere_get_type(), ptr as *mut _) as *mut ffi::graphene_sphere_t,
13        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_sphere_get_type(), ptr as *mut _),
14        type_ => || ffi::graphene_sphere_get_type(),
15    }
16}
17
18impl Sphere {
19    #[doc(alias = "graphene_sphere_contains_point")]
20    pub fn contains_point(&self, point: &Point3D) -> bool {
21        unsafe {
22            ffi::graphene_sphere_contains_point(self.to_glib_none().0, point.to_glib_none().0)
23        }
24    }
25
26    #[doc(alias = "graphene_sphere_distance")]
27    pub fn distance(&self, point: &Point3D) -> f32 {
28        unsafe { ffi::graphene_sphere_distance(self.to_glib_none().0, point.to_glib_none().0) }
29    }
30
31    #[doc(alias = "graphene_sphere_equal")]
32    fn equal(&self, b: &Sphere) -> bool {
33        unsafe { ffi::graphene_sphere_equal(self.to_glib_none().0, b.to_glib_none().0) }
34    }
35
36    #[doc(alias = "graphene_sphere_get_bounding_box")]
37    #[doc(alias = "get_bounding_box")]
38    pub fn bounding_box(&self) -> Box {
39        unsafe {
40            let mut box_ = Box::uninitialized();
41            ffi::graphene_sphere_get_bounding_box(self.to_glib_none().0, box_.to_glib_none_mut().0);
42            box_
43        }
44    }
45
46    #[doc(alias = "graphene_sphere_get_center")]
47    #[doc(alias = "get_center")]
48    pub fn center(&self) -> Point3D {
49        unsafe {
50            let mut center = Point3D::uninitialized();
51            ffi::graphene_sphere_get_center(self.to_glib_none().0, center.to_glib_none_mut().0);
52            center
53        }
54    }
55
56    #[doc(alias = "graphene_sphere_get_radius")]
57    #[doc(alias = "get_radius")]
58    pub fn radius(&self) -> f32 {
59        unsafe { ffi::graphene_sphere_get_radius(self.to_glib_none().0) }
60    }
61
62    #[doc(alias = "graphene_sphere_is_empty")]
63    pub fn is_empty(&self) -> bool {
64        unsafe { ffi::graphene_sphere_is_empty(self.to_glib_none().0) }
65    }
66
67    #[doc(alias = "graphene_sphere_translate")]
68    #[must_use]
69    pub fn translate(&self, point: &Point3D) -> Sphere {
70        unsafe {
71            let mut res = Sphere::uninitialized();
72            ffi::graphene_sphere_translate(
73                self.to_glib_none().0,
74                point.to_glib_none().0,
75                res.to_glib_none_mut().0,
76            );
77            res
78        }
79    }
80}
81
82impl PartialEq for Sphere {
83    #[inline]
84    fn eq(&self, other: &Self) -> bool {
85        self.equal(other)
86    }
87}
88
89impl Eq for Sphere {}