Skip to content

intersectConvexConvex

geometryfunctionOpenCV 5.0.0
import { intersectConvexConvex } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSp1, p2, p12, handleNested
FUNCTIONintersectConvexConvex
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

example: samples/cpp/snippets/intersectExample.cpp Examples of how intersectConvexConvex works Finds intersection of two convex polygons

Note: intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.

intersectConvexConvex(p1: Mat, p2: Mat, p12: Mat, handleNested: boolean): number;
2 available overloads
intersectConvexConvex(p1: Mat, p2: Mat, p12: Mat): number;
intersectConvexConvex(p1: Mat, p2: Mat, p12: Mat, handleNested: boolean): number;
p1

First polygon

p2

Second polygon

p12

Output destination, filled by the native operation. Output polygon describing the intersecting area

handleNested

When true, an intersection is found if one of the polygons is fully enclosed in the other. When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.

Returns

Area of intersecting polygon. May be negative, if algorithm has not converged, e.g. non-convex input.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.