Skip to content

Commit 400b656

Browse files
committed
Improve CLI checks for domain aabb
1 parent e8aba28 commit 400b656

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

splashsurf/src/reconstruction.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,24 @@ mod arguments {
192192
assert_eq!(domain_min.len(), 3);
193193
assert_eq!(domain_max.len(), 3);
194194

195-
// TODO: Check that domain_min < domain_max
196-
let to_na_vec =
197-
|v: &Vec<f64>| -> Vector3<f64> { Vector3::new(v[0], v[1], v[2]) };
198-
199-
Some(AxisAlignedBoundingBox3d::new(
200-
to_na_vec(domain_min),
201-
to_na_vec(domain_max),
202-
))
195+
let aabb = AxisAlignedBoundingBox3d::new(
196+
Vector3::from_iterator(domain_min.clone()),
197+
Vector3::from_iterator(domain_max.clone()),
198+
);
199+
200+
if !aabb.is_consistent() {
201+
return Err(anyhow!("The user specified domain min/max values are inconsistent! min: {:?} max: {:?}", aabb.min().as_slice(), aabb.max().as_slice()));
202+
}
203+
204+
if aabb.is_degenerate() {
205+
return Err(anyhow!(
206+
"The user specified domain is degenerate! min: {:?} max: {:?}",
207+
aabb.min().as_slice(),
208+
aabb.max().as_slice()
209+
));
210+
}
211+
212+
Some(aabb)
203213
}
204214
_ => None,
205215
};

0 commit comments

Comments
 (0)