warpvas
Version:
This JavaScript library enables fast and efficient image distortion transformations using Canvas 2D.
26 lines (25 loc) • 667 B
TypeScript
/**
* Calculate minimum bounding box enclosing a triangle
*
* @param a - First vertex coordinates {x: number, y: number}
* @param b - Second vertex coordinates
* @param c - Third vertex coordinates
*
* @returns Bounding box dimensions {width: number, height: number}
*
* @example
* ```typescript
* // Equilateral triangle bounding box
* calcBoundingBox(
* {x:0,y:0}, {x:100,y:0}, {x:50,y:86.6}
* ); // {width: 100, height: 86.6}
* ```
*
* @remarks
* - Dimensions are always non-negative
* - Handles floating-point coordinates
*/
export declare const calcBoundingBox: (a: Coord, b: Coord, c: Coord) => {
width: number;
height: number;
};