Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
vec3d.rs

1/// A three-dimensional Cartesian vector.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith,
8    Copy
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct Vec3d {
15    #[serde(rename = "x")]
16    #[derive_with(with = conjure_object::private::DoubleWrapper)]
17    x: f64,
18    #[serde(rename = "y")]
19    #[derive_with(with = conjure_object::private::DoubleWrapper)]
20    y: f64,
21    #[serde(rename = "z")]
22    #[derive_with(with = conjure_object::private::DoubleWrapper)]
23    z: f64,
24}
25impl Vec3d {
26    /// Constructs a new instance of the type.
27    #[inline]
28    pub fn new(x: f64, y: f64, z: f64) -> Self {
29        Self::builder().x(x).y(y).z(z).build()
30    }
31    #[inline]
32    pub fn x(&self) -> f64 {
33        self.x
34    }
35    #[inline]
36    pub fn y(&self) -> f64 {
37        self.y
38    }
39    #[inline]
40    pub fn z(&self) -> f64 {
41        self.z
42    }
43}