import CircularLinkedList from '../data_structures/circular_linked_list'; import * as geom from './index'; import { Box } from './Box'; import type { Edge } from './Edge'; import type { Point } from './Point'; import type { Polygon } from './Polygon'; import type { PlanarSet } from '../data_structures/PlanarSet'; /** * Class representing a face (closed loop) in a [polygon]{@link geom.Polygon} object. * Face is a circular bidirectional linked list of [edges]{@link geom.Edge}. * Face object cannot be instantiated with a constructor. * Instead, use [polygon.addFace()]{@link geom.Polygon#addFace} method. *
* Note, that face only set entry point to the linked list of edges but does not contain edges by itself. * Container of edges is a property of the polygon object.
* * @example * // Face implements "next" iterator which enables to iterate edges in for loop: * for (let edge of face) { * console.log(edge.shape.length) // do something * } * * // Instead, it is possible to iterate edges as linked list, starting from face.first: * let edge = face.first; * do { * console.log(edge.shape.length); // do something * edge = edge.next; * } while (edge != face.first) */ export declare class Face extends CircularLinkedList { _box: Box | undefined; _orientation: number | undefined; constructor(polygon: Polygon); constructor(polygon: Polygon, points: geom.Point[]); constructor(polygon: Polygon, shape: [number, number][]); constructor(polygon: Polygon, shape: (geom.Segment | geom.Arc)[]); constructor(polygon: Polygon, path: geom.Path); constructor(polygon: Polygon, face: Face); constructor(polygon: Polygon, shape: geom.Box | geom.Circle); constructor(polygon: Polygon, a: geom.Edge, b: geom.Edge); /** * Return array of edges from first to last */ get edges(): any[]; /** * Return array of shapes which comprise face */ get shapes(): any[]; /** * Return bounding box of the face */ get box(): geom.Box; /** * Get all edges length */ get perimeter(): any; /** * Get point on face boundary at given length * @param length - The length along the face boundary */ pointAtLength(length: number): any; static points2segments(points: Point[]): any[]; shapes2face(edges: any, shapes: any): void; /** * Append edge after the last edge of the face (and before the first edge).
* @param edge - Edge to be appended to the linked list */ append(edge: Edge): this; /** * Insert edge newEdge into the linked list after the edge edgeBefore
* @param newEdge - Edge to be inserted into linked list * @param edgeBefore - Edge to insert newEdge after it */ insert(newEdge: Edge, edgeBefore: Edge): this; /** * Remove the given edge from the linked list of the face
* @param edge - Edge to be removed */ remove(edge: Edge): this; /** * Merge current edge with the next edge. Given edge will be extended, * next edge after it will be removed. The distortion of the polygon * is on the responsibility of the user of this method * @param edge - edge to be extended */ mergeWithNextEdge(edge: Edge): this; /** * Reverse orientation of the face: first edge become last and vice a verse, * all edges starts and ends swapped, direction of arcs inverted. If face was oriented * clockwise, it becomes counterclockwise and vice versa */ reverse(): void; /** * Set arc_length property for each of the edges in the face. * Arc_length of the edge it the arc length from the first edge of the face */ setArcLength(): void; setOneEdgeArcLength(edge: any): void; /** * Returns the absolute value of the area of the face */ area(): number; /** * Returns signed area of the simple face. * Face is simple if it has no self intersections that change its orientation. * Then the area will be positive if the orientation of the face is clockwise, * and negative if orientation is counterclockwise. * It may be zero if polygon is degenerated. */ signedArea(): number; /** * Return face orientation: one of geom.ORIENTATION.CW, geom.ORIENTATION.CCW, geom.ORIENTATION.NOT_ORIENTABLE
* According to Green theorem the area of a closed curve may be calculated as double integral, * and the sign of the integral will be defined by the direction of the curve. * When the integral ("signed area") will be negative, direction is counterclockwise, * when positive - clockwise and when it is zero, polygon is not orientable. * See {@link https://mathinsight.org/greens_theorem_find_area} */ orientation(): number; /** * Returns true if face of the polygon is simple (no self-intersection points found) * NOTE: this method is incomplete because it does not exclude touching points. * Self intersection test should check if polygon change orientation in the test point. * @param edges - reference to polygon edges to provide search index */ isSimple(edges: PlanarSet): boolean; static getSelfIntersections(face: any, edges: any, exitOnFirst?: boolean): any[]; /** * Returns edge which contains given point */ findEdgeByPoint(p: Point): geom.Edge; /** * Returns new polygon created from one face */ toPolygon(): geom.Polygon; toJSON(): any[]; } //# sourceMappingURL=Face.d.ts.map