1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::Plane;
use crate::Point3D;
use crate::Vec3;
use crate::Vec4;
use glib::translate::*;

impl Plane {
    #[doc(alias = "graphene_plane_init")]
    pub fn new(normal: Option<&Vec3>, constant: f32) -> Plane {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_plane_alloc();
            ffi::graphene_plane_init(alloc, normal.to_glib_none().0, constant);
            from_glib_full(alloc)
        }
    }

    #[doc(alias = "graphene_plane_init_from_plane")]
    #[doc(alias = "new_from_plane")]
    pub fn from_plane(src: &Plane) -> Plane {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_plane_alloc();
            ffi::graphene_plane_init_from_plane(alloc, src.to_glib_none().0);
            from_glib_full(alloc)
        }
    }

    #[doc(alias = "graphene_plane_init_from_point")]
    #[doc(alias = "new_from_point")]
    pub fn from_point(normal: &Vec3, point: &Point3D) -> Plane {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_plane_alloc();
            ffi::graphene_plane_init_from_point(
                alloc,
                normal.to_glib_none().0,
                point.to_glib_none().0,
            );
            from_glib_full(alloc)
        }
    }

    #[doc(alias = "graphene_plane_init_from_points")]
    #[doc(alias = "new_from_points")]
    pub fn from_points(a: &Point3D, b: &Point3D, c: &Point3D) -> Plane {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_plane_alloc();
            ffi::graphene_plane_init_from_points(
                alloc,
                a.to_glib_none().0,
                b.to_glib_none().0,
                c.to_glib_none().0,
            );
            from_glib_full(alloc)
        }
    }

    #[doc(alias = "graphene_plane_init_from_vec4")]
    #[doc(alias = "new_from_vec4")]
    pub fn from_vec4(src: &Vec4) -> Plane {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_plane_alloc();
            ffi::graphene_plane_init_from_vec4(alloc, src.to_glib_none().0);
            from_glib_full(alloc)
        }
    }
}