UNPKG

@awayjs/renderer

Version:
48 lines 1.66 kB
import { Box, Matrix3D } from '@awayjs/core'; import { AttributesView, Short2Attributes } from '@awayjs/stage'; export type TPoint = [number, number]; export type TEdge = { a: number; b: number; angle: number; }; export interface IHullData { middle: TPoint; points: Array<TPoint>; edges: Array<TEdge>; } export interface IHullImpl extends IHullData { fetchEdge(angle: number): TEdge; fetchPoint(index: number): TPoint; dispose(): void; } export declare class ConvexHull implements IHullImpl { middle: TPoint; points: TPoint[]; edges: TEdge[]; ranges: Array<{ from: number; to: number; }>; constructor(obj: IHullData); private _constructRanges; fetchEdge(angle: number): TEdge; fetchPoint(index: number): TPoint; dispose(): void; } export declare class ConvexHullUtils { private static ccw; private static cmpPoints; private static cmpEdges; static EPS: number; static nearest(x0: number, y0: number, x1: number, y1: number): boolean; /** * @description Generate a hull by modified Graham scan, not required sorting by angle * @see https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain */ private static generateHull; static fromBuffer(buffer: Float32Array, dimension?: number): IHullImpl | null; static fromAttribute(posAttrs: AttributesView, indexAttrs: Short2Attributes, step: number, count: number, offset?: number): IHullImpl | null; static createBox(simpleHull: IHullData, matrix?: Matrix3D, target?: Box, cache?: Box): Box; } //# sourceMappingURL=ConvexHullUtils.d.ts.map