geometry_box/
point3_box.rs

1#[derive(Debug, Copy, Clone, Default)]
2#[repr(C)]
3pub struct Point3Box<T>
4where
5    T: From<u8> + Default + Copy,
6{
7    pub x: T,
8    pub y: T,
9    pub z: T,
10}
11
12impl<T> Point3Box<T>
13where
14    T: From<u8> + Default + Copy,
15{
16    pub fn be_zero(&mut self) {
17        self.x = 0u8.into();
18        self.y = 0u8.into();
19        self.z = 0u8.into();
20    }
21
22    pub fn new(x: T, y: T, z: T) -> Self {
23        Point3Box::<T> { x, y, z }
24    }
25
26    // pub fn boxer_point_default() -> *mut ValueBox<Point3Box<T>> {
27    //     ValueBox::new(Point3Box::<T>::default()).into_raw()
28    // }
29    //
30    // pub fn boxer_point_create(x: T, y: T, z: T) -> *mut ValueBox<Point3Box<T>> {
31    //     ValueBox::new(Point3Box::<T>::new(x, y, z)).into_raw()
32    // }
33    //
34    // pub fn boxer_point_drop(ptr: *mut ValueBox<Point3Box<T>>) {
35    //     ptr.release();
36    // }
37    //
38    // pub fn boxer_point_get_x(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>) -> T {
39    //     _maybe_null_ptr.with_not_null_return(0u8.into(), |point| point.x)
40    // }
41    //
42    // pub fn boxer_point_set_x(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>, x: T) {
43    //     _maybe_null_ptr.with_not_null(|point| point.x = x)
44    // }
45    //
46    // pub fn boxer_point_get_y(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>) -> T {
47    //     _maybe_null_ptr.with_not_null_return(0u8.into(), |point| point.y)
48    // }
49    //
50    // pub fn boxer_point_set_y(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>, y: T) {
51    //     _maybe_null_ptr.with_not_null(|point| point.y = y)
52    // }
53    //
54    // pub fn boxer_point_get_z(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>) -> T {
55    //     _maybe_null_ptr.with_not_null_return(0u8.into(), |point| point.z)
56    // }
57    //
58    // pub fn boxer_point_set_z(_maybe_null_ptr: *mut ValueBox<Point3Box<T>>, z: T) {
59    //     _maybe_null_ptr.with_not_null(|point| point.z = z)
60    // }
61}