When using the transformation::convex_hull function to process a series of points, results diverge between f64 and f32 types. Consider the following trivial example:
use nalgebra::Point3;
type T = f64;
fn main() {
let points: Vec<Point3<T>> = vec![
Point3::new(-0.75, -1.75, -44.583675),
Point3::new(-0.75, 1.75, -44.583675),
Point3::new(-0.75, -1.75, 44.583675),
Point3::new(0.75, -1.75, 44.583675),
Point3::new(0.75, 1.75, 44.583675),
Point3::new(-0.75, 1.75, 44.583675),
Point3::new(0.75, -1.75, -43.37378),
Point3::new(0.75, 1.75, -43.37378),
];
let hull = ncollide3d::transformation::convex_hull(&points[..]);
hull.coords.iter()
.for_each(|pt| println!("{:?}", pt));
}
The resulting output is, as expected, roughly identical to the input points:
When using the
transformation::convex_hull
function to process a series of points, results diverge between f64 and f32 types. Consider the following trivial example:The resulting output is, as expected, roughly identical to the input points:
However, when changing the type
T
to f32, the results are:If rendering, it becomes clear that the f32-based shape (which was originally derived from a cuboid's corner points) is skewed:![image](https://user-images.githubusercontent.com/66568249/90895943-5ea86700-e3b2-11ea-8d20-d86fb3020257.png)