minEnclosingTriangle
import { minEnclosingTriangle } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Finds a triangle of minimum area enclosing a 2D point set and returns its area.
The function finds a triangle of minimum area enclosing the given set of 2D points and returns its area. The output for a given 2D point set is shown in the image below. 2D points are depicted in red* and the enclosing triangle in yellow.

The implementation of the algorithm is based on O'Rourke's [ORourke86] and Klee and Laskowski's
[KleeLaskowski85] papers. O'Rourke provides a \theta(n) algorithm for finding the minimal
enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function
takes a 2D point set as input an additional preprocessing step of computing the convex hull of the
2D point set is required. The complexity of the #convexHull function is O(n log(n)) which is higher
than \theta(n). Thus the overall complexity of the function is O(n log(n)).
minEnclosingTriangle(points: Mat, triangle: Mat): number;pointsInput vector of 2D points with depth CV_32S or CV_32F, stored in std::vector<> or Mat
triangleOutput destination, filled by the native operation. Output vector of three 2D points defining the vertices of the triangle. The depth of the OutputArray must be CV_32F.
The number result.
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.