Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

clip_to_plane

Function clip_to_plane 

Source
pub fn clip_to_plane<Vertex: Copy, Plane: AttributedClipPlane<Vertex>>(
    source: &[Vertex],
    destination: &mut [Vertex],
    plane: &Plane,
    traversal: ClipTraversal,
) -> Result<usize, ClipOverflow>
Expand description

Clip one attributed polygon against one half-space into destination, returning how many vertices it wrote.

Every write is bounds-checked. A convex source clipped by a plane whose inside answer is the same each time a vertex is evaluated gains at most one vertex, so source.len() + 1 slots always suffice for it; any input fits 2 * source.len(), the most one vertex and one crossing per source vertex can emit.

§Errors

ClipOverflow when destination is too small.