re_types/components/
pose_transform_mat3x3.rs

1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
2// Based on "crates/store/re_types/definitions/rerun/components/transform_mat3x3.fbs".
3
4#![allow(unused_imports)]
5#![allow(unused_parens)]
6#![allow(clippy::clone_on_copy)]
7#![allow(clippy::cloned_instead_of_copied)]
8#![allow(clippy::map_flatten)]
9#![allow(clippy::needless_question_mark)]
10#![allow(clippy::new_without_default)]
11#![allow(clippy::redundant_closure)]
12#![allow(clippy::too_many_arguments)]
13#![allow(clippy::too_many_lines)]
14
15use ::re_types_core::try_serialize_field;
16use ::re_types_core::SerializationResult;
17use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
18use ::re_types_core::{ComponentDescriptor, ComponentName};
19use ::re_types_core::{DeserializationError, DeserializationResult};
20
21/// **Component**: A 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy.
22///
23/// 3x3 matrixes are able to represent any affine transformation in 3D space,
24/// i.e. rotation, scaling, shearing, reflection etc.
25///
26/// Matrices in Rerun are stored as flat list of coefficients in column-major order:
27/// ```text
28///             column 0       column 1       column 2
29///        -------------------------------------------------
30/// row 0 | flat_columns[0] flat_columns[3] flat_columns[6]
31/// row 1 | flat_columns[1] flat_columns[4] flat_columns[7]
32/// row 2 | flat_columns[2] flat_columns[5] flat_columns[8]
33/// ```
34#[derive(Clone, Debug, Default, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
35#[repr(transparent)]
36pub struct PoseTransformMat3x3(pub crate::datatypes::Mat3x3);
37
38impl ::re_types_core::Component for PoseTransformMat3x3 {
39    #[inline]
40    fn descriptor() -> ComponentDescriptor {
41        ComponentDescriptor::new("rerun.components.PoseTransformMat3x3")
42    }
43}
44
45::re_types_core::macros::impl_into_cow!(PoseTransformMat3x3);
46
47impl ::re_types_core::Loggable for PoseTransformMat3x3 {
48    #[inline]
49    fn arrow_datatype() -> arrow::datatypes::DataType {
50        crate::datatypes::Mat3x3::arrow_datatype()
51    }
52
53    fn to_arrow_opt<'a>(
54        data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
55    ) -> SerializationResult<arrow::array::ArrayRef>
56    where
57        Self: Clone + 'a,
58    {
59        crate::datatypes::Mat3x3::to_arrow_opt(data.into_iter().map(|datum| {
60            datum.map(|datum| match datum.into() {
61                ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0),
62                ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0),
63            })
64        }))
65    }
66
67    fn from_arrow_opt(
68        arrow_data: &dyn arrow::array::Array,
69    ) -> DeserializationResult<Vec<Option<Self>>>
70    where
71        Self: Sized,
72    {
73        crate::datatypes::Mat3x3::from_arrow_opt(arrow_data)
74            .map(|v| v.into_iter().map(|v| v.map(Self)).collect())
75    }
76
77    #[inline]
78    fn from_arrow(arrow_data: &dyn arrow::array::Array) -> DeserializationResult<Vec<Self>>
79    where
80        Self: Sized,
81    {
82        crate::datatypes::Mat3x3::from_arrow(arrow_data).map(bytemuck::cast_vec)
83    }
84}
85
86impl<T: Into<crate::datatypes::Mat3x3>> From<T> for PoseTransformMat3x3 {
87    fn from(v: T) -> Self {
88        Self(v.into())
89    }
90}
91
92impl std::borrow::Borrow<crate::datatypes::Mat3x3> for PoseTransformMat3x3 {
93    #[inline]
94    fn borrow(&self) -> &crate::datatypes::Mat3x3 {
95        &self.0
96    }
97}
98
99impl std::ops::Deref for PoseTransformMat3x3 {
100    type Target = crate::datatypes::Mat3x3;
101
102    #[inline]
103    fn deref(&self) -> &crate::datatypes::Mat3x3 {
104        &self.0
105    }
106}
107
108impl std::ops::DerefMut for PoseTransformMat3x3 {
109    #[inline]
110    fn deref_mut(&mut self) -> &mut crate::datatypes::Mat3x3 {
111        &mut self.0
112    }
113}
114
115impl ::re_byte_size::SizeBytes for PoseTransformMat3x3 {
116    #[inline]
117    fn heap_size_bytes(&self) -> u64 {
118        self.0.heap_size_bytes()
119    }
120
121    #[inline]
122    fn is_pod() -> bool {
123        <crate::datatypes::Mat3x3>::is_pod()
124    }
125}