@itwin/core-geometry 4.5.0-dev.9 → 4.6.0-dev.0
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 +46 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.d.ts +15 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +27 -0
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +3 -0
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +11 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.d.ts +16 -8
- package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BandedSystem.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +81 -105
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +19 -10
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +17 -10
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -10
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +27 -21
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +137 -86
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +300 -166
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +2 -8
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +0 -3
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +18 -7
- package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
- package/lib/cjs/topology/Triangulation.js +50 -9
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.d.ts +15 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +27 -0
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +3 -0
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -2
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +11 -2
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.d.ts +16 -8
- package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BandedSystem.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +80 -103
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +19 -10
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +17 -10
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -10
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +27 -21
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +137 -86
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +300 -166
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +2 -8
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +0 -3
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +18 -7
- package/lib/esm/topology/Triangulation.d.ts.map +1 -1
- package/lib/esm/topology/Triangulation.js +50 -9
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +6 -4
|
@@ -3,7 +3,7 @@ import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
|
|
|
3
3
|
import { PolyfaceData } from "./PolyfaceData";
|
|
4
4
|
/**
|
|
5
5
|
* An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
|
|
6
|
-
* * The visitor extends
|
|
6
|
+
* * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {
|
|
@@ -12,95 +12,87 @@ export declare class IndexedPolyfaceVisitor extends PolyfaceData implements Poly
|
|
|
12
12
|
private _numWrap;
|
|
13
13
|
private _numEdges;
|
|
14
14
|
private _polyface;
|
|
15
|
-
protected constructor(
|
|
15
|
+
protected constructor(polyface: IndexedPolyface, numWrap: number);
|
|
16
16
|
/** Return the client polyface object. */
|
|
17
17
|
clientPolyface(): Polyface;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Set the number of vertices replicated in visitor arrays (both data and index arrays).
|
|
20
|
+
* * 0,1,2 are the most common as numWrap.
|
|
21
|
+
* * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
|
|
22
|
+
* 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.
|
|
23
|
+
* Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
|
|
24
|
+
* * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
25
|
+
*/
|
|
19
26
|
setNumWrap(numWrap: number): void;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
27
|
+
/**
|
|
28
|
+
* Return the number of edges in the current facet.
|
|
29
|
+
* * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
|
|
22
30
|
*/
|
|
23
31
|
get numEdgesThisFacet(): number;
|
|
24
|
-
/** Create a visitor for iterating the facets of `polyface
|
|
25
|
-
* Typical wrap counts are:
|
|
26
|
-
* * 0 -- leave the point arrays with "missing final edge"
|
|
27
|
-
* * 1 -- add point 0 as closure point
|
|
28
|
-
* * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
29
|
-
*/
|
|
32
|
+
/** Create a visitor for iterating the facets of `polyface`. */
|
|
30
33
|
static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor;
|
|
31
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
34
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
32
35
|
moveToReadIndex(facetIndex: number): boolean;
|
|
33
|
-
/** Advance the iterator to a the 'next' facet in the client polyface */
|
|
36
|
+
/** Advance the iterator to a the 'next' facet in the client polyface. */
|
|
34
37
|
moveToNextFacet(): boolean;
|
|
35
38
|
/** Reset the iterator to start at the first facet of the polyface. */
|
|
36
39
|
reset(): void;
|
|
37
40
|
/**
|
|
38
|
-
* Attempts to extract the distance parameter for the given vertex index on the current facet
|
|
39
|
-
* Returns the distance parameter as a point. Returns undefined on failure.
|
|
41
|
+
* Attempts to extract the distance parameter for the given vertex `index` on the current facet.
|
|
42
|
+
* Returns the distance parameter as a point. Returns `undefined` on failure.
|
|
40
43
|
*/
|
|
41
44
|
tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined;
|
|
42
45
|
/**
|
|
43
|
-
* Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
|
|
44
|
-
* Returns the normalized parameter as a point. Returns undefined on failure.
|
|
46
|
+
* Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
|
|
47
|
+
* Returns the normalized parameter as a point. Returns `undefined` on failure.
|
|
45
48
|
*/
|
|
46
49
|
tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined;
|
|
47
|
-
/** Return the index (in the client polyface) of the current facet */
|
|
50
|
+
/** Return the index (in the client polyface) of the current facet. */
|
|
48
51
|
currentReadIndex(): number;
|
|
49
|
-
/** Return the point index of vertex i within the currently loaded facet */
|
|
52
|
+
/** Return the point index of vertex `i` within the currently loaded facet. */
|
|
50
53
|
clientPointIndex(i: number): number;
|
|
51
|
-
/** Return the param index of vertex i within the currently loaded facet */
|
|
54
|
+
/** Return the param index of vertex `i` within the currently loaded facet. */
|
|
52
55
|
clientParamIndex(i: number): number;
|
|
53
|
-
/** Return the normal index of vertex i within the currently loaded facet */
|
|
56
|
+
/** Return the normal index of vertex `i` within the currently loaded facet. */
|
|
54
57
|
clientNormalIndex(i: number): number;
|
|
55
|
-
/** Return the color index of vertex i within the currently loaded facet */
|
|
58
|
+
/** Return the color index of vertex `i` within the currently loaded facet. */
|
|
56
59
|
clientColorIndex(i: number): number;
|
|
57
|
-
/** Return the aux data index of vertex i within the currently loaded facet */
|
|
60
|
+
/** Return the aux data index of vertex `i` within the currently loaded facet. */
|
|
58
61
|
clientAuxIndex(i: number): number;
|
|
59
|
-
/**
|
|
62
|
+
/** Clear the contents of all arrays. */
|
|
60
63
|
clearArrays(): void;
|
|
61
|
-
/**
|
|
64
|
+
/** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
|
|
62
65
|
pushDataFrom(other: PolyfaceVisitor, index: number): void;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
66
|
+
/**
|
|
67
|
+
* Transfer interpolated data from the other visitor.
|
|
68
|
+
* * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
|
|
65
69
|
*/
|
|
66
70
|
pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @param color0 32 bit color (e.g. rgb+transparency)
|
|
71
|
-
* @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
|
|
72
|
-
* @param color1
|
|
73
|
-
* @param shiftBits
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
export declare function interpolateColor(color0: number, fraction: number, color1: number): number;
|
|
77
|
-
/**
|
|
78
|
-
* An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
|
|
73
|
+
* An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
|
|
79
74
|
* * The subset is defined by an array of facet indices provided when this visitor is created.
|
|
80
|
-
* * Within the subset visitor,
|
|
81
|
-
* * moveToNextFacet moves only within the subset
|
|
82
|
-
* * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
|
|
75
|
+
* * Within the subset visitor, `facetIndex` is understood as index within the subset array:
|
|
76
|
+
* * `moveToNextFacet` moves only within the subset.
|
|
77
|
+
* * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
|
|
83
78
|
* @public
|
|
84
79
|
*/
|
|
85
80
|
export declare class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
86
81
|
private _parentFacetIndices;
|
|
87
82
|
private _nextActiveIndex;
|
|
88
83
|
private constructor();
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* * 1 -- add point 0 as closure point
|
|
93
|
-
* * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
94
|
-
* * The activeFacetIndices array indicates all facets to be visited.
|
|
84
|
+
/**
|
|
85
|
+
* Create a visitor for iterating a subset of the facets of `polyface`.
|
|
86
|
+
* * The `activeFacetIndices` array indicates all facets to be visited.
|
|
95
87
|
*/
|
|
96
88
|
static createSubsetVisitor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number): IndexedPolyfaceSubsetVisitor;
|
|
97
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
89
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
98
90
|
moveToReadIndex(activeIndex: number): boolean;
|
|
99
|
-
/** Advance the iterator to
|
|
91
|
+
/** Advance the iterator to the next facet in the client polyface. */
|
|
100
92
|
moveToNextFacet(): boolean;
|
|
101
|
-
/** Reset the iterator to start at the first facet
|
|
93
|
+
/** Reset the iterator to start at the first active facet in the polyface. */
|
|
102
94
|
reset(): void;
|
|
103
|
-
/**
|
|
95
|
+
/** Return the parent facet index of the indicated index within the active facets. */
|
|
104
96
|
parentFacetIndex(activeIndex: number): number | undefined;
|
|
105
97
|
}
|
|
106
98
|
//# sourceMappingURL=IndexedPolyfaceVisitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceVisitor.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,YAAa,YAAW,eAAe;IACjF,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS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IAGjC,8EAA8E;IACvE,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG1C,8EAA8E;IACvE,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG1C,+EAA+E;IACxE,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG3C,8EAA8E;IACvE,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG1C,iFAAiF;IAC1E,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAGxC,wCAAwC;IACjC,WAAW,IAAI,IAAI;IAU1B,iGAAiG;IAC1F,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAShE;;;OAGG;IACI,wBAAwB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAShH;AACD;;;;;;;GAOG;AACH,qBAAa,4BAA6B,SAAQ,sBAAsB;IACtE,OAAO,CAAC,mBAAmB,CAAW;IACtC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO;IAKP;;;OAGG;WACW,mBAAmB,CAC/B,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GACvE,4BAA4B;IAG/B,yEAAyE;IACzD,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAO7D,qEAAqE;IACrD,eAAe,IAAI,OAAO;IAU1C,6EAA6E;IAC7D,KAAK,IAAI,IAAI;IAG7B,qFAAqF;IAC9E,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAMjE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.IndexedPolyfaceSubsetVisitor = exports.
|
|
7
|
+
exports.IndexedPolyfaceSubsetVisitor = exports.IndexedPolyfaceVisitor = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Polyface
|
|
10
10
|
*/
|
|
@@ -13,51 +13,60 @@ const PolyfaceData_1 = require("./PolyfaceData");
|
|
|
13
13
|
/* eslint-disable @itwin/prefer-get */
|
|
14
14
|
/**
|
|
15
15
|
* An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
|
|
16
|
-
* * The visitor extends
|
|
16
|
+
* * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
class IndexedPolyfaceVisitor extends PolyfaceData_1.PolyfaceData {
|
|
20
|
-
// to be called from static factory method that validates the polyface
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
23
|
-
this._polyface =
|
|
20
|
+
// to be called from static factory method that validates the polyface
|
|
21
|
+
constructor(polyface, numWrap) {
|
|
22
|
+
super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);
|
|
23
|
+
this._polyface = polyface;
|
|
24
24
|
this._numWrap = numWrap;
|
|
25
|
-
if (
|
|
26
|
-
this.auxData =
|
|
25
|
+
if (polyface.data.auxData)
|
|
26
|
+
this.auxData = polyface.data.auxData.createForVisitor();
|
|
27
27
|
this.reset();
|
|
28
28
|
this._numEdges = 0;
|
|
29
29
|
this._nextFacetIndex = 0;
|
|
30
30
|
this._currentFacetIndex = -1;
|
|
31
31
|
}
|
|
32
32
|
/** Return the client polyface object. */
|
|
33
|
-
clientPolyface() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
33
|
+
clientPolyface() {
|
|
34
|
+
return this._polyface;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set the number of vertices replicated in visitor arrays (both data and index arrays).
|
|
38
|
+
* * 0,1,2 are the most common as numWrap.
|
|
39
|
+
* * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
|
|
40
|
+
* 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.
|
|
41
|
+
* Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
|
|
42
|
+
* * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
38
43
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
* *
|
|
44
|
+
setNumWrap(numWrap) {
|
|
45
|
+
this._numWrap = numWrap;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Return the number of edges in the current facet.
|
|
49
|
+
* * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
|
|
45
50
|
*/
|
|
51
|
+
get numEdgesThisFacet() {
|
|
52
|
+
return this._numEdges;
|
|
53
|
+
}
|
|
54
|
+
/** Create a visitor for iterating the facets of `polyface`. */
|
|
46
55
|
static create(polyface, numWrap) {
|
|
47
56
|
return new IndexedPolyfaceVisitor(polyface, numWrap);
|
|
48
57
|
}
|
|
49
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
58
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
50
59
|
moveToReadIndex(facetIndex) {
|
|
51
60
|
if (!this._polyface.isValidFacetIndex(facetIndex))
|
|
52
61
|
return false;
|
|
53
62
|
this._currentFacetIndex = facetIndex;
|
|
54
63
|
this._nextFacetIndex = facetIndex + 1;
|
|
55
64
|
this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
|
|
56
|
-
this.
|
|
65
|
+
this.resizeAllArrays(this._numEdges + this._numWrap);
|
|
57
66
|
this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
|
|
58
67
|
return true;
|
|
59
68
|
}
|
|
60
|
-
/** Advance the iterator to a the 'next' facet in the client polyface */
|
|
69
|
+
/** Advance the iterator to a the 'next' facet in the client polyface. */
|
|
61
70
|
moveToNextFacet() {
|
|
62
71
|
if (this._nextFacetIndex !== this._currentFacetIndex)
|
|
63
72
|
return this.moveToReadIndex(this._nextFacetIndex);
|
|
@@ -70,11 +79,11 @@ class IndexedPolyfaceVisitor extends PolyfaceData_1.PolyfaceData {
|
|
|
70
79
|
this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
|
-
* Attempts to extract the distance parameter for the given vertex index on the current facet
|
|
74
|
-
* Returns the distance parameter as a point. Returns undefined on failure.
|
|
82
|
+
* Attempts to extract the distance parameter for the given vertex `index` on the current facet.
|
|
83
|
+
* Returns the distance parameter as a point. Returns `undefined` on failure.
|
|
75
84
|
*/
|
|
76
85
|
tryGetDistanceParameter(index, result) {
|
|
77
|
-
if (index >= this.numEdgesThisFacet)
|
|
86
|
+
if (index < 0 || index >= this.numEdgesThisFacet)
|
|
78
87
|
return undefined;
|
|
79
88
|
if (this.param === undefined || this._polyface.data.face.length === 0)
|
|
80
89
|
return undefined;
|
|
@@ -84,11 +93,11 @@ class IndexedPolyfaceVisitor extends PolyfaceData_1.PolyfaceData {
|
|
|
84
93
|
return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
|
|
85
94
|
}
|
|
86
95
|
/**
|
|
87
|
-
* Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
|
|
88
|
-
* Returns the normalized parameter as a point. Returns undefined on failure.
|
|
96
|
+
* Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
|
|
97
|
+
* Returns the normalized parameter as a point. Returns `undefined` on failure.
|
|
89
98
|
*/
|
|
90
99
|
tryGetNormalizedParameter(index, result) {
|
|
91
|
-
if (index >= this.numEdgesThisFacet)
|
|
100
|
+
if (index < 0 || index >= this.numEdgesThisFacet)
|
|
92
101
|
return undefined;
|
|
93
102
|
if (this.param === undefined || this._polyface.data.face.length === 0)
|
|
94
103
|
return undefined;
|
|
@@ -97,19 +106,31 @@ class IndexedPolyfaceVisitor extends PolyfaceData_1.PolyfaceData {
|
|
|
97
106
|
return undefined;
|
|
98
107
|
return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
|
|
99
108
|
}
|
|
100
|
-
/** Return the index (in the client polyface) of the current facet */
|
|
101
|
-
currentReadIndex() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/** Return the
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/** Return the
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/**
|
|
109
|
+
/** Return the index (in the client polyface) of the current facet. */
|
|
110
|
+
currentReadIndex() {
|
|
111
|
+
return this._currentFacetIndex;
|
|
112
|
+
}
|
|
113
|
+
/** Return the point index of vertex `i` within the currently loaded facet. */
|
|
114
|
+
clientPointIndex(i) {
|
|
115
|
+
return this.pointIndex[i];
|
|
116
|
+
}
|
|
117
|
+
/** Return the param index of vertex `i` within the currently loaded facet. */
|
|
118
|
+
clientParamIndex(i) {
|
|
119
|
+
return this.paramIndex ? this.paramIndex[i] : -1;
|
|
120
|
+
}
|
|
121
|
+
/** Return the normal index of vertex `i` within the currently loaded facet. */
|
|
122
|
+
clientNormalIndex(i) {
|
|
123
|
+
return this.normalIndex ? this.normalIndex[i] : -1;
|
|
124
|
+
}
|
|
125
|
+
/** Return the color index of vertex `i` within the currently loaded facet. */
|
|
126
|
+
clientColorIndex(i) {
|
|
127
|
+
return this.colorIndex ? this.colorIndex[i] : -1;
|
|
128
|
+
}
|
|
129
|
+
/** Return the aux data index of vertex `i` within the currently loaded facet. */
|
|
130
|
+
clientAuxIndex(i) {
|
|
131
|
+
return this.auxData ? this.auxData.indices[i] : -1;
|
|
132
|
+
}
|
|
133
|
+
/** Clear the contents of all arrays. */
|
|
113
134
|
clearArrays() {
|
|
114
135
|
if (this.point !== undefined)
|
|
115
136
|
this.point.length = 0;
|
|
@@ -120,79 +141,37 @@ class IndexedPolyfaceVisitor extends PolyfaceData_1.PolyfaceData {
|
|
|
120
141
|
if (this.color !== undefined)
|
|
121
142
|
this.color.length = 0;
|
|
122
143
|
}
|
|
123
|
-
/**
|
|
144
|
+
/** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
|
|
124
145
|
pushDataFrom(other, index) {
|
|
125
146
|
this.point.pushFromGrowableXYZArray(other.point, index);
|
|
126
|
-
if (this.color && other.color && index < other.color.length)
|
|
127
|
-
this.color.push(other.color[index]);
|
|
128
147
|
if (this.param && other.param && index < other.param.length)
|
|
129
148
|
this.param.pushFromGrowableXYArray(other.param, index);
|
|
130
149
|
if (this.normal && other.normal && index < other.normal.length)
|
|
131
150
|
this.normal.pushFromGrowableXYZArray(other.normal, index);
|
|
151
|
+
if (this.color && other.color && index < other.color.length)
|
|
152
|
+
this.color.push(other.color[index]);
|
|
132
153
|
}
|
|
133
|
-
/**
|
|
134
|
-
*
|
|
154
|
+
/**
|
|
155
|
+
* Transfer interpolated data from the other visitor.
|
|
156
|
+
* * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
|
|
135
157
|
*/
|
|
136
158
|
pushInterpolatedDataFrom(other, index0, fraction, index1) {
|
|
137
159
|
this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);
|
|
138
|
-
if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
|
|
139
|
-
this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));
|
|
140
160
|
if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)
|
|
141
161
|
this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);
|
|
142
162
|
if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)
|
|
143
163
|
this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);
|
|
164
|
+
if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
|
|
165
|
+
this.color.push(Geometry_1.Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));
|
|
144
166
|
}
|
|
145
167
|
}
|
|
146
168
|
exports.IndexedPolyfaceVisitor = IndexedPolyfaceVisitor;
|
|
147
169
|
/**
|
|
148
|
-
*
|
|
149
|
-
* * mask off the low 8 bits
|
|
150
|
-
* * interpolate the number
|
|
151
|
-
* * truncate to floor
|
|
152
|
-
* * shift left
|
|
153
|
-
* * Hence all numbers in and out of the floating point are 0..255.
|
|
154
|
-
* @param color0
|
|
155
|
-
* @param fraction
|
|
156
|
-
* @param color1
|
|
157
|
-
* @param shiftBits
|
|
158
|
-
*/
|
|
159
|
-
function interpolateByte(color0, fraction, color1, shiftBits) {
|
|
160
|
-
color0 = (color0 >>> shiftBits) & 0xFF;
|
|
161
|
-
color1 = (color1 >>> shiftBits) & 0xFF;
|
|
162
|
-
const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;
|
|
163
|
-
return color << shiftBits;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Interpolate each byte of color0 and color1 as integers.
|
|
167
|
-
* @param color0 32 bit color (e.g. rgb+transparency)
|
|
168
|
-
* @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
|
|
169
|
-
* @param color1
|
|
170
|
-
* @param shiftBits
|
|
171
|
-
* @internal
|
|
172
|
-
*/
|
|
173
|
-
function interpolateColor(color0, fraction, color1) {
|
|
174
|
-
// don't allow fractions outside the individual byte ranges.
|
|
175
|
-
fraction = Geometry_1.Geometry.clamp(fraction, 0, 1);
|
|
176
|
-
// interpolate each byte in place ....
|
|
177
|
-
/*
|
|
178
|
-
const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);
|
|
179
|
-
const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;
|
|
180
|
-
const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;
|
|
181
|
-
const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;
|
|
182
|
-
*/
|
|
183
|
-
const byte0 = interpolateByte(color0, fraction, color1, 0);
|
|
184
|
-
const byte1 = interpolateByte(color0, fraction, color1, 8);
|
|
185
|
-
const byte2 = interpolateByte(color0, fraction, color1, 16);
|
|
186
|
-
const byte3 = interpolateByte(color0, fraction, color1, 24);
|
|
187
|
-
return (byte0 | byte1 | byte2 | byte3);
|
|
188
|
-
}
|
|
189
|
-
exports.interpolateColor = interpolateColor;
|
|
190
|
-
/**
|
|
191
|
-
* An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
|
|
170
|
+
* An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
|
|
192
171
|
* * The subset is defined by an array of facet indices provided when this visitor is created.
|
|
193
|
-
* * Within the subset visitor,
|
|
194
|
-
* * moveToNextFacet moves only within the subset
|
|
195
|
-
* * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
|
|
172
|
+
* * Within the subset visitor, `facetIndex` is understood as index within the subset array:
|
|
173
|
+
* * `moveToNextFacet` moves only within the subset.
|
|
174
|
+
* * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
|
|
196
175
|
* @public
|
|
197
176
|
*/
|
|
198
177
|
class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
@@ -201,17 +180,14 @@ class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
201
180
|
this._parentFacetIndices = activeFacetIndices.slice();
|
|
202
181
|
this._nextActiveIndex = 0;
|
|
203
182
|
}
|
|
204
|
-
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* * 1 -- add point 0 as closure point
|
|
208
|
-
* * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
209
|
-
* * The activeFacetIndices array indicates all facets to be visited.
|
|
183
|
+
/**
|
|
184
|
+
* Create a visitor for iterating a subset of the facets of `polyface`.
|
|
185
|
+
* * The `activeFacetIndices` array indicates all facets to be visited.
|
|
210
186
|
*/
|
|
211
187
|
static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
|
|
212
188
|
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
|
|
213
189
|
}
|
|
214
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
190
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
215
191
|
moveToReadIndex(activeIndex) {
|
|
216
192
|
if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {
|
|
217
193
|
this._nextActiveIndex = activeIndex;
|
|
@@ -219,7 +195,7 @@ class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
219
195
|
}
|
|
220
196
|
return false;
|
|
221
197
|
}
|
|
222
|
-
/** Advance the iterator to
|
|
198
|
+
/** Advance the iterator to the next facet in the client polyface. */
|
|
223
199
|
moveToNextFacet() {
|
|
224
200
|
if (this._nextActiveIndex < this._parentFacetIndices.length) {
|
|
225
201
|
const result = this.moveToReadIndex(this._nextActiveIndex);
|
|
@@ -230,11 +206,11 @@ class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
230
206
|
}
|
|
231
207
|
return false;
|
|
232
208
|
}
|
|
233
|
-
/** Reset the iterator to start at the first facet
|
|
209
|
+
/** Reset the iterator to start at the first active facet in the polyface. */
|
|
234
210
|
reset() {
|
|
235
211
|
this._nextActiveIndex = 0;
|
|
236
212
|
}
|
|
237
|
-
/**
|
|
213
|
+
/** Return the parent facet index of the indicated index within the active facets. */
|
|
238
214
|
parentFacetIndex(activeIndex) {
|
|
239
215
|
if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {
|
|
240
216
|
return this._parentFacetIndices[activeIndex];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAGvC,iDAA8C;AAE9C,sCAAsC;AAEtC;;;;GAIG;AACH,MAAa,sBAAuB,SAAQ,2BAAY;IAMtD,0EAA0E;IAC1E,YAAsB,MAAuB,EAAE,OAAe;QAC5D,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5G,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO;YACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAExD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;IAE/B,CAAC;IACD,yCAAyC;IAClC,cAAc,KAAe,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,iGAAiG;IAC1F,UAAU,CAAC,OAAe,IAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAE/D;;OAEG;IACH,IAAW,iBAAiB,KAAa,OAAO,I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AAI,CAAC,mBAAmB,CAAC,MAAM,EAAE;YAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC3D,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,sEAAsE;IACtD,KAAK;QACnB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,oFAAoF;IAC7E,gBAAgB,CAAC,WAAmB;QACzC,IAAI,WAAW,IAAI,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjDD,oEAiDC","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 Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\r\nimport { PolyfaceData } from \"./PolyfaceData\";\r\n\r\n/* eslint-disable @itwin/prefer-get */\r\n\r\n/**\r\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\r\n * * The visitor extends a `PolyfaceData ` class, so it can at any time hold all the data of a single facet.\r\n * @public\r\n */\r\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _numEdges: number;\r\n private _polyface: IndexedPolyface;\r\n // to be called from static factory method that validates the polyface ...\r\n protected constructor(facets: IndexedPolyface, numWrap: number) {\r\n super(facets.data.normalCount > 0, facets.data.paramCount > 0, facets.data.colorCount > 0, facets.twoSided);\r\n this._polyface = facets;\r\n this._numWrap = numWrap;\r\n if (facets.data.auxData)\r\n this.auxData = facets.data.auxData.createForVisitor();\r\n\r\n this.reset();\r\n this._numEdges = 0;\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n\r\n }\r\n /** Return the client polyface object. */\r\n public clientPolyface(): Polyface { return this._polyface; }\r\n /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */\r\n public setNumWrap(numWrap: number) { this._numWrap = numWrap; }\r\n\r\n /** Return the number of edges in the current facet.\r\n * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.\r\n */\r\n public get numEdgesThisFacet(): number { return this._numEdges; }\r\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n */\r\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\r\n return new IndexedPolyfaceVisitor(polyface, numWrap);\r\n }\r\n /** Advance the iterator to a particular facet in the client polyface */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (!this._polyface.isValidFacetIndex(facetIndex))\r\n return false;\r\n this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\r\n this.resizeAllDataArrays(this._numEdges + this._numWrap);\r\n this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);\r\n return true;\r\n }\r\n /** Advance the iterator to a the 'next' facet in the client polyface */\r\n public moveToNextFacet(): boolean {\r\n if (this._nextFacetIndex !== this._currentFacetIndex)\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n this._nextFacetIndex++;\r\n return true;\r\n }\r\n\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n\r\n /**\r\n * Attempts to extract the distance parameter for the given vertex index on the current facet\r\n * Returns the distance parameter as a point. Returns undefined on failure.\r\n */\r\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\r\n if (index >= this.numEdgesThisFacet)\r\n return undefined;\r\n\r\n if (this.param === undefined || this._polyface.data.face.length === 0)\r\n return undefined;\r\n\r\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\r\n if (!faceData)\r\n return undefined;\r\n return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);\r\n }\r\n\r\n /**\r\n * Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.\r\n * Returns the normalized parameter as a point. Returns undefined on failure.\r\n */\r\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\r\n if (index >= this.numEdgesThisFacet)\r\n return undefined;\r\n\r\n if (this.param === undefined || this._polyface.data.face.length === 0)\r\n return undefined;\r\n\r\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\r\n if (!faceData)\r\n return undefined;\r\n return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);\r\n }\r\n /** Return the index (in the client polyface) of the current facet */\r\n public currentReadIndex(): number { return this._currentFacetIndex; }\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\r\n /** Return the param index of vertex i within the currently loaded facet */\r\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\r\n /** Return the normal index of vertex i within the currently loaded facet */\r\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n public clientColorIndex(i: number): number { return this.colorIndex ? this.colorIndex[i] : -1; }\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n public clientAuxIndex(i: number): number { return this.auxData ? this.auxData.indices[i] : -1; }\r\n\r\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n if (this.color !== undefined)\r\n this.color.length = 0;\r\n }\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index);\r\n }\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\r\n this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n }\r\n}\r\n/**\r\n * * shift to right by shiftBits.\r\n * * mask off the low 8 bits\r\n * * interpolate the number\r\n * * truncate to floor\r\n * * shift left\r\n * * Hence all numbers in and out of the floating point are 0..255.\r\n * @param color0\r\n * @param fraction\r\n * @param color1\r\n * @param shiftBits\r\n */\r\nfunction interpolateByte(color0: number, fraction: number, color1: number, shiftBits: number): number {\r\n color0 = (color0 >>> shiftBits) & 0xFF;\r\n color1 = (color1 >>> shiftBits) & 0xFF;\r\n const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;\r\n return color << shiftBits;\r\n}\r\n\r\n/**\r\n * Interpolate each byte of color0 and color1 as integers.\r\n * @param color0 32 bit color (e.g. rgb+transparency)\r\n * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.\r\n * @param color1\r\n * @param shiftBits\r\n * @internal\r\n */\r\nexport function interpolateColor(color0: number, fraction: number, color1: number) {\r\n // don't allow fractions outside the individual byte ranges.\r\n fraction = Geometry.clamp(fraction, 0, 1);\r\n // interpolate each byte in place ....\r\n /*\r\n const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);\r\n const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;\r\n const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;\r\n const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;\r\n */\r\n const byte0 = interpolateByte(color0, fraction, color1, 0);\r\n const byte1 = interpolateByte(color0, fraction, color1, 8);\r\n const byte2 = interpolateByte(color0, fraction, color1, 16);\r\n const byte3 = interpolateByte(color0, fraction, color1, 24);\r\n\r\n return (byte0 | byte1 | byte2 | byte3);\r\n}\r\n\r\n/**\r\n * An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.\r\n * * The subset is defined by an array of facet indices provided when this visitor is created.\r\n * * Within the subset visitor, \"facetIndex\" is understood as index within the subset array:\r\n * * moveToNextFacet moves only within the subset\r\n * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)\r\n * @public\r\n */\r\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\r\n private _parentFacetIndices: number[];\r\n // index WITHIN THE _parentFacetIndices array.\r\n private _nextActiveIndex: number;\r\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\r\n super(polyface, numWrap);\r\n this._parentFacetIndices = activeFacetIndices.slice();\r\n this._nextActiveIndex = 0;\r\n }\r\n /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n * * The activeFacetIndices array indicates all facets to be visited.\r\n */\r\n public static createSubsetVisitor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number): IndexedPolyfaceSubsetVisitor {\r\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\r\n }\r\n /** Advance the iterator to a particular facet in the client polyface */\r\n public override moveToReadIndex(activeIndex: number): boolean {\r\n if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {\r\n this._nextActiveIndex = activeIndex;\r\n return super.moveToReadIndex(this._parentFacetIndices[activeIndex++]);\r\n }\r\n return false;\r\n }\r\n /** Advance the iterator to a the 'next' facet in the client polyface */\r\n public override moveToNextFacet(): boolean {\r\n if (this._nextActiveIndex < this._parentFacetIndices.length) {\r\n const result = this.moveToReadIndex(this._nextActiveIndex);\r\n if (result) {\r\n this._nextActiveIndex++;\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public override reset(): void {\r\n this._nextActiveIndex = 0;\r\n }\r\n /** return the parent facet index of the indicated index within the active facets */\r\n public parentFacetIndex(activeIndex: number): number | undefined {\r\n if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {\r\n return this._parentFacetIndices[activeIndex];\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AAGvC,iDAA8C;AAE9C,sCAAsC;AAEtC;;;;GAIG;AACH,MAAa,sBAAuB,SAAQ,2BAAY;IAMtD,sEAAsE;IACtE,YAAsB,QAAyB,EAAE,OAAe;QAC9D,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpH,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO;YACvB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;IAE/B,CAAC;IACD,yCAAyC;IAClC,cAAc;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD;;;;;;;OAOG;IACI,UAAU,CAAC,OAAe;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IACD;;;OAGG;IACH,IAAW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gBAAgB,GAAG,WAAW,CAAC;YACpC,OAAO,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;SACvE;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,qEAAqE;IACrD,eAAe;QAC7B,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE;YAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC3D,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,6EAA6E;IAC7D,KAAK;QACnB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,qFAAqF;IAC9E,gBAAgB,CAAC,WAAmB;QACzC,IAAI,WAAW,IAAI,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA/CD,oEA+CC","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 { Geometry } from \"../Geometry\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/* eslint-disable @itwin/prefer-get */\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\n * @public\n */\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _numEdges: number;\n private _polyface: IndexedPolyface;\n // to be called from static factory method that validates the polyface\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\n this._polyface = polyface;\n this._numWrap = numWrap;\n if (polyface.data.auxData)\n this.auxData = polyface.data.auxData.createForVisitor();\n this.reset();\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n\n }\n /** Return the client polyface object. */\n public clientPolyface(): Polyface {\n return this._polyface;\n }\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * 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.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\n */\n public setNumWrap(numWrap: number) {\n this._numWrap = numWrap;\n }\n /**\n * Return the number of edges in the current facet.\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number {\n return this._numEdges;\n }\n /** Create a visitor for iterating the facets of `polyface`. */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\n this.resizeAllArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(\n this._polyface.data,\n this._polyface.facetIndex0(this._currentFacetIndex),\n this._polyface.facetIndex1(this._currentFacetIndex),\n this._numWrap,\n );\n return true;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface. */\n public moveToNextFacet(): boolean {\n if (this._nextFacetIndex !== this._currentFacetIndex)\n return this.moveToReadIndex(this._nextFacetIndex);\n this._nextFacetIndex++;\n return true;\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\n * Returns the distance parameter as a point. Returns `undefined` on failure.\n */\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /**\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\n */\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /** Return the index (in the client polyface) of the current facet. */\n public currentReadIndex(): number {\n return this._currentFacetIndex;\n }\n /** Return the point index of vertex `i` within the currently loaded facet. */\n public clientPointIndex(i: number): number {\n return this.pointIndex[i];\n }\n /** Return the param index of vertex `i` within the currently loaded facet. */\n public clientParamIndex(i: number): number {\n return this.paramIndex ? this.paramIndex[i] : -1;\n }\n /** Return the normal index of vertex `i` within the currently loaded facet. */\n public clientNormalIndex(i: number): number {\n return this.normalIndex ? this.normalIndex[i] : -1;\n }\n /** Return the color index of vertex `i` within the currently loaded facet. */\n public clientColorIndex(i: number): number {\n return this.colorIndex ? this.colorIndex[i] : -1;\n }\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\n public clientAuxIndex(i: number): number {\n return this.auxData ? this.auxData.indices[i] : -1;\n }\n /** Clear the contents of all arrays. */\n public clearArrays(): void {\n if (this.point !== undefined)\n this.point.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n if (this.color !== undefined)\n this.color.length = 0;\n }\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n }\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\n }\n}\n/**\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\n * * The subset is defined by an array of facet indices provided when this visitor is created.\n * * Within the subset visitor, `facetIndex` is understood as index within the subset array:\n * * `moveToNextFacet` moves only within the subset.\n * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _parentFacetIndices: number[];\n private _nextActiveIndex: number; // index WITHIN _parentFacetIndices array\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._parentFacetIndices = activeFacetIndices.slice();\n this._nextActiveIndex = 0;\n }\n /**\n * Create a visitor for iterating a subset of the facets of `polyface`.\n * * The `activeFacetIndices` array indicates all facets to be visited.\n */\n public static createSubsetVisitor(\n polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public override moveToReadIndex(activeIndex: number): boolean {\n if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {\n this._nextActiveIndex = activeIndex;\n return super.moveToReadIndex(this._parentFacetIndices[activeIndex++]);\n }\n return false;\n }\n /** Advance the iterator to the next facet in the client polyface. */\n public override moveToNextFacet(): boolean {\n if (this._nextActiveIndex < this._parentFacetIndices.length) {\n const result = this.moveToReadIndex(this._nextActiveIndex);\n if (result) {\n this._nextActiveIndex++;\n return true;\n }\n }\n return false;\n }\n /** Reset the iterator to start at the first active facet in the polyface. */\n public override reset(): void {\n this._nextActiveIndex = 0;\n }\n /** Return the parent facet index of the indicated index within the active facets. */\n public parentFacetIndex(activeIndex: number): number | undefined {\n if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {\n return this._parentFacetIndices[activeIndex];\n }\n return undefined;\n }\n}\n"]}
|