pub fn convex_polygons_intersection_points_with_tolerances(
poly1: &[Point2<f32>],
poly2: &[Point2<f32>],
tolerances: PolygonIntersectionTolerances,
out: &mut Vec<Point2<f32>>,
)Expand description
Computes the intersection points of two convex polygons with custom tolerances.
This is the same as convex_polygons_intersection_points but allows you to specify
custom numerical tolerances for the intersection computation.
§Arguments
poly1- First convex polygon as a slice of verticespoly2- Second convex polygon as a slice of verticestolerances- Custom tolerances for numerical precisionout- Output vector where intersection vertices will be appended
§Examples
let triangle1 = vec![
Point2::origin(),
Point2::new(4.0, 0.0),
Point2::new(2.0, 3.0),
];
let triangle2 = vec![
Point2::new(1.0, 0.5),
Point2::new(3.0, 0.5),
Point2::new(2.0, 2.5),
];
let mut intersection = Vec::new();
let tolerances = PolygonIntersectionTolerances {
collinearity_epsilon: 1.0e-6,
};
convex_polygons_intersection_points_with_tolerances(
&triangle1,
&triangle2,
tolerances,
&mut intersection
);
// The triangles overlap, so we should get intersection points
assert!(intersection.len() >= 3);