import { Angle } from "../geometry3d/Angle"; import { Point2d } from "../geometry3d/Point2dVector2d"; import { Vector3d } from "../geometry3d/Point3dVector3d"; import { IndexedPolyface, PolyfaceVisitor } from "./Polyface"; import { PolyfaceData } from "./PolyfaceData"; /** * An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh. * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet. * @public */ export declare class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor { private _currentFacetIndex; private _nextFacetIndex; private _numWrap; private _numEdges; private _polyface; protected constructor(polyface: IndexedPolyface, numWrap: number); /** Return the client polyface object. */ clientPolyface(): IndexedPolyface; /** Return the number of facets this visitor is able to visit. */ getVisitableFacetCount(): number; /** * Set the number of vertices replicated in visitor arrays (both data and index arrays). * * 0,1,2 are the most common as numWrap. * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array. * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`. * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next * two points, e.g., to form two adjacent vectors for a cross product. */ setNumWrap(numWrap: number): void; /** * Return the number of edges in the current facet. * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points. */ get numEdgesThisFacet(): number; /** Create a visitor for iterating the facets of `polyface`. */ static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor; /** Advance the iterator to a particular facet in the client polyface. */ moveToReadIndex(facetIndex: number): boolean; /** Advance the iterator to a the 'next' facet in the client polyface. */ moveToNextFacet(): boolean; /** Restart the visitor at the first facet. */ reset(): void; /** * Attempts to extract the distance parameter for the given vertex `index` on the current facet. * Returns the distance parameter as a point. Returns `undefined` on failure. */ tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined; /** * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet. * Returns the normalized parameter as a point. Returns `undefined` on failure. */ tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined; /** Return the facetIndex of the currently referenced facet in the client polyface. */ currentReadIndex(): number; /** Return the point index of vertex `i` within the currently loaded facet. */ clientPointIndex(i: number): number; /** Return the param index of vertex `i` within the currently loaded facet. */ clientParamIndex(i: number): number; /** Return the normal index of vertex `i` within the currently loaded facet. */ clientNormalIndex(i: number): number; /** Return the color index of vertex `i` within the currently loaded facet. */ clientColorIndex(i: number): number; /** Return the aux data index of vertex `i` within the currently loaded facet. */ clientAuxIndex(i: number): number; /** Clear the contents of the data arrays. */ clearArrays(): void; /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */ pushDataFrom(other: PolyfaceVisitor, index: number): void; /** * Transfer interpolated data from the other visitor. * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`. */ pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void; /** Create a visitor for a subset of the facets visitable by the instance. */ createSubsetVisitor(facetIndices: number[], numWrap?: number): IndexedPolyfaceSubsetVisitor; } /** * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface. * * The subset is defined by an array of facet indices provided when this visitor is created. * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array. * @public */ export declare class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor { private _facetIndices; private _currentSubsetIndex; private _nextSubsetIndex; private constructor(); private isValidSubsetIndex; /** * Create a visitor for iterating a subset of the facets of `polyface`. * @param polyface reference to the client polyface, supplying facets * @param facetIndices array of indices of facets in the client polyface to visit. This array is cloned. * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero. */ static createSubsetVisitor(polyface: IndexedPolyface, facetIndices: number[], numWrap?: number): IndexedPolyfaceSubsetVisitor; /** * Advance the iterator to a particular facet in the subset of client polyface facets. * @param subsetIndex index into the subset array, not to be confused with the client facet index. * @return whether the iterator was successfully moved. */ moveToReadIndex(subsetIndex: number): boolean; /** * Advance the iterator to the next facet in the subset of client polyface facets. * @return whether the iterator was successfully moved. */ moveToNextFacet(): boolean; /** Restart the visitor at the first facet. */ reset(): void; /** * Return the client polyface facet index (aka "readIndex") for the given subset index. * @param subsetIndex index into the subset array. Default is the subset index of the currently visited facet. * @return valid client polyface facet index, or `undefined` if invalid subset index. */ parentFacetIndex(subsetIndex?: number): number | undefined; /** Return the number of facets this visitor is able to visit. */ getVisitableFacetCount(): number; /** * Create a visitor for those mesh facets with normal in the same half-space as the given vector. * * For example, to visit the top facets of a tiled terrain mesh but skip the "skirt" facets, pass * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also * filter out *interior* facets that are nearly vertical, not just the "skirt" facets on the boundary. * @param mesh the mesh from which to select facets * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets * with normals in the same half-space as this vector. Default is 001. * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces. * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`. * Default is [[Geometry.smallAngleRadians]]. * @param numWrap optional number of entries replicated in visitor arrays. Default is 0. */ static createNormalComparison(mesh: IndexedPolyface | IndexedPolyfaceVisitor, compareVector?: Vector3d, sideAngle?: Angle, numWrap?: number): IndexedPolyfaceSubsetVisitor; } //# sourceMappingURL=IndexedPolyfaceVisitor.d.ts.map