You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As currently implemented, none of the geometric types in the fj crate implement PartialEq. Is there a specific reason for this, or was it done just as a forward-compatiblity measure? For example, because we might want to add trait/function-based geometry in the future which doesn't have a definition for value equality.
If possible, it'd be nice to #[derive(PartialEq)] because then model implementations can write unit tests to check they generate the correct shape.
As an example for when this could be useful, see the following smoke test for my cuboid model.
#[test]fnload_cuboid_and_generate_geometry(){let crate_dir = Path::new(env!("CARGO_MANIFEST_DIR"));let target_dir = crate_dir.parent().unwrap().parent().unwrap().join("target");let model = Model::from_path(crate_dir.into(),Some(target_dir.into())).unwrap();letmut arguments = HashMap::new();
arguments.insert("x".to_string(),"10".to_string());let actual = model.load_once(&Parameters(arguments)).unwrap();let rectangle = fj::Sketch::from_points(vec![[-5.0, -1.0],[10.0 / 2., -2.0 / 2.],[10.0 / 2.,2.0 / 2.],[-10.0 / 2.,2.0 / 2.],]).with_color([100,255,0,200]);let expected = fj::Sweep::from_path(rectangle.into(),[0.,0.,3.0]);// TODO: Enable this assertion when we can compare shapes for equality.// https://github.com/hannobraun/Fornjot/issues/831// assert_eq!(actual, expected);let _ = (actual, expected);}
The text was updated successfully, but these errors were encountered:
There's no deep reason for why they don't derive PartialEq, nor is there any specific reason why they derive the types they do derive, beyond "it was needed at some point". Any changes here that help you (or anyone else) are definitely welcome!
Forward compatibility is not a concern at this point. We are far away from even approaching a mature design. This stuff will change a million times more before it settles down, I'm sure.
As currently implemented, none of the geometric types in the
fj
crate implementPartialEq
. Is there a specific reason for this, or was it done just as a forward-compatiblity measure? For example, because we might want to add trait/function-based geometry in the future which doesn't have a definition for value equality.If possible, it'd be nice to
#[derive(PartialEq)]
because then model implementations can write unit tests to check they generate the correct shape.As an example for when this could be useful, see the following smoke test for my
cuboid
model.The text was updated successfully, but these errors were encountered: