Skip to main content

clip_halfspace_polygon

Function clip_halfspace_polygon 

Source
pub fn clip_halfspace_polygon(
    center: &Point<f64>,
    normal: &Vector<f64>,
    polygon: &[Point<f64>],
    result: &mut Vec<Point<f64>>,
)
Expand description

Cuts a polygon with the given half-space.

Given the half-space center and outward normal, this computes the intersecting between the half-space and the polygon. (Note that a point pt is considered as inside of the half-space if normal.dot(&(pt - center)) <= 0.0.