Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 18, 2023
1 parent f78f886 commit ca913b7
Show file tree
Hide file tree
Showing 28 changed files with 390 additions and 97 deletions.
30 changes: 23 additions & 7 deletions crates/re_log_types/src/data_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,12 +1140,14 @@ impl DataTable {
for (c1, c2) in cells1.0.iter().zip(&cells2.0) {
if c1 != c2 {
anyhow::ensure!(
c1.total_size_bytes() == c2.total_size_bytes(),
"Found discrepancy in row #{ri}, cells' sizes don't match! {} ({}) vs. {} ({}) bytes",
c1.total_size_bytes(),
c1.component_name(),
c2.total_size_bytes(),
c2.component_name(),
c1.datatype() == c2.datatype(),
"Found discrepancy in row #{ri}, cells' datatypes don't match!\n{}",
similar_asserts::SimpleDiff::from_str(
&format!("{:?}", c1.datatype()),
&format!("{:?}", c2.datatype()),
"cell1",
"cell2"
)
);

let arr1 = c1.as_arrow_ref();
Expand Down Expand Up @@ -1192,18 +1194,32 @@ impl DataTable {
}
}

let mut size_mismatches = vec![];
for (c1, c2) in cells1.0.iter().zip(&cells2.0) {
if c1.total_size_bytes() != c2.total_size_bytes() {
size_mismatches.push(format!(
"Found discrepancy in row #{ri}, cells' sizes don't match! {} ({}) vs. {} ({}) bytes",
c1.total_size_bytes(),
c1.component_name(),
c2.total_size_bytes(),
c2.component_name(),
));
}
}

anyhow::ensure!(
timepoint1 == timepoint2
&& entity_path1 == entity_path2
&& num_instances1 == num_instances2
&& cells1 == cells2,
"Found discrepancy in row #{ri}:\n{}",
"Found discrepancy in row #{ri}:\n{}\n{}",
similar_asserts::SimpleDiff::from_str(
&row1.to_string(),
&row2.to_string(),
"row1",
"row2"
),
size_mismatches.join("\n"),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script.
# It can be safely removed at anytime to force the build script to run again.
# Check out build.rs to see how it's computed.
ed23454dff7eea3feaa346c3ef79728865d0a10f6944204cd466ddc64d8d38b1
be808f643273514bf88d2e1ac9c83168b1d3297443e0da51557b746608214616
60 changes: 58 additions & 2 deletions crates/re_types/src/archetypes/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,64 @@
#![allow(clippy::too_many_lines)]
#![allow(clippy::unnecessary_cast)]

/// A 3D transform
#[derive(Clone, Debug)]
/// A 3D transform.
///
/// ## Example
///
/// ```ignore
/// use rerun::{
/// experimental::{
/// archetypes::Transform3D,
/// datatypes::{
/// Angle, Mat3x3, RotationAxisAngle, Scale3D, TranslationAndMat3x3,
/// TranslationRotationScale3D,
/// },
/// },
/// MsgSender, RecordingStreamBuilder,
/// };
/// use std::f32::consts::PI;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let (rec_stream, storage) = RecordingStreamBuilder::new("transform").memory()?;
///
/// let arrow = rerun::components::Arrow3D {
/// origin: rerun::components::Vec3D::from([0.0, 0.0, 0.0]),
/// vector: rerun::components::Vec3D::from([0.0, 1.0, 0.0]),
/// };
///
/// MsgSender::new("base")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// MsgSender::from_archetype(
/// "base/translated",
/// &Transform3D::new(TranslationAndMat3x3::new([1.0, 0.0, 0.0], Mat3x3::IDENTITY)),
/// )?
/// .send(&rec_stream)?;
///
/// MsgSender::new("base/translated")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// MsgSender::from_archetype(
/// "base/rotated_scaled",
/// &Transform3D::new(TranslationRotationScale3D {
/// rotation: Some(RotationAxisAngle::new([0.0, 0.0, 1.0], Angle::Radians(PI / 4.)).into()),
/// scale: Some(Scale3D::from(2.0)),
/// ..Default::default()
/// }),
/// )?
/// .send(&rec_stream)?;
///
/// MsgSender::new("base/rotated_scaled")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// rerun::native_viewer::show(storage.take())?;
/// Ok(())
/// }
/// ```
#[derive(Clone, Debug, PartialEq)]
pub struct Transform3D {
/// The transform
pub transform: crate::components::Transform3D,
Expand Down
36 changes: 18 additions & 18 deletions crates/re_types/src/components/fuzzy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ impl crate::Loggable for AffixFuzzer14 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
)
}
Expand Down Expand Up @@ -2798,7 +2798,7 @@ impl crate::Loggable for AffixFuzzer15 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
)
}
Expand Down Expand Up @@ -3030,7 +3030,7 @@ impl crate::Loggable for AffixFuzzer16 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -3217,7 +3217,7 @@ impl crate::Loggable for AffixFuzzer16 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -3477,7 +3477,7 @@ impl crate::Loggable for AffixFuzzer17 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -3666,7 +3666,7 @@ impl crate::Loggable for AffixFuzzer17 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -3932,7 +3932,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4063,7 +4063,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4197,7 +4197,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -4207,7 +4207,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -4304,7 +4304,7 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }

, Field { name : "many_required" . to_owned () , data_type : DataType :: List (Box :: new (Field { name : "item" . to_owned () , data_type : DataType :: Union (vec ! [Field { name : "_null_markers" . to_owned () , data_type : DataType :: Null , is_nullable : true , metadata : [] . into () , }

Expand Down Expand Up @@ -4346,7 +4346,7 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }

)) , is_nullable : false , metadata : [] . into () , }

Expand Down Expand Up @@ -4390,11 +4390,11 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }

)) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 ,]) , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }

))) , None) . to_logical_type () . clone () }

Expand Down Expand Up @@ -4644,7 +4644,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4775,7 +4775,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4909,7 +4909,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -4919,7 +4919,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down
1 change: 1 addition & 0 deletions crates/re_types/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod point2d_ext;
mod radius;
mod radius_ext;
mod transform3d;
mod transform3d_ext;

pub use self::class_id::ClassId;
pub use self::color::Color;
Expand Down
30 changes: 15 additions & 15 deletions crates/re_types/src/components/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#![allow(clippy::unnecessary_cast)]

/// An affine transform between two 3D spaces, represented in a given direction.
#[derive(Clone, Debug)]
pub struct Transform3D {
#[derive(Clone, Debug, PartialEq)]
pub struct Transform3D(
/// Representation of the transform.
pub repr: crate::datatypes::Transform3D,
}
pub crate::datatypes::Transform3D,
);

impl<'a> From<Transform3D> for ::std::borrow::Cow<'a, Transform3D> {
#[inline]
Expand Down Expand Up @@ -174,7 +174,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand All @@ -185,7 +185,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -222,7 +222,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -239,7 +239,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
)
}
Expand All @@ -255,26 +255,26 @@ impl crate::Loggable for Transform3D {
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok({
let (somes, repr): (Vec<_>, Vec<_>) = data
let (somes, data0): (Vec<_>, Vec<_>) = data
.into_iter()
.map(|datum| {
let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into);
let datum = datum.map(|datum| {
let Self { repr } = datum.into_owned();
repr
let Self(data0) = datum.into_owned();
data0
});
(datum.is_some(), datum)
})
.unzip();
let repr_bitmap: Option<::arrow2::bitmap::Bitmap> = {
let data0_bitmap: Option<::arrow2::bitmap::Bitmap> = {
let any_nones = somes.iter().any(|some| !*some);
any_nones.then(|| somes.into())
};
{
_ = repr_bitmap;
_ = data0_bitmap;
_ = extension_wrapper;
crate::datatypes::Transform3D::try_to_arrow_opt(
repr,
data0,
Some("rerun.components.Transform3D"),
)?
}
Expand All @@ -301,7 +301,7 @@ impl crate::Loggable for Transform3D {
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.map(|res| res.map(|repr| Some(Self { repr })))
.map(|res| res.map(|v| Some(Self(v))))
.collect::<crate::DeserializationResult<Vec<Option<_>>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.components.Transform3D#repr".into(),
Expand Down
Loading

0 comments on commit ca913b7

Please sign in to comment.