Function chamfer_polygon_corners

Source
pub fn chamfer_polygon_corners(
    ring: &[DVec2],
    chamfers: &[(usize, f64)],
    depth: f64,
) -> Result<ExactBRep, GeomError>
Expand description

Chamfer several corners of an arbitrary polygon profile.

Each entry is a (corner index, setback distance) pair. The corner’s own vertex is replaced by two points, each distance back along one adjacent edge; the flat between them is the chamfer.

§Why this shares the fillet’s checks but not its geometry

A chamfer is the same corner problem with a straight cut instead of an arc, so the constraints are identical – reflex corners are a different surface, and two chamfers sharing an edge must not consume more of it than it has. What differs is that the setback IS the given distance rather than r / tan(theta/2), and the resulting wall is planar, so no blend table is needed.