@itwin/core-geometry 4.4.0-dev.2 → 4.4.0-dev.20
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/CHANGELOG.md +21 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts +7 -5
- package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +8 -6
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +16 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +18 -10
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +20 -10
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +81 -76
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +126 -111
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.d.ts +23 -18
- package/lib/cjs/topology/HalfEdgeGraphValidation.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js +23 -18
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts +17 -10
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +38 -17
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.d.ts +13 -13
- package/lib/cjs/topology/SignedDataSummary.d.ts.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js +3 -3
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.d.ts +27 -21
- package/lib/cjs/topology/XYParitySearchContext.d.ts.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js +73 -71
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.d.ts +7 -5
- package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +8 -6
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +16 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +18 -10
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +20 -10
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +81 -76
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +126 -111
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.d.ts +23 -18
- package/lib/esm/topology/HalfEdgeGraphValidation.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js +23 -18
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts +17 -10
- package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js +38 -17
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.d.ts +13 -13
- package/lib/esm/topology/SignedDataSummary.d.ts.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js +3 -3
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.d.ts +27 -21
- package/lib/esm/topology/XYParitySearchContext.d.ts.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js +73 -71
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAY,aAAa,EAAE,YAAY,EAAmD,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE;GACG;AACH,MAAM,OAAO,kBAAkB;IAG7B;;;;OAIG;IACH,YAAmB,IAAkB,EAAE,cAAuB,IAAI;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IACD,yEAAyE;IAClE,QAAQ,CAAC,IAAc;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;CAEF;AACD,oCAAoC;AACpC,MAAM,OAAO,mBAAmB;IAE9B;;;OAGG;IACK,MAAM,CAAC,yBAAyB,CAAC,QAAkB,EAAE,IAAY,EAAE,YAAwB,EAAE,eAA2B;QAC9H,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,QAAQ,CAAC,iBAAiB,CAAC,CAAC,IAAc,EAAE,EAAE;YAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnB,YAAY,CAAC,IAAI,C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QAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAW,EAAE;YACjD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvF,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,OAAe,EAAE,EAAE;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE;YACrC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;SACnG;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\n\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeToNumberFunction } from \"./Graph\";\r\nimport { SignedDataSummary } from \"./SignedDataSummary\";\r\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\r\n\r\n/**\r\n * Interface for an object that executes boolean tests on edges.\r\n */\r\nexport interface HalfEdgeTestObject {\r\n testEdge(h: HalfEdge): boolean;\r\n}\r\n/**\r\n */\r\nexport class HalfEdgeMaskTester {\r\n private _targetMask: HalfEdgeMask;\r\n private _targetValue: boolean;\r\n /**\r\n *\r\n * @param mask mask to test in `testEdge` function\r\n * @param targetValue value to match for true return\r\n */\r\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\r\n this._targetMask = mask;\r\n this._targetValue = targetValue;\r\n }\r\n /** Return true if the value of the targetMask matches the targetValue */\r\n public testEdge(edge: HalfEdge): boolean {\r\n return edge.isMaskSet(this._targetMask) === this._targetValue;\r\n }\r\n\r\n}\r\n// Search services for HalfEdgeGraph\r\nexport class HalfEdgeGraphSearch {\r\n\r\n /**\r\n * * for each node of face, set the mask push to allNodesStack\r\n * * push the faceSeed on onePerFaceStack[]\r\n */\r\n private static pushAndMaskAllNodesInFace(faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[]) {\r\n onePerFaceStack.push(faceSeed);\r\n faceSeed.collectAroundFace((node: HalfEdge) => {\r\n node.setMask(mask);\r\n allNodeStack.push(node);\r\n });\r\n }\r\n\r\n /**\r\n * Search an array of faceSeed nodes for the face with the most negative area.\r\n * @param oneCandidateNodePerFace array containing one node from each face to be considered.\r\n * @returns node on the minimum area face, or undefined if no such face (e.g., all faces have zero area).\r\n */\r\n public static findMinimumAreaFace(oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction): HalfEdge | undefined {\r\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\r\n return summary.largestNegativeItem;\r\n }\r\n\r\n /**\r\n * static method for face area computation -- useful as function parameter in collect FaceAreaSummary.\r\n * * This simply calls `node.signedFaceArea ()`\r\n * @param node instance for signedFaceArea call.\r\n */\r\n public static signedFaceArea(node: HalfEdge): number { return node.signedFaceArea(); }\r\n /**\r\n *\r\n * Return a summary structure data about face (or other numeric quantity if the caller's areaFunction returns other value)\r\n * * The default areaFunction computes area of polygonal face.\r\n * * Callers with curved edge graphs must supply their own area function.\r\n * @param source graph or array of nodes to examine\r\n * @param collectAllNodes flag to pass to the SignedDataSummary constructor to control collection of nodes.\r\n * @param areaFunction function to all to obtain area (or other numeric value)\r\n */\r\n public static collectFaceAreaSummary(source: HalfEdgeGraph | HalfEdge[], collectAllNodes: boolean = false,\r\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node)): SignedDataSummary<HalfEdge> {\r\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\r\n let allFaces: HalfEdge[];\r\n\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n\r\n for (const node of allFaces) {\r\n const area = areaFunction(node);\r\n result.announceItem(node, area);\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * * Test if the graph is triangulated.\r\n * * Return false if:\r\n * * Positive area face with more than 3 edges\r\n * * more than 1 negative area face with `allowMultipleNegativeAreaFaces` false\r\n * * 2-edge faces are ignored.\r\n */\r\n public static isTriangulatedCCW(source: HalfEdgeGraph | HalfEdge[], allowMultipleNegativeAreaFaces: boolean = true, numPositiveExceptionsAllowed = 0): boolean {\r\n let allFaces: HalfEdge[];\r\n\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n let numNegative = 0;\r\n let numPositiveExceptions = 0;\r\n for (const node of allFaces) {\r\n const numEdges = node.countEdgesAroundFace();\r\n if (numEdges >= 3) {\r\n const area = node.signedFaceArea();\r\n if (area > 0) {\r\n if (numEdges > 3) {\r\n numPositiveExceptions++;\r\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\r\n return false;\r\n }\r\n } else {\r\n numNegative++;\r\n if (numNegative > 1) {\r\n if (!allowMultipleNegativeAreaFaces)\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Search to all accessible faces from given seed.\r\n * * The returned array contains one representative node in each face of the connected component.\r\n * * If (nonnull) parity mask is given, on return:\r\n * * It is entirely set or entirely clear around each face\r\n * * It is entirely set on all faces that are an even number of face-to-face steps away from the seed.\r\n * * It is entirely clear on all faces that are an odd number of face-to-face steps away from the seed.\r\n * @param seedEdge first edge to search.\r\n * @param visitMask mask applied to all faces as visited.\r\n * @param parityMask mask to apply (a) to first face, (b) to faces with alternating parity during the search.\r\n */\r\n private static parityFloodFromSeed(seedEdge: HalfEdge, visitMask: HalfEdgeMask, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask): HalfEdge[] {\r\n const faces: HalfEdge[] = [];\r\n if (seedEdge.isMaskSet(visitMask)) return faces; // empty\r\n\r\n const allMasks = parityMask | visitMask;\r\n const stack: HalfEdge[] = [];\r\n // arbitrarily call the seed face exterior ... others will alternate as visited.\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(seedEdge, allMasks, stack, faces); // Start with exterior as mask\r\n while (stack.length > 0) {\r\n const p = stack.pop()!;\r\n const mate = p.edgeMate;\r\n if (!mate)\r\n continue;\r\n if (!mate.isMaskSet(visitMask)) {\r\n let newState = p.isMaskSet(parityMask);\r\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\r\n newState = !newState;\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\r\n }\r\n }\r\n return faces;\r\n }\r\n /**\r\n * * Search the given faces for the one with the minimum area.\r\n * * If the mask in that face is OFF, toggle it on (all half edges of) all the faces.\r\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\r\n * @param graph parent graph\r\n * @param parityMask mask which was previously set with alternating parity, but with an arbitrary start face.\r\n * @param faces array of faces to search.\r\n */\r\n private static correctParityInSingleComponent(_graph: HalfEdgeGraph, mask: HalfEdgeMask, faces: HalfEdge[]) {\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\r\n if (!exteriorHalfEdge) {\r\n } else if (exteriorHalfEdge.isMaskSet(mask)) {\r\n // all should be well .. nothing to do.\r\n } else {\r\n // TOGGLE around the face (assuming all are consistent with the seed)\r\n for (const faceSeed of faces) {\r\n if (faceSeed.isMaskSet(mask)) {\r\n faceSeed.clearMaskAroundFace(mask);\r\n } else {\r\n faceSeed.setMaskAroundFace(mask);\r\n }\r\n }\r\n }\r\n }\r\n /** Apply correctParityInSingleComponent to each array in components. (Quick exit if mask in NULL_MASK) */\r\n private static correctParityInComponentArrays(graph: HalfEdgeGraph, mask: HalfEdgeMask, components: HalfEdge[][]) {\r\n if (mask === HalfEdgeMask.NULL_MASK)\r\n return;\r\n for (const facesInComponent of components)\r\n HalfEdgeGraphSearch.correctParityInSingleComponent(graph, mask, facesInComponent);\r\n }\r\n /**\r\n * Collect arrays gathering faces by connected component.\r\n * @param graph graph to inspect\r\n * @param parityEdgeTester (optional) function to test if an edge is a parity change (e.g., a boundary edge).\r\n * @param parityMask (optional, along with parityEdgeTester) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.\r\n */\r\n public static collectConnectedComponentsWithExteriorParityMasks(graph: HalfEdgeGraph, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK): HalfEdge[][] {\r\n const components = [];\r\n const visitMask = HalfEdgeMask.VISITED;\r\n const allMasks = parityMask | visitMask;\r\n graph.clearMask(allMasks);\r\n for (const faceSeed of graph.allHalfEdges) {\r\n if (!faceSeed.isMaskSet(HalfEdgeMask.VISITED)) {\r\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\r\n components.push(newFaces);\r\n }\r\n }\r\n HalfEdgeGraphSearch.correctParityInComponentArrays(graph, parityMask, components);\r\n return components;\r\n }\r\n /**\r\n * Test if (x,y) is inside (1), on an edge (0) or outside (-1) a face.\r\n * @param seedNode any node on the face loop\r\n * @param x x coordinate of test point.\r\n * @param y y coordinate of test point.\r\n */\r\n public static pointInOrOnFaceXY(seedNode: HalfEdge, x: number, y: number): number | undefined {\r\n const context = new XYParitySearchContext(x, y);\r\n // walk around looking for an accepted node to start the search (seedNode is usually ok!)\r\n let nodeA = seedNode;\r\n let nodeB = seedNode.faceSuccessor;\r\n for (; ; nodeA = nodeB) {\r\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\r\n break;\r\n if (nodeB === seedNode) {\r\n // umm.. the face is all on the x axis?\r\n return context.classifyCounts();\r\n }\r\n nodeB = nodeA.faceSuccessor;\r\n }\r\n\r\n // nodeB is the real start node for search ... emit ends of each edge around the face,\r\n // stopping after emitting nodeB as an edge end.\r\n let node = nodeB.faceSuccessor;\r\n for (; ;) {\r\n if (!context.advance(node.x, node.y)) {\r\n return context.classifyCounts();\r\n }\r\n if (node === nodeB)\r\n break;\r\n node = node.faceSuccessor;\r\n }\r\n return context.classifyCounts();\r\n }\r\n /**\r\n * Announce nodes that are \"extended face boundary\" by conditions (usually mask of node and mate) in test functions.\r\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\r\n * * \"Around the vertex\" from nodeA means\r\n * * First look at nodeA.faceSuccessor;\r\n * * Then look at vertexPredecessor around that vertex loop.\r\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\r\n * * The counter of the announceEdge function is zero for the first edge, then increases with each edge.\r\n * @param seed start node.\r\n * @param isBoundaryEdge\r\n * @param announceEdge\r\n */\r\n public static collectExtendedBoundaryLoopFromSeed(seed: HalfEdge, visitMask: HalfEdgeMask, isBoundaryEdge: HalfEdgeToBooleanFunction,\r\n announceEdge: (edge: HalfEdge, counter: number) => void) {\r\n let counter = 0;\r\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\r\n announceEdge(seed, counter++);\r\n seed.setMask(visitMask);\r\n const vertexBase = seed.faceSuccessor;\r\n let candidateAroundVertex = vertexBase;\r\n for (; ;) {\r\n if (candidateAroundVertex.getMask(visitMask))\r\n return;\r\n if (isBoundaryEdge(candidateAroundVertex)) {\r\n seed = candidateAroundVertex;\r\n break;\r\n }\r\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\r\n if (candidateAroundVertex === vertexBase)\r\n break;\r\n }\r\n }\r\n }\r\n /**\r\n * Collect arrays of nodes \"around the boundary\" of a graph with extraneous (non-boundary) edges.\r\n * * The \"boundary\" is nodes that do NOT have the exterior mask, but whose mates DO have the exterior mask.\r\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\r\n * * \"Around the vertex\" from nodeA means\r\n * * First look at nodeA.faceSuccessor;\r\n * * Then look at vertexPredecessor around that vertex loop.\r\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\r\n * @param seed start node.\r\n * @param isBoundaryNode\r\n * @param announceNode\r\n */\r\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\r\n const loops: HalfEdge[][] = [];\r\n const visitMask = graph.grabMask(true);\r\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\r\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\r\n };\r\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\r\n if (counter === 0)\r\n loops.push([]);\r\n loops[loops.length - 1].push(edge);\r\n };\r\n for (const seed of graph.allHalfEdges) {\r\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\r\n }\r\n graph.dropMask(visitMask);\r\n return loops;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAY,aAAa,EAAE,YAAY,EAAmD,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qB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BACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE;YACrC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;SACnG;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\nimport { Range1d } from \"../geometry3d/Range\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeToNumberFunction } from \"./Graph\";\r\nimport { SignedDataSummary } from \"./SignedDataSummary\";\r\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\r\n\r\n// cspell:word internaldocs\r\n\r\n/** Interface for an object that executes boolean tests on edges. */\r\nexport interface HalfEdgeTestObject {\r\n testEdge(h: HalfEdge): boolean;\r\n}\r\n/** Class to test match of half edge mask. */\r\nexport class HalfEdgeMaskTester {\r\n private _targetMask: HalfEdgeMask;\r\n private _targetValue: boolean;\r\n /**\r\n * Constructor\r\n * @param mask mask to test in `testEdge` function\r\n * @param targetValue value to match for true return\r\n */\r\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\r\n this._targetMask = mask;\r\n this._targetValue = targetValue;\r\n }\r\n /** Return true if the value of the targetMask matches the targetValue. */\r\n public testEdge(edge: HalfEdge): boolean {\r\n return edge.isMaskSet(this._targetMask) === this._targetValue;\r\n }\r\n}\r\n/** Class for different types of searches for HalfEdgeGraph. */\r\nexport class HalfEdgeGraphSearch {\r\n /**\r\n * Static method for face area computation -- useful as function parameter in `collectFaceAreaSummary`.\r\n * * This simply calls `node.signedFaceArea()`\r\n * @param node instance for signedFaceArea call.\r\n */\r\n public static signedFaceArea(node: HalfEdge): number {\r\n return node.signedFaceArea();\r\n }\r\n /**\r\n * Return a summary of face data (e.g., area) as computed by the callback on the faces of the graph.\r\n * * Callers with curved edge graphs must supply their own area function.\r\n * @param source graph or array of nodes to examine.\r\n * @param collectAllNodes flag to pass to the `SignedDataSummary` constructor to control collection of nodes.\r\n * @param areaFunction function to obtain area (or other numeric value). Default computes polygonal face area.\r\n */\r\n public static collectFaceAreaSummary(\r\n source: HalfEdgeGraph | HalfEdge[],\r\n collectAllNodes: boolean = false,\r\n areaFunction: NodeToNumberFunction = (node) => HalfEdgeGraphSearch.signedFaceArea(node),\r\n ): SignedDataSummary<HalfEdge> {\r\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\r\n let allFaces: HalfEdge[];\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n for (const node of allFaces) {\r\n const area = areaFunction(node);\r\n result.announceItem(node, area);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Search the graph for the face with the most negative area.\r\n * @param oneCandidateNodePerFace graph or an array containing one node from each face to be considered.\r\n * @returns node on the negative area face with largest absolute area, or `undefined` if no negative area face.\r\n */\r\n public static findMinimumAreaFace(\r\n oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[], faceAreaFunction?: NodeToNumberFunction,\r\n ): HalfEdge | undefined {\r\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\r\n return summary.largestNegativeItem;\r\n }\r\n /**\r\n * Test if the graph is triangulated.\r\n * * Return `false` if:\r\n * * number of positive area faces with more than 3 edges is larger than `numPositiveExceptionsAllowed`.\r\n * * graph has more than 1 negative area face when `allowMultipleNegativeAreaFaces` is `false`.\r\n * * 2-edge faces are ignored.\r\n */\r\n public static isTriangulatedCCW(\r\n source: HalfEdgeGraph | HalfEdge[],\r\n allowMultipleNegativeAreaFaces: boolean = true,\r\n numPositiveExceptionsAllowed: number = 0,\r\n ): boolean {\r\n let allFaces: HalfEdge[];\r\n if (source instanceof HalfEdgeGraph)\r\n allFaces = source.collectFaceLoops();\r\n else\r\n allFaces = source;\r\n let numNegative = 0;\r\n let numPositiveExceptions = 0;\r\n for (const node of allFaces) {\r\n const numEdges = node.countEdgesAroundFace();\r\n if (numEdges >= 3) {\r\n const area = node.signedFaceArea();\r\n if (area > 0) {\r\n if (numEdges > 3) {\r\n numPositiveExceptions++;\r\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\r\n return false;\r\n }\r\n } else {\r\n numNegative++;\r\n if (numNegative > 1) {\r\n if (!allowMultipleNegativeAreaFaces)\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Process a face during graph traversal.\r\n * @param faceSeed a node in the face.\r\n * @param mask mask to set on each node of the face.\r\n * @param allNodeStack array appended with each node of the face.\r\n * @param onePerFaceStack array appended with `faceSeed`.\r\n */\r\n private static pushAndMaskAllNodesInFace(\r\n faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[],\r\n ): void {\r\n onePerFaceStack.push(faceSeed);\r\n faceSeed.collectAroundFace((node: HalfEdge) => {\r\n node.setMask(mask);\r\n allNodeStack.push(node);\r\n });\r\n }\r\n /**\r\n * Traverse (via Depth First Search) to all accessible faces from the given seed.\r\n * @param faceSeed first node to start the traverse.\r\n * @param visitMask mask applied to all faces as visited.\r\n * @param parityEdgeTester function to test if an edge is adjacent to two faces of opposite parity, e.g., a boundary\r\n * edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not supplied and `parityMask`\r\n * is supplied, the default parity rule is to alternate parity state in a \"bullseye\" pattern starting at the seed face,\r\n * with each successive concentric ring of faces at constant topological distance from the seed face receiving the\r\n * opposite parity state of the previous ring.\r\n * @param parityMask mask to apply to the first face and faces that share the same parity as the first face, as\r\n * determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If (non-null) parity mask\r\n * is given, on return it is entirely set or entirely clear around each face.\r\n * @returns an array that contains one representative node in each face of the connected component.\r\n */\r\n private static parityFloodFromSeed(\r\n faceSeed: HalfEdge,\r\n visitMask: HalfEdgeMask,\r\n parityEdgeTester: HalfEdgeTestObject | undefined,\r\n parityMask: HalfEdgeMask,\r\n ): HalfEdge[] {\r\n const faces: HalfEdge[] = [];\r\n if (faceSeed.isMaskSet(visitMask))\r\n return faces; // empty array\r\n const allMasks = parityMask | visitMask;\r\n const stack: HalfEdge[] = [];\r\n // the seed face is arbitrarily assigned the parity mask\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(faceSeed, allMasks, stack, faces);\r\n while (stack.length > 0) {\r\n const p = stack.pop()!;\r\n const mate = p.edgeMate;\r\n if (!mate)\r\n continue;\r\n if (!mate.isMaskSet(visitMask)) {\r\n let newState = p.isMaskSet(parityMask);\r\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\r\n newState = !newState;\r\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\r\n }\r\n }\r\n return faces;\r\n }\r\n /**\r\n * * Correct the parity mask in the faces of a component.\r\n * * It is assumed that the parity mask is applied _consistently_ throughout the supplied faces, but maybe\r\n * not _correctly_.\r\n * * A consistently applied parity mask is \"correct\" if it is set on the negative area (\"exterior\") face of\r\n * a connected component.\r\n * * This method finds a face with negative area and toggles the mask throughout the input faces if this face\r\n * lacks the parity mask.\r\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\r\n */\r\n private static correctParityInSingleComponent(parityMask: HalfEdgeMask, faces: HalfEdge[]): void {\r\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\r\n if (!exteriorHalfEdge) {\r\n // graph has all degenerate faces; do nothing\r\n } else if (exteriorHalfEdge.isMaskSet(parityMask)) {\r\n // all should be well; nothing to do\r\n } else {\r\n for (const faceSeed of faces) {\r\n if (faceSeed.isMaskSet(parityMask)) {\r\n faceSeed.clearMaskAroundFace(parityMask);\r\n } else {\r\n faceSeed.setMaskAroundFace(parityMask);\r\n }\r\n }\r\n }\r\n }\r\n /** Apply `correctParityInSingleComponent` to each array in components (quick exit if `parityMask` is `NULL_MASK`). */\r\n private static correctParityInComponentArrays(parityMask: HalfEdgeMask, components: HalfEdge[][]): void {\r\n if (parityMask === HalfEdgeMask.NULL_MASK)\r\n return;\r\n for (const facesInComponent of components)\r\n HalfEdgeGraphSearch.correctParityInSingleComponent(parityMask, facesInComponent);\r\n }\r\n /**\r\n * Collect connected components of the graph (via Depth First Search).\r\n * @param graph graph to inspect.\r\n * @param parityEdgeTester (optional) function to test if an edge is adjacent to two faces of opposite parity,\r\n * e.g., a boundary edge that separates an \"interior\" face and an \"exterior\" face. If `parityEdgeTester` is not\r\n * supplied and `parityMask` is supplied, the default parity rule is to alternate parity state in a \"bullseye\"\r\n * pattern starting at the seed face, with each successive concentric ring of faces at constant topological\r\n * distance from the seed face receiving the opposite parity state of the previous ring.\r\n * @param parityMask (optional) mask to apply to the first face and faces that share the same parity as the\r\n * first face, as determined by the parity rule. If this is `NULL_MASK`, there is no record of parity. If\r\n * (non-null) parity mask is given, on return it is entirely set or entirely clear around each face.\r\n * @returns the components of the graph, each component represented by an array of nodes, one node per face\r\n * of the component. In other words, entry [i][j] is a HalfEdge in the j_th face loop of the i_th component.\r\n */\r\n public static collectConnectedComponentsWithExteriorParityMasks(\r\n graph: HalfEdgeGraph,\r\n parityEdgeTester: HalfEdgeTestObject | undefined,\r\n parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK,\r\n ): HalfEdge[][] {\r\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\r\n const components = [];\r\n const visitMask = HalfEdgeMask.VISITED;\r\n const allMasks = parityMask | visitMask;\r\n graph.clearMask(allMasks);\r\n for (const faceSeed of graph.allHalfEdges) {\r\n if (!faceSeed.isMaskSet(visitMask)) {\r\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\r\n // parityFloodFromSeed does not return an empty array because it is called on an unvisited faceSeed\r\n components.push(newFaces);\r\n }\r\n }\r\n HalfEdgeGraphSearch.correctParityInComponentArrays(parityMask, components);\r\n return components;\r\n }\r\n /**\r\n * Test if test point (xTest,yTest) is inside/outside a face or on an edge.\r\n * @param seedNode any node on the face loop.\r\n * @param xTest x coordinate of the test point.\r\n * @param yTest y coordinate of the test point.\r\n * @returns 0 if ON, 1 if IN, -1 if OUT.\r\n */\r\n public static pointInOrOnFaceXY(seedNode: HalfEdge, xTest: number, yTest: number): number | undefined {\r\n const context = new XYParitySearchContext(xTest, yTest);\r\n // walk around looking for an accepted node to start the search (seedNode is usually ok)\r\n let nodeA = seedNode;\r\n let nodeB = seedNode.faceSuccessor;\r\n for (; ; nodeA = nodeB) {\r\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\r\n break;\r\n if (nodeB === seedNode) {\r\n // the test point and the face are all on line \"y = yTest\"\r\n const range = Range1d.createXX(nodeB.x, nodeB.faceSuccessor.x);\r\n return range.containsX(xTest) ? 0 : -1;\r\n }\r\n nodeB = nodeA.faceSuccessor;\r\n }\r\n // nodeB is the real start node for search, so stop when we revisit it. For each edge, accumulate parity and hits\r\n let nodeC = nodeB.faceSuccessor;\r\n for (; ;) {\r\n if (!context.advance(nodeC.x, nodeC.y)) {\r\n return context.classifyCounts();\r\n }\r\n if (nodeC === nodeB)\r\n break;\r\n nodeC = nodeC.faceSuccessor;\r\n }\r\n return context.classifyCounts();\r\n }\r\n /**\r\n * Collect boundary edges starting from `seed`.\r\n * * If `seed` is not a boundary node or is already visited, the function exists early.\r\n * @param seed start node.\r\n * @param visitMask mask to set on processed nodes.\r\n * @param isBoundaryEdge function to test if an edge in a boundary edge.\r\n * @param announceEdgeInBoundary callback invoked on each edge in the boundary loop in order. The counter is zero\r\n * for the first edge, and incremented with each successive edge.\r\n */\r\n public static collectExtendedBoundaryLoopFromSeed(\r\n seed: HalfEdge,\r\n visitMask: HalfEdgeMask,\r\n isBoundaryEdge: HalfEdgeToBooleanFunction,\r\n announceEdgeInBoundary: (edge: HalfEdge, counter: number) => void,\r\n ): void {\r\n let counter = 0;\r\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\r\n announceEdgeInBoundary(seed, counter++);\r\n seed.setMask(visitMask);\r\n const vertexBase = seed.faceSuccessor;\r\n let candidateAroundVertex = vertexBase;\r\n for (; ;) {\r\n if (candidateAroundVertex.getMask(visitMask)) // end of boundary loop\r\n return;\r\n if (isBoundaryEdge(candidateAroundVertex)) {\r\n seed = candidateAroundVertex;\r\n break;\r\n }\r\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\r\n if (candidateAroundVertex === vertexBase)\r\n break; // prevent infinite loop in case exteriorMask is not set on the edge mate of the boundary edge\r\n }\r\n }\r\n }\r\n /**\r\n * Collect boundary edges in the graph.\r\n * * A boundary edge is defined by `exteriorMask` being set on only its \"exterior\" edge mate.\r\n * * Each boundary edge is identified in the output by its edge mate that lacks `exteriorMask`.\r\n * * Each inner array is ordered in the output so that its boundary edges form a connected path. If `exteriorMask`\r\n * is preset consistently around each \"exterior\" face, these paths are loops.\r\n * @param graph the graph to query\r\n * @param exteriorMask mask preset on exactly one side of boundary edges\r\n * @returns array of boundary loops, each loop an array of the unmasked mates of boundary edges\r\n */\r\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\r\n // Illustration of the algorithm can be found at geometry/internaldocs/Graph.md\r\n const loops: HalfEdge[][] = [];\r\n const visitMask = graph.grabMask(true);\r\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\r\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\r\n };\r\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\r\n if (counter === 0)\r\n loops.push([]);\r\n loops[loops.length - 1].push(edge);\r\n };\r\n for (const seed of graph.allHalfEdges) {\r\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\r\n }\r\n graph.dropMask(visitMask);\r\n return loops;\r\n }\r\n}\r\n"]}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @module Topology
|
|
3
3
|
*/
|
|
4
4
|
import { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from "./Graph";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
5
|
+
/**
|
|
6
|
+
* HalfEdgePointerInspector has methods to check HalfEdge objects for pointer errors.
|
|
7
|
+
* * For a one-step test of the whole graph.
|
|
7
8
|
*/
|
|
8
9
|
export declare class HalfEdgePointerInspector {
|
|
9
10
|
numUndefinedEdgeMate: number;
|
|
@@ -13,39 +14,43 @@ export declare class HalfEdgePointerInspector {
|
|
|
13
14
|
numMatePairError: number;
|
|
14
15
|
numTested: number;
|
|
15
16
|
numWithMatchedEdgeMate: number;
|
|
16
|
-
/** Clear all counts */
|
|
17
|
+
/** Clear all counts. */
|
|
17
18
|
clearCounts(): void;
|
|
18
|
-
/** Inspect a single half edge.
|
|
19
|
+
/** Inspect a single half edge. Increment counters according to the half edge's pointers. */
|
|
19
20
|
inspectHalfEdge(he: HalfEdge): void;
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Return true if all pointer pairings are correct for a closed half edge graph (with no boundary):
|
|
21
23
|
* * For each he: `he.edgeMate.edgeMate === he`
|
|
22
|
-
* * For each he: `he.faceSuccessor.facePredecessor
|
|
23
|
-
* * For each he: `he.facePredecessor.faceSuccessor
|
|
24
|
+
* * For each he: `he.faceSuccessor.facePredecessor === he`
|
|
25
|
+
* * For each he: `he.facePredecessor.faceSuccessor === he`
|
|
24
26
|
*/
|
|
25
27
|
get isValidClosedHalfEdgeGraph(): boolean;
|
|
26
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Return true if all pointer pairings are correct for a half edge graph with possible boundary:
|
|
27
30
|
* * For each he: `he.edgeMate.edgeMate === he`
|
|
28
|
-
* * For each he: `he.faceSuccessor.facePredecessor
|
|
29
|
-
* * For each he: `he.facePredecessor.faceSuccessor
|
|
31
|
+
* * For each he: `he.faceSuccessor.facePredecessor === he`
|
|
32
|
+
* * For each he: `he.facePredecessor.faceSuccessor === he`
|
|
30
33
|
*/
|
|
31
34
|
get isValidHalfEdgeGraphAllowRaggedBoundary(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
35
|
+
/**
|
|
36
|
+
* Inspect all half edges of graph.
|
|
37
|
+
* * All pointer counts are left in member vars for later inspection.
|
|
34
38
|
*/
|
|
35
39
|
inspectHalfEdges(graph: HalfEdgeGraph): void;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @
|
|
40
|
+
/**
|
|
41
|
+
* Inspect a graph's pointer properties.
|
|
42
|
+
* @param expectAllMates true for "complete" graph.
|
|
43
|
+
* @returns true if all pointers are valid.
|
|
39
44
|
*/
|
|
40
45
|
static inspectGraph(graph: HalfEdgeGraph, expectAllMates: boolean): boolean;
|
|
41
46
|
}
|
|
42
|
-
/**
|
|
47
|
+
/** Static methods to inspect mask consistency properties in HalfEdgeGraph. */
|
|
43
48
|
export declare class HalfEdgeMaskValidation {
|
|
44
49
|
/**
|
|
45
50
|
* Test if a mask is used consistently around faces.
|
|
46
|
-
* * At the low level, there is no actual traversal around faces.
|
|
51
|
+
* * At the low level, there is no actual traversal around faces. It is only necessary to verify that the mask
|
|
52
|
+
* matches for each HalfEdge and its faceSuccessor.
|
|
47
53
|
* @returns Return true if mask is "all or nothing around all faces"
|
|
48
|
-
*
|
|
49
54
|
*/
|
|
50
55
|
static isMaskConsistentAroundAllFaces(graph: HalfEdgeGraph, mask: HalfEdgeMask): boolean;
|
|
51
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphValidation.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphValidation.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGhE
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphValidation.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphValidation.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGhE;;;GAGG;AACH,qBAAa,wBAAwB;IAC5B,oBAAoB,EAAE,MAAM,CAAK;IACjC,cAAc,EAAE,MAAM,CAAK;IAC3B,cAAc,EAAE,MAAM,CAAK;IAC3B,YAAY,EAAE,MAAM,CAAK;IACzB,gBAAgB,EAAE,MAAM,CAAK;IAC7B,SAAS,EAAE,MAAM,CAAK;IACtB,sBAAsB,EAAE,MAAM,CAAK;IAC1C,wBAAwB;IACjB,WAAW;IASlB,4FAA4F;IACrF,eAAe,CAAC,EAAE,EAAE,QAAQ;IAmBnC;;;;;OAKG;IACH,IAAW,0BAA0B,IAAI,OAAO,CAM/C;IACD;;;;;OAKG;IACH,IAAW,uCAAuC,IAAI,OAAO,CAM5D;IACD;;;OAGG;IACI,gBAAgB,CAAC,KAAK,EAAE,aAAa;IAK5C;;;;OAIG;WACW,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,GAAG,OAAO;CAOnF;AACD,8EAA8E;AAC9E,qBAAa,sBAAsB;IACjC;;;;;OAKG;WACW,8BAA8B,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO;CAOhG"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
// Search services for HalfEdgeGraph
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
6
|
+
/**
|
|
7
|
+
* HalfEdgePointerInspector has methods to check HalfEdge objects for pointer errors.
|
|
8
|
+
* * For a one-step test of the whole graph.
|
|
8
9
|
*/
|
|
9
10
|
export class HalfEdgePointerInspector {
|
|
10
11
|
constructor() {
|
|
@@ -16,7 +17,7 @@ export class HalfEdgePointerInspector {
|
|
|
16
17
|
this.numTested = 0;
|
|
17
18
|
this.numWithMatchedEdgeMate = 0;
|
|
18
19
|
}
|
|
19
|
-
/** Clear all counts */
|
|
20
|
+
/** Clear all counts. */
|
|
20
21
|
clearCounts() {
|
|
21
22
|
this.numUndefinedEdgeMate = 0;
|
|
22
23
|
this.numUndefinedFP = 0;
|
|
@@ -26,7 +27,7 @@ export class HalfEdgePointerInspector {
|
|
|
26
27
|
this.numWithMatchedEdgeMate = 0;
|
|
27
28
|
this.numTested = 0;
|
|
28
29
|
}
|
|
29
|
-
/** Inspect a single half edge.
|
|
30
|
+
/** Inspect a single half edge. Increment counters according to the half edge's pointers. */
|
|
30
31
|
inspectHalfEdge(he) {
|
|
31
32
|
this.numTested++;
|
|
32
33
|
if (he.facePredecessor === undefined)
|
|
@@ -44,10 +45,11 @@ export class HalfEdgePointerInspector {
|
|
|
44
45
|
else
|
|
45
46
|
this.numMatePairError++;
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Return true if all pointer pairings are correct for a closed half edge graph (with no boundary):
|
|
48
50
|
* * For each he: `he.edgeMate.edgeMate === he`
|
|
49
|
-
* * For each he: `he.faceSuccessor.facePredecessor
|
|
50
|
-
* * For each he: `he.facePredecessor.faceSuccessor
|
|
51
|
+
* * For each he: `he.faceSuccessor.facePredecessor === he`
|
|
52
|
+
* * For each he: `he.facePredecessor.faceSuccessor === he`
|
|
51
53
|
*/
|
|
52
54
|
get isValidClosedHalfEdgeGraph() {
|
|
53
55
|
return this.numWithMatchedEdgeMate === this.numTested
|
|
@@ -56,10 +58,11 @@ export class HalfEdgePointerInspector {
|
|
|
56
58
|
&& this.numFSFPError === 0
|
|
57
59
|
&& this.numMatePairError === 0;
|
|
58
60
|
}
|
|
59
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Return true if all pointer pairings are correct for a half edge graph with possible boundary:
|
|
60
63
|
* * For each he: `he.edgeMate.edgeMate === he`
|
|
61
|
-
* * For each he: `he.faceSuccessor.facePredecessor
|
|
62
|
-
* * For each he: `he.facePredecessor.faceSuccessor
|
|
64
|
+
* * For each he: `he.faceSuccessor.facePredecessor === he`
|
|
65
|
+
* * For each he: `he.facePredecessor.faceSuccessor === he`
|
|
63
66
|
*/
|
|
64
67
|
get isValidHalfEdgeGraphAllowRaggedBoundary() {
|
|
65
68
|
return this.numWithMatchedEdgeMate + this.numUndefinedEdgeMate === this.numTested
|
|
@@ -68,17 +71,19 @@ export class HalfEdgePointerInspector {
|
|
|
68
71
|
&& this.numFSFPError === 0
|
|
69
72
|
&& this.numMatePairError === 0;
|
|
70
73
|
}
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
74
|
+
/**
|
|
75
|
+
* Inspect all half edges of graph.
|
|
76
|
+
* * All pointer counts are left in member vars for later inspection.
|
|
73
77
|
*/
|
|
74
78
|
inspectHalfEdges(graph) {
|
|
75
79
|
this.clearCounts();
|
|
76
80
|
for (const he of graph.allHalfEdges)
|
|
77
81
|
this.inspectHalfEdge(he);
|
|
78
82
|
}
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
83
|
+
/**
|
|
84
|
+
* Inspect a graph's pointer properties.
|
|
85
|
+
* @param expectAllMates true for "complete" graph.
|
|
86
|
+
* @returns true if all pointers are valid.
|
|
82
87
|
*/
|
|
83
88
|
static inspectGraph(graph, expectAllMates) {
|
|
84
89
|
const inspector = new HalfEdgePointerInspector();
|
|
@@ -88,13 +93,13 @@ export class HalfEdgePointerInspector {
|
|
|
88
93
|
return inspector.isValidHalfEdgeGraphAllowRaggedBoundary;
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
|
-
/**
|
|
96
|
+
/** Static methods to inspect mask consistency properties in HalfEdgeGraph. */
|
|
92
97
|
export class HalfEdgeMaskValidation {
|
|
93
98
|
/**
|
|
94
99
|
* Test if a mask is used consistently around faces.
|
|
95
|
-
* * At the low level, there is no actual traversal around faces.
|
|
100
|
+
* * At the low level, there is no actual traversal around faces. It is only necessary to verify that the mask
|
|
101
|
+
* matches for each HalfEdge and its faceSuccessor.
|
|
96
102
|
* @returns Return true if mask is "all or nothing around all faces"
|
|
97
|
-
*
|
|
98
103
|
*/
|
|
99
104
|
static isMaskConsistentAroundAllFaces(graph, mask) {
|
|
100
105
|
for (const he of graph.allHalfEdges) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeGraphValidation.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphValidation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,oCAAoC;AACpC
|
|
1
|
+
{"version":3,"file":"HalfEdgeGraphValidation.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphValidation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,oCAAoC;AACpC;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAArC;QACS,yBAAoB,GAAW,CAAC,CAAC;QACjC,mBAAc,GAAW,CAAC,CAAC;QAC3B,mBAAc,GAAW,CAAC,CAAC;QAC3B,iBAAY,GAAW,CAAC,CAAC;QACzB,qBAAgB,GAAW,CAAC,CAAC;QAC7B,cAAS,GAAW,CAAC,CAAC;QACtB,2BAAsB,GAAW,CAAC,CAAC;IA8E5C,CAAC;IA7EC,wBAAwB;IACjB,WAAW;QAChB,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI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,SAAS;eAC5E,IAAI,CAAC,cAAc,KAAK,CAAC;eACzB,IAAI,CAAC,cAAc,KAAK,CAAC;eACzB,IAAI,CAAC,YAAY,KAAK,CAAC;eACvB,IAAI,CAAC,gBAAgB,KAAK,CAAC,CAAC;IACnC,CAAC;IACD;;;OAGG;IACI,gBAAgB,CAAC,KAAoB;QAC1C,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,YAAY;YACjC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,KAAoB,EAAE,cAAuB;QACtE,MAAM,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;QACjD,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,cAAc;YAChB,OAAO,SAAS,CAAC,0BAA0B,CAAC;QAC9C,OAAO,SAAS,CAAC,uCAAuC,CAAC;IAC3D,CAAC;CACF;AACD,8EAA8E;AAC9E,MAAM,OAAO,sBAAsB;IACjC;;;;;OAKG;IACI,MAAM,CAAC,8BAA8B,CAAC,KAAoB,EAAE,IAAkB;QACnF,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,YAAY,EAAE;YACnC,IAAI,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;gBACrD,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\n// cspell:word FSFP\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\r\n\r\n// Search services for HalfEdgeGraph\r\n/**\r\n * HalfEdgePointerInspector has methods to check HalfEdge objects for pointer errors.\r\n * * For a one-step test of the whole graph.\r\n */\r\nexport class HalfEdgePointerInspector {\r\n public numUndefinedEdgeMate: number = 0;\r\n public numUndefinedFS: number = 0;\r\n public numUndefinedFP: number = 0;\r\n public numFSFPError: number = 0;\r\n public numMatePairError: number = 0;\r\n public numTested: number = 0;\r\n public numWithMatchedEdgeMate: number = 0;\r\n /** Clear all counts. */\r\n public clearCounts() {\r\n this.numUndefinedEdgeMate = 0;\r\n this.numUndefinedFP = 0;\r\n this.numUndefinedFS = 0;\r\n this.numFSFPError = 0;\r\n this.numMatePairError = 0;\r\n this.numWithMatchedEdgeMate = 0;\r\n this.numTested = 0;\r\n }\r\n /** Inspect a single half edge. Increment counters according to the half edge's pointers. */\r\n public inspectHalfEdge(he: HalfEdge) {\r\n this.numTested++;\r\n if (he.facePredecessor === undefined)\r\n this.numUndefinedFP++;\r\n else if (he.facePredecessor.faceSuccessor !== he)\r\n this.numFSFPError++;\r\n\r\n if (he.faceSuccessor === undefined)\r\n this.numUndefinedFS++;\r\n else if (he.faceSuccessor.facePredecessor !== he)\r\n this.numFSFPError++;\r\n\r\n if (he.edgeMate === undefined)\r\n this.numUndefinedEdgeMate++;\r\n else if (he.edgeMate.edgeMate === he)\r\n this.numWithMatchedEdgeMate++;\r\n else\r\n this.numMatePairError++;\r\n }\r\n /**\r\n * Return true if all pointer pairings are correct for a closed half edge graph (with no boundary):\r\n * * For each he: `he.edgeMate.edgeMate === he`\r\n * * For each he: `he.faceSuccessor.facePredecessor === he`\r\n * * For each he: `he.facePredecessor.faceSuccessor === he`\r\n */\r\n public get isValidClosedHalfEdgeGraph(): boolean {\r\n return this.numWithMatchedEdgeMate === this.numTested\r\n && this.numUndefinedFS === 0\r\n && this.numUndefinedFP === 0\r\n && this.numFSFPError === 0\r\n && this.numMatePairError === 0;\r\n }\r\n /**\r\n * Return true if all pointer pairings are correct for a half edge graph with possible boundary:\r\n * * For each he: `he.edgeMate.edgeMate === he`\r\n * * For each he: `he.faceSuccessor.facePredecessor === he`\r\n * * For each he: `he.facePredecessor.faceSuccessor === he`\r\n */\r\n public get isValidHalfEdgeGraphAllowRaggedBoundary(): boolean {\r\n return this.numWithMatchedEdgeMate + this.numUndefinedEdgeMate === this.numTested\r\n && this.numUndefinedFS === 0\r\n && this.numUndefinedFP === 0\r\n && this.numFSFPError === 0\r\n && this.numMatePairError === 0;\r\n }\r\n /**\r\n * Inspect all half edges of graph.\r\n * * All pointer counts are left in member vars for later inspection.\r\n */\r\n public inspectHalfEdges(graph: HalfEdgeGraph) {\r\n this.clearCounts();\r\n for (const he of graph.allHalfEdges)\r\n this.inspectHalfEdge(he);\r\n }\r\n /**\r\n * Inspect a graph's pointer properties.\r\n * @param expectAllMates true for \"complete\" graph.\r\n * @returns true if all pointers are valid.\r\n */\r\n public static inspectGraph(graph: HalfEdgeGraph, expectAllMates: boolean): boolean {\r\n const inspector = new HalfEdgePointerInspector();\r\n inspector.inspectHalfEdges(graph);\r\n if (expectAllMates)\r\n return inspector.isValidClosedHalfEdgeGraph;\r\n return inspector.isValidHalfEdgeGraphAllowRaggedBoundary;\r\n }\r\n}\r\n/** Static methods to inspect mask consistency properties in HalfEdgeGraph. */\r\nexport class HalfEdgeMaskValidation {\r\n /**\r\n * Test if a mask is used consistently around faces.\r\n * * At the low level, there is no actual traversal around faces. It is only necessary to verify that the mask\r\n * matches for each HalfEdge and its faceSuccessor.\r\n * @returns Return true if mask is \"all or nothing around all faces\"\r\n */\r\n public static isMaskConsistentAroundAllFaces(graph: HalfEdgeGraph, mask: HalfEdgeMask): boolean {\r\n for (const he of graph.allHalfEdges) {\r\n if (he.faceSuccessor.getMask(mask) !== he.getMask(mask))\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n"]}
|
|
@@ -16,30 +16,37 @@ export declare class NodeXYZUV {
|
|
|
16
16
|
private _z;
|
|
17
17
|
private _u;
|
|
18
18
|
private _v;
|
|
19
|
+
/** Constructor */
|
|
19
20
|
private constructor();
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Set all content directly from args.
|
|
21
23
|
* @returns `this` reference
|
|
22
24
|
*/
|
|
23
25
|
set(node: HalfEdge, x: number, y: number, z: number, u: number, v: number): NodeXYZUV;
|
|
26
|
+
/** Set from `other` */
|
|
24
27
|
setFrom(other: NodeXYZUV): void;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* *
|
|
28
|
+
/**
|
|
29
|
+
* Create a `NodeXYZUV` with:
|
|
30
|
+
* * node from the given HalfEdge.
|
|
31
|
+
* * x,y,z as the coordinates of `node`.
|
|
32
|
+
* * u as the xy dot product of vectorA with `ray.direction`, where vectorA is the vector from ray origin to
|
|
33
|
+
* `node` coordinates.
|
|
34
|
+
* * v as the xy cross product of `ray.direction` with vectorA.
|
|
28
35
|
*/
|
|
29
36
|
static createNodeAndRayOrigin(node: HalfEdge, ray: Ray3d, result?: NodeXYZUV): NodeXYZUV;
|
|
30
|
-
/** Create a `NodeXYZUV` with explicit node
|
|
37
|
+
/** Create a `NodeXYZUV` with explicit `node`, xyz, uv. */
|
|
31
38
|
static create(node: HalfEdge, x?: number, y?: number, z?: number, u?: number, v?: number): NodeXYZUV;
|
|
32
39
|
/** Access the node. */
|
|
33
40
|
get node(): HalfEdge;
|
|
34
|
-
/** Access the x coordinate */
|
|
41
|
+
/** Access the x coordinate. */
|
|
35
42
|
get x(): number;
|
|
36
|
-
/** Access the y coordinate */
|
|
43
|
+
/** Access the y coordinate. */
|
|
37
44
|
get y(): number;
|
|
38
|
-
/** Access the z coordinate */
|
|
45
|
+
/** Access the z coordinate. */
|
|
39
46
|
get z(): number;
|
|
40
|
-
/** Access the u coordinate */
|
|
47
|
+
/** Access the u coordinate. */
|
|
41
48
|
get u(): number;
|
|
42
|
-
/** Access the v coordinate */
|
|
49
|
+
/** Access the v coordinate. */
|
|
43
50
|
get v(): number;
|
|
44
51
|
/** Access the x,y,z coordinates as Point3d with optional caller-supplied result. */
|
|
45
52
|
getXYZAsPoint3d(result?: Point3d): Point3d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeNodeXYZUV.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeNodeXYZUV.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;
|
|
1
|
+
{"version":3,"file":"HalfEdgeNodeXYZUV.d.ts","sourceRoot":"","sources":["../../../src/topology/HalfEdgeNodeXYZUV.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,EAAE,CAAS;IACnB,kBAAkB;IAClB,OAAO;IAQP;;;OAGG;IACI,GAAG,CAA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
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export class NodeXYZUV {
|
|
16
|
+
/** Constructor */
|
|
16
17
|
constructor(node, x, y, z, u, v) {
|
|
17
18
|
this._x = x;
|
|
18
19
|
this._y = y;
|
|
@@ -21,7 +22,8 @@ export class NodeXYZUV {
|
|
|
21
22
|
this._v = v;
|
|
22
23
|
this._node = node;
|
|
23
24
|
}
|
|
24
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Set all content directly from args.
|
|
25
27
|
* @returns `this` reference
|
|
26
28
|
*/
|
|
27
29
|
set(node, x, y, z, u, v) {
|
|
@@ -33,6 +35,7 @@ export class NodeXYZUV {
|
|
|
33
35
|
this._node = node;
|
|
34
36
|
return this;
|
|
35
37
|
}
|
|
38
|
+
/** Set from `other` */
|
|
36
39
|
setFrom(other) {
|
|
37
40
|
this._x = other.x;
|
|
38
41
|
this._y = other.y;
|
|
@@ -41,9 +44,13 @@ export class NodeXYZUV {
|
|
|
41
44
|
this._v = other.v;
|
|
42
45
|
this._node = other.node;
|
|
43
46
|
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* *
|
|
47
|
+
/**
|
|
48
|
+
* Create a `NodeXYZUV` with:
|
|
49
|
+
* * node from the given HalfEdge.
|
|
50
|
+
* * x,y,z as the coordinates of `node`.
|
|
51
|
+
* * u as the xy dot product of vectorA with `ray.direction`, where vectorA is the vector from ray origin to
|
|
52
|
+
* `node` coordinates.
|
|
53
|
+
* * v as the xy cross product of `ray.direction` with vectorA.
|
|
47
54
|
*/
|
|
48
55
|
static createNodeAndRayOrigin(node, ray, result) {
|
|
49
56
|
const x = node.x;
|
|
@@ -57,28 +64,42 @@ export class NodeXYZUV {
|
|
|
57
64
|
return result.set(node, x, y, z, u, v);
|
|
58
65
|
return new NodeXYZUV(node, x, y, z, u, v);
|
|
59
66
|
}
|
|
60
|
-
/** Create a `NodeXYZUV` with explicit node
|
|
67
|
+
/** Create a `NodeXYZUV` with explicit `node`, xyz, uv. */
|
|
61
68
|
static create(node, x = 0, y = 0, z = 0, u = 0, v = 0) {
|
|
62
69
|
return new NodeXYZUV(node, x, y, z, u, v);
|
|
63
70
|
}
|
|
64
71
|
/** Access the node. */
|
|
65
|
-
get node() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** Access the
|
|
69
|
-
get
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/** Access the
|
|
73
|
-
get
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
get node() {
|
|
73
|
+
return this._node;
|
|
74
|
+
}
|
|
75
|
+
/** Access the x coordinate. */
|
|
76
|
+
get x() {
|
|
77
|
+
return this._x;
|
|
78
|
+
}
|
|
79
|
+
/** Access the y coordinate. */
|
|
80
|
+
get y() {
|
|
81
|
+
return this._y;
|
|
82
|
+
}
|
|
83
|
+
/** Access the z coordinate. */
|
|
84
|
+
get z() {
|
|
85
|
+
return this._z;
|
|
86
|
+
}
|
|
87
|
+
/** Access the u coordinate. */
|
|
88
|
+
get u() {
|
|
89
|
+
return this._u;
|
|
90
|
+
}
|
|
91
|
+
/** Access the v coordinate. */
|
|
92
|
+
get v() {
|
|
93
|
+
return this._v;
|
|
94
|
+
}
|
|
76
95
|
/** Access the x,y,z coordinates as Point3d with optional caller-supplied result. */
|
|
77
96
|
getXYZAsPoint3d(result) {
|
|
78
97
|
return Point3d.create(this._x, this._y, this._z, result);
|
|
79
98
|
}
|
|
80
99
|
/** Access the uv coordinates as Point2d with optional caller-supplied result. */
|
|
81
|
-
getUVAsPoint2d(result) {
|
|
100
|
+
getUVAsPoint2d(result) {
|
|
101
|
+
return Point2d.create(this._u, this._v, result);
|
|
102
|
+
}
|
|
82
103
|
/** Toleranced comparison function for u coordinate */
|
|
83
104
|
classifyU(target, tol) {
|
|
84
105
|
const delta = this.u - target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HalfEdgeNodeXYZUV.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeNodeXYZUV.ts"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AsD;IAC/C,SAAS,CAAC,MAAc,EAAE,GAAW;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;QAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG;YACxB,OAAO,CAAC,CAAC;QACX,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,sDAAsD;IAC/C,SAAS,CAAC,MAAc,EAAE,GAAW;QAC1C,MAAM,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG;YACxB,OAAO,CAAC,CAAC;QACX,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { HalfEdge } from \"./Graph\";\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\n/**\r\n * Reference to a HalfEdge node with extra XYZ and UV data.\r\n * @internal\r\n */\r\nexport class NodeXYZUV {\r\n private _node: HalfEdge;\r\n private _x: number;\r\n private _y: number;\r\n private _z: number;\r\n private _u: number;\r\n private _v: number;\r\n /** Constructor */\r\n private constructor(node: HalfEdge, x: number, y: number, z: number, u: number, v: number) {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._u = u;\r\n this._v = v;\r\n this._node = node;\r\n }\r\n /**\r\n * Set all content directly from args.\r\n * @returns `this` reference\r\n */\r\n public set(node: HalfEdge, x: number, y: number, z: number, u: number, v: number): NodeXYZUV {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._u = u;\r\n this._v = v;\r\n this._node = node;\r\n return this;\r\n }\r\n /** Set from `other` */\r\n public setFrom(other: NodeXYZUV): void {\r\n this._x = other.x;\r\n this._y = other.y;\r\n this._z = other.z;\r\n this._u = other.u;\r\n this._v = other.v;\r\n this._node = other.node;\r\n }\r\n /**\r\n * Create a `NodeXYZUV` with:\r\n * * node from the given HalfEdge.\r\n * * x,y,z as the coordinates of `node`.\r\n * * u as the xy dot product of vectorA with `ray.direction`, where vectorA is the vector from ray origin to\r\n * `node` coordinates.\r\n * * v as the xy cross product of `ray.direction` with vectorA.\r\n */\r\n public static createNodeAndRayOrigin(node: HalfEdge, ray: Ray3d, result?: NodeXYZUV): NodeXYZUV {\r\n const x = node.x;\r\n const y = node.y;\r\n const z = node.z;\r\n const dx = x - ray.origin.x;\r\n const dy = y - ray.origin.y;\r\n const u = Geometry.dotProductXYXY(dx, dy, ray.direction.x, ray.direction.y);\r\n const v = Geometry.crossProductXYXY(ray.direction.x, ray.direction.y, dx, dy);\r\n if (result)\r\n return result.set(node, x, y, z, u, v);\r\n return new NodeXYZUV(node, x, y, z, u, v);\r\n }\r\n /** Create a `NodeXYZUV` with explicit `node`, xyz, uv. */\r\n public static create(\r\n node: HalfEdge, x: number = 0, y: number = 0, z: number = 0, u: number = 0, v: number = 0,\r\n ): NodeXYZUV {\r\n return new NodeXYZUV(node, x, y, z, u, v);\r\n }\r\n /** Access the node. */\r\n public get node(): HalfEdge {\r\n return this._node;\r\n }\r\n /** Access the x coordinate. */\r\n public get x(): number {\r\n return this._x;\r\n }\r\n /** Access the y coordinate. */\r\n public get y(): number {\r\n return this._y;\r\n }\r\n /** Access the z coordinate. */\r\n public get z(): number {\r\n return this._z;\r\n }\r\n /** Access the u coordinate. */\r\n public get u(): number {\r\n return this._u;\r\n }\r\n /** Access the v coordinate. */\r\n public get v(): number {\r\n return this._v;\r\n }\r\n /** Access the x,y,z coordinates as Point3d with optional caller-supplied result. */\r\n public getXYZAsPoint3d(result?: Point3d): Point3d {\r\n return Point3d.create(this._x, this._y, this._z, result);\r\n }\r\n /** Access the uv coordinates as Point2d with optional caller-supplied result. */\r\n public getUVAsPoint2d(result?: Point2d): Point2d {\r\n return Point2d.create(this._u, this._v, result);\r\n }\r\n /** Toleranced comparison function for u coordinate */\r\n public classifyU(target: number, tol: number): number {\r\n const delta = this.u - target;\r\n if (Math.abs(delta) <= tol)\r\n return 0;\r\n return delta >= 0 ? 1 : -1;\r\n }\r\n /** Toleranced comparison function for v coordinate */\r\n public classifyV(target: number, tol: number): number {\r\n const delta = target - this._v;\r\n if (Math.abs(delta) <= tol)\r\n return 0;\r\n return delta >= 0 ? 1 : -1;\r\n }\r\n}\r\n"]}
|
|
@@ -4,34 +4,34 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Class to accumulate statistics about a stream of signed numbers with tag items.
|
|
6
6
|
* * All sums, counts, extrema, and item values are initialized to zero in the constructor.
|
|
7
|
-
* * Each call to `announceItem
|
|
7
|
+
* * Each call to `announceItem(item, value)` updates the various sums, counts, and extrema.
|
|
8
8
|
*/
|
|
9
9
|
export declare class SignedDataSummary<T> {
|
|
10
|
-
/**
|
|
10
|
+
/** Sum of all positive area items. */
|
|
11
11
|
positiveSum: number;
|
|
12
|
-
/**
|
|
12
|
+
/** Number of positive area items. */
|
|
13
13
|
numPositive: number;
|
|
14
|
-
/**
|
|
14
|
+
/** Sum of negative area items. */
|
|
15
15
|
negativeSum: number;
|
|
16
|
-
/**
|
|
16
|
+
/** Number of negative area items. */
|
|
17
17
|
numNegative: number;
|
|
18
|
-
/**
|
|
18
|
+
/** Number of zero area items. */
|
|
19
19
|
numZero: number;
|
|
20
|
-
/**
|
|
20
|
+
/** The tag item item with the largest positive data. */
|
|
21
21
|
largestPositiveItem?: T;
|
|
22
|
-
/**
|
|
22
|
+
/** The tag item item with the most negative data. */
|
|
23
23
|
largestNegativeItem?: T;
|
|
24
24
|
largestPositiveValue: number;
|
|
25
25
|
largestNegativeValue: number;
|
|
26
|
-
/**
|
|
26
|
+
/** Array of all negative area items. */
|
|
27
27
|
negativeItemArray?: T[];
|
|
28
|
-
/**
|
|
28
|
+
/** Array of zero area items. */
|
|
29
29
|
zeroItemArray?: T[];
|
|
30
|
-
/**
|
|
30
|
+
/** Array of positive area items. */
|
|
31
31
|
positiveItemArray?: T[];
|
|
32
|
-
/**
|
|
32
|
+
/** Setup with zero sums and optional arrays. */
|
|
33
33
|
constructor(createArrays: boolean);
|
|
34
|
-
/**
|
|
34
|
+
/** Update with an item and its data value. */
|
|
35
35
|
announceItem(item: T, data: number): void;
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=SignedDataSummary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignedDataSummary.d.ts","sourceRoot":"","sources":["../../../src/topology/SignedDataSummary.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH;;;;GAIG;AACH,qBAAa,iBAAiB,CAAC,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"SignedDataSummary.d.ts","sourceRoot":"","sources":["../../../src/topology/SignedDataSummary.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH;;;;GAIG;AACH,qBAAa,iBAAiB,CAAC,CAAC;IAC9B,sCAAsC;IAC/B,WAAW,EAAE,MAAM,CAAC;IAC3B,qCAAqC;IAC9B,WAAW,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAC3B,WAAW,EAAE,MAAM,CAAC;IAC3B,qCAAqC;IAC9B,WAAW,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IAC1B,OAAO,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACjD,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC/B,qDAAqD;IAC9C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IACpC,wCAAwC;IACjC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/B,gCAAgC;IACzB,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3B,oCAAoC;IAC7B,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/B,gDAAgD;gBAC7B,YAAY,EAAE,OAAO;IAUxC,8CAA8C;IACvC,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM;CAyB1C"}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Class to accumulate statistics about a stream of signed numbers with tag items.
|
|
10
10
|
* * All sums, counts, extrema, and item values are initialized to zero in the constructor.
|
|
11
|
-
* * Each call to `announceItem
|
|
11
|
+
* * Each call to `announceItem(item, value)` updates the various sums, counts, and extrema.
|
|
12
12
|
*/
|
|
13
13
|
export class SignedDataSummary {
|
|
14
|
-
/**
|
|
14
|
+
/** Setup with zero sums and optional arrays. */
|
|
15
15
|
constructor(createArrays) {
|
|
16
16
|
this.positiveSum = this.negativeSum = 0.0;
|
|
17
17
|
this.numPositive = this.numNegative = this.numZero = 0.0;
|
|
@@ -22,7 +22,7 @@ export class SignedDataSummary {
|
|
|
22
22
|
this.zeroItemArray = [];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
25
|
+
/** Update with an item and its data value. */
|
|
26
26
|
announceItem(item, data) {
|
|
27
27
|
if (data < 0) {
|
|
28
28
|
this.numNegative++;
|