Skip to main content

shape_core/elements/points/point_3d/
mod.rs

1use super::*;
2mod display;
3
4#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
5#[derive(Copy, Clone, PartialEq, Eq, Hash)]
6pub struct Point3D<T> {
7    ///x-coordinate of a 3D point
8    pub x: T,
9    ///y-coordinate of a 3D point
10    pub y: T,
11    ///z-coordinate of a 3D point
12    pub z: T,
13}
14
15impl<T> Point3D<T> {
16    /// Construct new points
17    pub fn new(x: T, y: T, z: T) -> Self {
18        Self { x, y, z }
19    }
20    /// Move pointer to inner fields
21    pub fn ref_inner(&self) -> Point3D<&T> {
22        Point3D { x: &self.x, y: &self.y, z: &self.z }
23    }
24}
25