@itwin/core-geometry 5.0.0-dev.92 → 5.0.0-dev.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/StrokeOptions.d.ts +6 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +7 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +8 -7
- package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +17 -16
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +11 -0
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +21 -0
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -3
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +27 -23
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +47 -37
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +8 -3
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +26 -4
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.d.ts +35 -9
- package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js +59 -15
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +2 -2
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +53 -40
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +5 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +17 -3
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js +1 -0
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +20 -9
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +36 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js +117 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +4 -2
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +4 -2
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +6 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +7 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts +8 -7
- package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +17 -16
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +11 -0
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +21 -0
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -3
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +27 -23
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +47 -37
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +8 -3
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +26 -4
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.d.ts +35 -9
- package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js +59 -15
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +2 -2
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +53 -40
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +5 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +17 -3
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js +1 -0
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +20 -9
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +36 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js +117 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +4 -2
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +4 -2
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceWalker.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,qBAAa,qBAAqB;IAChC,oCAAoC;IACpC,OAAO,CAAC,SAAS,CAAkB;IACnC,+CAA+C;IAC/C,OAAO,CAAC,UAAU,CAAqB;IACvC,kBAAkB;IAClB,OAAO;IAIP;;;;OAIG;IACH,IAAW,SAAS,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED,0CAA0C;IAC1C,IAAW,QAAQ,IAAI,eAAe,GAAG,SAAS,CAEjD;IACD;;;OAGG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IACD;;;;;;OAMG;IACH,IAAW,WAAW,IAAI,OAAO,CAEhC;IACD;;;;;;OAMG;WACW,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,qBAAqB;IAKrG;;;;;;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cesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edges.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface | undefined {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface.\n * * If `edgeIndex` is undefined, the returned walker refers to the same edge as the instance.\n * * If `edgeIndex` is defined and valid, the returned walker refers to this edge.\n * * If `edgeIndex` is defined but invalid, return undefined.\n */\n public clone(edgeIndex?: number): IndexedPolyfaceWalker | undefined {\n if (edgeIndex === undefined)\n edgeIndex = this._edgeIndex;\n if (this._polyface.data.isValidEdgeIndex(edgeIndex))\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n return undefined;\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edgeIndex on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edgeIndex k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edgeIndex k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edgeIndex in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edgeIndex_ for that edge, and kB the _edgeIndex_ for the next edge around the facet.\n * * If kA is an interior edge in a 2-manifold mesh with properly oriented facets, then there is an adjacent facet\n * whose face loop contains edgeIndices kC and kD referencing the same edge vertices in reverse order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * Given this relationship, we say that edgeIndices kA and kC are _edge mates_.\n * * A non-interior edge either lies on the boundary of the mesh or is non-manifold (having more than two adjacent\n * facets, or one with the wrong orientation). These edges have no edge mate.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edgeIndex value kA. Then with the\n * aforementioned edgeIndices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface) {\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edgeIndex k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const singletons: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n const allOtherClusters: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, singletons, nullEdges, allOtherClusters);\n\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined;\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const k0 = pair[0].facetIndex;\n const k1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[k0] = k1;\n polyface.data.edgeMateIndex[k1] = k0;\n }\n }\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAuB,MAAM,sBAAsB,CAAC;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,OAAO,qBAAqB;IAChC,oCAAoC;IAC5B,SAAS,CAAkB;IACnC,+CAA+C;IACvC,UAAU,CAAqB;IACvC,kBAAkB;IAClB,YAAoB,QAAyB,EAAE,SAA6B;QAC1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IA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,CAAC,EAAE,CAAC;gBAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edges.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface | undefined {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface.\n * * If `edgeIndex` is undefined, the returned walker refers to the same edge as the instance.\n * * If `edgeIndex` is defined and valid, the returned walker refers to this edge.\n * * If `edgeIndex` is defined but invalid, return undefined.\n */\n public clone(edgeIndex?: number): IndexedPolyfaceWalker | undefined {\n if (edgeIndex === undefined)\n edgeIndex = this._edgeIndex;\n if (this._polyface.data.isValidEdgeIndex(edgeIndex))\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n return undefined;\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edgeIndex on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edgeIndex k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edgeIndex k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edgeIndex in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edgeIndex_ for that edge, and kB the _edgeIndex_ for the next edge around the facet.\n * * If kA is an interior edge in a 2-manifold mesh with properly oriented facets, then there is an adjacent facet\n * whose face loop contains edgeIndices kC and kD referencing the same edge vertices in reverse order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * Given this relationship, we say that edgeIndices kA and kC are _edge mates_.\n * * A non-interior edge either lies on the boundary of the mesh or is non-manifold (having more than two adjacent\n * facets, or one with the wrong orientation). These edges have no edge mate.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edgeIndex value kA. Then with the\n * aforementioned edgeIndices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface): void {\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edgeIndex k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const singletons: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n const allOtherClusters: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, singletons, nullEdges, allOtherClusters);\n\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined;\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const k0 = pair[0].facetIndex;\n const k1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[k0] = k1;\n polyface.data.edgeMateIndex[k1] = k0;\n }\n }\n }\n}\n\n"]}
|
|
@@ -27,7 +27,9 @@ export declare abstract class Polyface extends GeometryQuery {
|
|
|
27
27
|
* @param numWrap the number of vertices to replicate in visitor arrays.
|
|
28
28
|
*/
|
|
29
29
|
abstract createVisitor(numWrap: number): PolyfaceVisitor;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The [[PolyfaceData.twoSided]] flag.
|
|
32
|
+
*/
|
|
31
33
|
get twoSided(): boolean;
|
|
32
34
|
set twoSided(value: boolean);
|
|
33
35
|
/**
|
|
@@ -81,29 +83,13 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
81
83
|
* @param facetToFacetData optional array of face identifiers (e.g. known during clone)
|
|
82
84
|
*/
|
|
83
85
|
protected constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]);
|
|
84
|
-
/**
|
|
85
|
-
* Given an array of strictly increasing numbers, find the index of the largest number that is less than or equal
|
|
86
|
-
* to `value`.
|
|
87
|
-
* * Get an initial estimate by proportions of `value` and the first and last entries.
|
|
88
|
-
* * Linear search from there for final value.
|
|
89
|
-
* * For regularly spaced numbers (e.g., `data` is the `_facetStart` indices for a triangulated mesh or a quad mesh),
|
|
90
|
-
* the proportional estimate will be immediately correct.
|
|
91
|
-
*/
|
|
92
|
-
static searchStrictlyIncreasingNumbers(data: number[], value: number): number | undefined;
|
|
93
86
|
/** Given an edgeIndex (index into `data.pointIndex`), return the index of the facet containing the edge. */
|
|
94
87
|
edgeIndexToFacetIndex(k: number | undefined): number | undefined;
|
|
95
88
|
/**
|
|
96
89
|
* Given an edgeIndex (index into `data.pointIndex`), return the range of the edgeIndices of the containing facet.
|
|
97
|
-
* * A "face loop" is a contiguous block of edgeIndices in the polyface index arrays representing a facet.
|
|
98
90
|
* * If an edge with edgeIndex `k` is found in the facet with facetIndex `f`, then the returned range `r` satisfies
|
|
99
91
|
* `r.low = this.facetIndex0(f) <= k < this.facetIndex1(f) = r.high` and can be used to iterate the facet's face
|
|
100
|
-
* loop
|
|
101
|
-
* ````
|
|
102
|
-
* for (let k1 = r.low; k1 < r.high; k1++) {
|
|
103
|
-
* const edgeIndex = myPolyface.data.pointIndex[k1];
|
|
104
|
-
* // process this edge
|
|
105
|
-
* }
|
|
106
|
-
* ````
|
|
92
|
+
* loop. See [[facetIndex0]].
|
|
107
93
|
*/
|
|
108
94
|
edgeIndexToFaceLoop(k: number | undefined): Range1d | undefined;
|
|
109
95
|
/** Test if other is an instance of `IndexedPolyface` */
|
|
@@ -159,7 +145,7 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
159
145
|
* @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
|
|
160
146
|
* @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
|
|
161
147
|
* @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
|
|
162
|
-
* @param twoSided `true` if the facets are to be considered viewable from the back; `false`
|
|
148
|
+
* @param twoSided `true` (default) if the facets are to be considered viewable from the back; `false` if they are amenable to backface culling.
|
|
163
149
|
*/
|
|
164
150
|
static create(needNormals?: boolean, needParams?: boolean, needColors?: boolean, twoSided?: boolean): IndexedPolyface;
|
|
165
151
|
/**
|
|
@@ -260,10 +246,28 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
260
246
|
isValidFacetIndex(facetIndex: number): boolean;
|
|
261
247
|
/** Return the number of edges in a particular facet. */
|
|
262
248
|
numEdgeInFacet(facetIndex: number): number;
|
|
263
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Given a valid facet index, return the index at which its face loop starts in the index arrays.
|
|
251
|
+
* * A "face loop" is a contiguous block of indices into the parallel polyface index arrays.
|
|
252
|
+
* * Each of these indices represents an edge of a facet, thus it is sometimes called an "edgeIndex".
|
|
253
|
+
* * Together with [[facetIndex1]], this method can be used to iterate the face loop of the facet
|
|
254
|
+
* with index `iFacet` as follows:
|
|
255
|
+
* ````
|
|
256
|
+
* for (let iEdge = this.facetIndex0(iFacet); iEdge < this.facetIndex1(iFacet); iEdge++) {
|
|
257
|
+
* const iPoint = this.data.pointIndex[iEdge];
|
|
258
|
+
* const p = this.data.point[iPoint];
|
|
259
|
+
* // ... process the edge of this facet starting at point p
|
|
260
|
+
* }
|
|
261
|
+
* ````
|
|
262
|
+
*/
|
|
264
263
|
facetIndex0(facetIndex: number): number;
|
|
265
|
-
/**
|
|
264
|
+
/**
|
|
265
|
+
* Given a valid facet index, return one past the index at which its face loop ends in the index arrays.
|
|
266
|
+
* * For details, see [[facetIndex0]].
|
|
267
|
+
*/
|
|
266
268
|
facetIndex1(facetIndex: number): number;
|
|
269
|
+
/** Return a readonly reference to the facetStart array accessed by [[facetIndex0]] and [[facetIndex1]]. */
|
|
270
|
+
get facetStart(): ReadonlyArray<number>;
|
|
267
271
|
/** create a visitor for this polyface */
|
|
268
272
|
createVisitor(numWrap?: number): IndexedPolyfaceVisitor;
|
|
269
273
|
/** Return the range of (optionally transformed) points in this mesh. */
|
|
@@ -315,7 +319,7 @@ export interface PolyfaceVisitor extends PolyfaceData {
|
|
|
315
319
|
clientPolyface(): Polyface | undefined;
|
|
316
320
|
/**
|
|
317
321
|
* Set the number of vertices replicated in visitor arrays (both data and index arrays).
|
|
318
|
-
* * 0,1,2 are the most common
|
|
322
|
+
* * 0,1,2 are the most common values.
|
|
319
323
|
* * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
|
|
320
324
|
* 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.
|
|
321
325
|
* Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
|
|
@@ -323,7 +327,7 @@ export interface PolyfaceVisitor extends PolyfaceData {
|
|
|
323
327
|
* the next two points, e.g., to form two adjacent vectors for a cross product.
|
|
324
328
|
*/
|
|
325
329
|
setNumWrap(numWrap: number): void;
|
|
326
|
-
/** Clear the contents of
|
|
330
|
+
/** Clear the contents of the data arrays. Use this along with `pushDataFrom` to build up new facets. */
|
|
327
331
|
clearArrays(): void;
|
|
328
332
|
/** Transfer data from a specified index of the other visitor as new data in this visitor. */
|
|
329
333
|
pushDataFrom(other: PolyfaceVisitor, index: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyface.d.ts","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,8BAAsB,QAAS,SAAQ,aAAa;IAClD,wCAAwC;IACxC,SAAgB,gBAAgB,cAAc;IAC9C,gCAAgC;IACzB,IAAI,EAAE,YAAY,CAAC;IAC1B,kBAAkB;IAClB,SAAS,aAAa,IAAI,EAAE,YAAY;IAIxC;;;OAGG;aACa,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAC/D
|
|
1
|
+
{"version":3,"file":"Polyface.d.ts","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,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AAI,CAAC;IACd,4EAA4E;IAC5E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,4EAA4E;IAC5E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,6EAA6E;IAC7E,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,4EAA4E;IAC5E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,+EAA+E;IAC/E,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,kCAAkC;IAClC,cAAc,IAAI,QAAQ,GAAG,SAAS,CAAC;IACvC;;;;;;;;OAQG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,wGAAwG;IACxG,WAAW,IAAI,IAAI,CAAC;IACpB,6FAA6F;IAC7F,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1D;;;OAGG;IACH,wBAAwB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACzG;;;OAGG;IACH,sBAAsB,CAAC,IAAI,MAAM,CAAC;CACnC"}
|
|
@@ -31,7 +31,9 @@ export class Polyface extends GeometryQuery {
|
|
|
31
31
|
super();
|
|
32
32
|
this.data = data;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The [[PolyfaceData.twoSided]] flag.
|
|
36
|
+
*/
|
|
35
37
|
get twoSided() {
|
|
36
38
|
return this.data.twoSided;
|
|
37
39
|
}
|
|
@@ -118,43 +120,17 @@ export class IndexedPolyface extends Polyface {
|
|
|
118
120
|
else
|
|
119
121
|
this._facetToFaceData = [];
|
|
120
122
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Given an array of strictly increasing numbers, find the index of the largest number that is less than or equal
|
|
123
|
-
* to `value`.
|
|
124
|
-
* * Get an initial estimate by proportions of `value` and the first and last entries.
|
|
125
|
-
* * Linear search from there for final value.
|
|
126
|
-
* * For regularly spaced numbers (e.g., `data` is the `_facetStart` indices for a triangulated mesh or a quad mesh),
|
|
127
|
-
* the proportional estimate will be immediately correct.
|
|
128
|
-
*/
|
|
129
|
-
static searchStrictlyIncreasingNumbers(data, value) {
|
|
130
|
-
const lastQ = data.length - 1;
|
|
131
|
-
if (lastQ <= 0 || value < 0 || value >= data[lastQ])
|
|
132
|
-
return undefined;
|
|
133
|
-
let q = Math.floor((value * lastQ) / data[lastQ]);
|
|
134
|
-
while (data[q] > value)
|
|
135
|
-
q--;
|
|
136
|
-
while (data[q + 1] <= value)
|
|
137
|
-
q++;
|
|
138
|
-
return q;
|
|
139
|
-
}
|
|
140
123
|
/** Given an edgeIndex (index into `data.pointIndex`), return the index of the facet containing the edge. */
|
|
141
124
|
edgeIndexToFacetIndex(k) {
|
|
142
125
|
if (k === undefined)
|
|
143
126
|
return undefined;
|
|
144
|
-
return
|
|
127
|
+
return NumberArray.searchStrictlyIncreasingNumbers(this._facetStart, k);
|
|
145
128
|
}
|
|
146
129
|
/**
|
|
147
130
|
* Given an edgeIndex (index into `data.pointIndex`), return the range of the edgeIndices of the containing facet.
|
|
148
|
-
* * A "face loop" is a contiguous block of edgeIndices in the polyface index arrays representing a facet.
|
|
149
131
|
* * If an edge with edgeIndex `k` is found in the facet with facetIndex `f`, then the returned range `r` satisfies
|
|
150
132
|
* `r.low = this.facetIndex0(f) <= k < this.facetIndex1(f) = r.high` and can be used to iterate the facet's face
|
|
151
|
-
* loop
|
|
152
|
-
* ````
|
|
153
|
-
* for (let k1 = r.low; k1 < r.high; k1++) {
|
|
154
|
-
* const edgeIndex = myPolyface.data.pointIndex[k1];
|
|
155
|
-
* // process this edge
|
|
156
|
-
* }
|
|
157
|
-
* ````
|
|
133
|
+
* loop. See [[facetIndex0]].
|
|
158
134
|
*/
|
|
159
135
|
edgeIndexToFaceLoop(k) {
|
|
160
136
|
const q = this.edgeIndexToFacetIndex(k);
|
|
@@ -352,9 +328,9 @@ export class IndexedPolyface extends Polyface {
|
|
|
352
328
|
* @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
|
|
353
329
|
* @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
|
|
354
330
|
* @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
|
|
355
|
-
* @param twoSided `true` if the facets are to be considered viewable from the back; `false`
|
|
331
|
+
* @param twoSided `true` (default) if the facets are to be considered viewable from the back; `false` if they are amenable to backface culling.
|
|
356
332
|
*/
|
|
357
|
-
static create(needNormals = false, needParams = false, needColors = false, twoSided =
|
|
333
|
+
static create(needNormals = false, needParams = false, needColors = false, twoSided = true) {
|
|
358
334
|
return new IndexedPolyface(new PolyfaceData(needNormals, needParams, needColors, twoSided));
|
|
359
335
|
}
|
|
360
336
|
/**
|
|
@@ -503,6 +479,14 @@ export class IndexedPolyface extends Polyface {
|
|
|
503
479
|
validateAllIndices(index0 = 0, errors) {
|
|
504
480
|
const numPointIndices = this.data.pointIndex.length;
|
|
505
481
|
const messages = errors ?? [];
|
|
482
|
+
if (0 === numPointIndices) {
|
|
483
|
+
messages.push("empty pointIndex array");
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
if (index0 < 0 || index0 >= numPointIndices) {
|
|
487
|
+
messages.push("invalid input offset");
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
506
490
|
if (this.data.normalIndex && this.data.normalIndex.length !== numPointIndices)
|
|
507
491
|
messages.push("normalIndex count must match pointIndex count");
|
|
508
492
|
if (this.data.paramIndex && this.data.paramIndex.length !== numPointIndices)
|
|
@@ -512,13 +496,19 @@ export class IndexedPolyface extends Polyface {
|
|
|
512
496
|
if (this.data.edgeVisible.length !== numPointIndices)
|
|
513
497
|
messages.push("visibleIndex count must equal pointIndex count");
|
|
514
498
|
if (!Polyface.areIndicesValid(this.data.pointIndex, index0, numPointIndices, this.data.point, this.data.point ? this.data.point.length : 0))
|
|
515
|
-
messages.push("invalid point
|
|
499
|
+
messages.push("invalid point index encountered");
|
|
516
500
|
if (!Polyface.areIndicesValid(this.data.normalIndex, index0, numPointIndices, this.data.normal, this.data.normal ? this.data.normal.length : 0))
|
|
517
|
-
messages.push("invalid normal
|
|
501
|
+
messages.push("invalid normal index encountered");
|
|
518
502
|
if (!Polyface.areIndicesValid(this.data.paramIndex, index0, numPointIndices, this.data.param, this.data.param ? this.data.param.length : 0))
|
|
519
|
-
messages.push("invalid param
|
|
503
|
+
messages.push("invalid param index encountered");
|
|
520
504
|
if (!Polyface.areIndicesValid(this.data.colorIndex, index0, numPointIndices, this.data.color, this.data.color ? this.data.color.length : 0))
|
|
521
|
-
messages.push("invalid color
|
|
505
|
+
messages.push("invalid color index encountered");
|
|
506
|
+
if (this.data.edgeMateIndex) {
|
|
507
|
+
if (this.data.edgeMateIndex.length !== numPointIndices)
|
|
508
|
+
messages.push("edgeMateIndex count must equal pointIndex count");
|
|
509
|
+
else if (!this.data.edgeMateIndex.every((i) => i === undefined || this.data.isValidEdgeIndex(i)))
|
|
510
|
+
messages.push("invalid edgeMate encountered");
|
|
511
|
+
}
|
|
522
512
|
return 0 === messages.length;
|
|
523
513
|
}
|
|
524
514
|
/**
|
|
@@ -582,14 +572,34 @@ export class IndexedPolyface extends Polyface {
|
|
|
582
572
|
return this._facetStart[facetIndex + 1] - this._facetStart[facetIndex];
|
|
583
573
|
return 0;
|
|
584
574
|
}
|
|
585
|
-
/**
|
|
575
|
+
/**
|
|
576
|
+
* Given a valid facet index, return the index at which its face loop starts in the index arrays.
|
|
577
|
+
* * A "face loop" is a contiguous block of indices into the parallel polyface index arrays.
|
|
578
|
+
* * Each of these indices represents an edge of a facet, thus it is sometimes called an "edgeIndex".
|
|
579
|
+
* * Together with [[facetIndex1]], this method can be used to iterate the face loop of the facet
|
|
580
|
+
* with index `iFacet` as follows:
|
|
581
|
+
* ````
|
|
582
|
+
* for (let iEdge = this.facetIndex0(iFacet); iEdge < this.facetIndex1(iFacet); iEdge++) {
|
|
583
|
+
* const iPoint = this.data.pointIndex[iEdge];
|
|
584
|
+
* const p = this.data.point[iPoint];
|
|
585
|
+
* // ... process the edge of this facet starting at point p
|
|
586
|
+
* }
|
|
587
|
+
* ````
|
|
588
|
+
*/
|
|
586
589
|
facetIndex0(facetIndex) {
|
|
587
590
|
return this._facetStart[facetIndex];
|
|
588
591
|
}
|
|
589
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* Given a valid facet index, return one past the index at which its face loop ends in the index arrays.
|
|
594
|
+
* * For details, see [[facetIndex0]].
|
|
595
|
+
*/
|
|
590
596
|
facetIndex1(facetIndex) {
|
|
591
597
|
return this._facetStart[facetIndex + 1];
|
|
592
598
|
}
|
|
599
|
+
/** Return a readonly reference to the facetStart array accessed by [[facetIndex0]] and [[facetIndex1]]. */
|
|
600
|
+
get facetStart() {
|
|
601
|
+
return this._facetStart;
|
|
602
|
+
}
|
|
593
603
|
/** create a visitor for this polyface */
|
|
594
604
|
createVisitor(numWrap = 0) {
|
|
595
605
|
return IndexedPolyfaceVisitor.create(this, numWrap);
|