pub fn convex_polygons_intersection_points_with_tolerances(
poly1: &[Vector2],
poly2: &[Vector2],
tolerances: PolygonIntersectionTolerances,
out: &mut Vec<Vector2>,
)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![
Vector::ZERO,
Vector::new(4.0, 0.0),
Vector::new(2.0, 3.0),
];
let triangle2 = vec![
Vector::new(1.0, 0.5),
Vector::new(3.0, 0.5),
Vector::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);