@avdl/martinez
Version:
TypeScript library for polygon boolean operations
46 lines • 1.53 kB
TypeScript
import type { Segment } from '../types';
import { Polygon } from '../types';
import { PointChain } from './PointChain';
/**
* Connects segments to form complete polygon contours
* Direct translation of Connector class from connector.h and connector.cpp
*/
export declare class Connector {
private openPolygonChains;
private closedPolygonChains;
private prevInResult;
constructor();
/**
* Add a segment to the connector, linking it to existing chains or creating a new one
* @param segment Segment to add
* @param resultTransition Optional transition information for hierarchy classification
*/
addSegment(segment: Segment, resultTransition?: boolean): void;
/**
* Get the closed polygon chains
*/
getClosedChains(): PointChain[];
/**
* Clear all chains
*/
clearAll(): void;
/**
* Get the number of closed chains
*/
getClosedChainCount(): number;
/**
* Convert the closed chains to a polygon with hierarchy classification
* @param targetPolygon Polygon to populate with the chains
*/
toPolygon(targetPolygon: Polygon): void;
/**
* Classify contour hierarchy based on spatial context
*/
private classifyContourHierarchy;
add: (segment: Segment, resultTransition?: boolean | undefined) => void;
begin: () => PointChain[];
end: () => PointChain[];
clear: () => void;
size: () => number;
}
//# sourceMappingURL=Connector.d.ts.map