UNPKG

fabric-texture

Version:

This JavaScript library enables fast and efficient image distortion transformations using Canvas 2D.

31 lines (30 loc) 973 B
/** * 计算三角形的最小包围盒(Bounding Box) * * 计算能完全包含三角形的最小矩形区域。 * 通过计算三个顶点的最大和最小坐标值来确定包围盒的尺寸。 * * @param a - 三角形的第一个顶点坐标 {x: number, y: number} * @param b - 三角形的第二个顶点坐标 {x: number, y: number} * @param c - 三角形的第三个顶点坐标 {x: number, y: number} * * @returns {object} 包围盒的尺寸 * @property {number} width - 包围盒的宽度 * @property {number} height - 包围盒的高度 * * @example * ```typescript * // 计算等边三角形的包围盒 * const p1 = { x: 0, y: 0 }; * const p2 = { x: 100, y: 0 }; * const p3 = { x: 50, y: 86.6 }; * * const box = calcBoundingBox(p1, p2, p3); * console.log(box); * // 输出: { width: 100, height: 86.6 } * ``` */ export declare const calcBoundingBox: (a: Coord, b: Coord, c: Coord) => { width: number; height: number; };