@itwin/core-geometry 4.5.0-dev.9 → 4.6.0-dev.1
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 +51 -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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iterator-like object that "visits" facets of a mesh.
|
|
13
|
-
* * The visitor extends
|
|
13
|
+
* * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
16
|
export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
17
|
-
// to be called from static factory method that validates the polyface
|
|
18
|
-
constructor(
|
|
19
|
-
super(
|
|
20
|
-
this._polyface =
|
|
17
|
+
// to be called from static factory method that validates the polyface
|
|
18
|
+
constructor(polyface, numWrap) {
|
|
19
|
+
super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);
|
|
20
|
+
this._polyface = polyface;
|
|
21
21
|
this._numWrap = numWrap;
|
|
22
|
-
if (
|
|
23
|
-
this.auxData =
|
|
22
|
+
if (polyface.data.auxData)
|
|
23
|
+
this.auxData = polyface.data.auxData.createForVisitor();
|
|
24
24
|
this.reset();
|
|
25
25
|
this._numEdges = 0;
|
|
26
26
|
this._nextFacetIndex = 0;
|
|
27
27
|
this._currentFacetIndex = -1;
|
|
28
28
|
}
|
|
29
29
|
/** Return the client polyface object. */
|
|
30
|
-
clientPolyface() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
30
|
+
clientPolyface() {
|
|
31
|
+
return this._polyface;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Set the number of vertices replicated in visitor arrays (both data and index arrays).
|
|
35
|
+
* * 0,1,2 are the most common as numWrap.
|
|
36
|
+
* * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
|
|
37
|
+
* 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.
|
|
38
|
+
* Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
|
|
39
|
+
* * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
35
40
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
* *
|
|
41
|
+
setNumWrap(numWrap) {
|
|
42
|
+
this._numWrap = numWrap;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Return the number of edges in the current facet.
|
|
46
|
+
* * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
|
|
42
47
|
*/
|
|
48
|
+
get numEdgesThisFacet() {
|
|
49
|
+
return this._numEdges;
|
|
50
|
+
}
|
|
51
|
+
/** Create a visitor for iterating the facets of `polyface`. */
|
|
43
52
|
static create(polyface, numWrap) {
|
|
44
53
|
return new IndexedPolyfaceVisitor(polyface, numWrap);
|
|
45
54
|
}
|
|
46
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
55
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
47
56
|
moveToReadIndex(facetIndex) {
|
|
48
57
|
if (!this._polyface.isValidFacetIndex(facetIndex))
|
|
49
58
|
return false;
|
|
50
59
|
this._currentFacetIndex = facetIndex;
|
|
51
60
|
this._nextFacetIndex = facetIndex + 1;
|
|
52
61
|
this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
|
|
53
|
-
this.
|
|
62
|
+
this.resizeAllArrays(this._numEdges + this._numWrap);
|
|
54
63
|
this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
|
|
55
64
|
return true;
|
|
56
65
|
}
|
|
57
|
-
/** Advance the iterator to a the 'next' facet in the client polyface */
|
|
66
|
+
/** Advance the iterator to a the 'next' facet in the client polyface. */
|
|
58
67
|
moveToNextFacet() {
|
|
59
68
|
if (this._nextFacetIndex !== this._currentFacetIndex)
|
|
60
69
|
return this.moveToReadIndex(this._nextFacetIndex);
|
|
@@ -67,11 +76,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
67
76
|
this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.
|
|
68
77
|
}
|
|
69
78
|
/**
|
|
70
|
-
* Attempts to extract the distance parameter for the given vertex index on the current facet
|
|
71
|
-
* Returns the distance parameter as a point. Returns undefined on failure.
|
|
79
|
+
* Attempts to extract the distance parameter for the given vertex `index` on the current facet.
|
|
80
|
+
* Returns the distance parameter as a point. Returns `undefined` on failure.
|
|
72
81
|
*/
|
|
73
82
|
tryGetDistanceParameter(index, result) {
|
|
74
|
-
if (index >= this.numEdgesThisFacet)
|
|
83
|
+
if (index < 0 || index >= this.numEdgesThisFacet)
|
|
75
84
|
return undefined;
|
|
76
85
|
if (this.param === undefined || this._polyface.data.face.length === 0)
|
|
77
86
|
return undefined;
|
|
@@ -81,11 +90,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
81
90
|
return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
|
|
82
91
|
}
|
|
83
92
|
/**
|
|
84
|
-
* Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
|
|
85
|
-
* Returns the normalized parameter as a point. Returns undefined on failure.
|
|
93
|
+
* Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
|
|
94
|
+
* Returns the normalized parameter as a point. Returns `undefined` on failure.
|
|
86
95
|
*/
|
|
87
96
|
tryGetNormalizedParameter(index, result) {
|
|
88
|
-
if (index >= this.numEdgesThisFacet)
|
|
97
|
+
if (index < 0 || index >= this.numEdgesThisFacet)
|
|
89
98
|
return undefined;
|
|
90
99
|
if (this.param === undefined || this._polyface.data.face.length === 0)
|
|
91
100
|
return undefined;
|
|
@@ -94,19 +103,31 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
94
103
|
return undefined;
|
|
95
104
|
return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
|
|
96
105
|
}
|
|
97
|
-
/** Return the index (in the client polyface) of the current facet */
|
|
98
|
-
currentReadIndex() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/** Return the
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/** Return the
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
106
|
+
/** Return the index (in the client polyface) of the current facet. */
|
|
107
|
+
currentReadIndex() {
|
|
108
|
+
return this._currentFacetIndex;
|
|
109
|
+
}
|
|
110
|
+
/** Return the point index of vertex `i` within the currently loaded facet. */
|
|
111
|
+
clientPointIndex(i) {
|
|
112
|
+
return this.pointIndex[i];
|
|
113
|
+
}
|
|
114
|
+
/** Return the param index of vertex `i` within the currently loaded facet. */
|
|
115
|
+
clientParamIndex(i) {
|
|
116
|
+
return this.paramIndex ? this.paramIndex[i] : -1;
|
|
117
|
+
}
|
|
118
|
+
/** Return the normal index of vertex `i` within the currently loaded facet. */
|
|
119
|
+
clientNormalIndex(i) {
|
|
120
|
+
return this.normalIndex ? this.normalIndex[i] : -1;
|
|
121
|
+
}
|
|
122
|
+
/** Return the color index of vertex `i` within the currently loaded facet. */
|
|
123
|
+
clientColorIndex(i) {
|
|
124
|
+
return this.colorIndex ? this.colorIndex[i] : -1;
|
|
125
|
+
}
|
|
126
|
+
/** Return the aux data index of vertex `i` within the currently loaded facet. */
|
|
127
|
+
clientAuxIndex(i) {
|
|
128
|
+
return this.auxData ? this.auxData.indices[i] : -1;
|
|
129
|
+
}
|
|
130
|
+
/** Clear the contents of all arrays. */
|
|
110
131
|
clearArrays() {
|
|
111
132
|
if (this.point !== undefined)
|
|
112
133
|
this.point.length = 0;
|
|
@@ -117,77 +138,36 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
|
|
|
117
138
|
if (this.color !== undefined)
|
|
118
139
|
this.color.length = 0;
|
|
119
140
|
}
|
|
120
|
-
/**
|
|
141
|
+
/** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
|
|
121
142
|
pushDataFrom(other, index) {
|
|
122
143
|
this.point.pushFromGrowableXYZArray(other.point, index);
|
|
123
|
-
if (this.color && other.color && index < other.color.length)
|
|
124
|
-
this.color.push(other.color[index]);
|
|
125
144
|
if (this.param && other.param && index < other.param.length)
|
|
126
145
|
this.param.pushFromGrowableXYArray(other.param, index);
|
|
127
146
|
if (this.normal && other.normal && index < other.normal.length)
|
|
128
147
|
this.normal.pushFromGrowableXYZArray(other.normal, index);
|
|
148
|
+
if (this.color && other.color && index < other.color.length)
|
|
149
|
+
this.color.push(other.color[index]);
|
|
129
150
|
}
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
151
|
+
/**
|
|
152
|
+
* Transfer interpolated data from the other visitor.
|
|
153
|
+
* * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
|
|
132
154
|
*/
|
|
133
155
|
pushInterpolatedDataFrom(other, index0, fraction, index1) {
|
|
134
156
|
this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);
|
|
135
|
-
if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
|
|
136
|
-
this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));
|
|
137
157
|
if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)
|
|
138
158
|
this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);
|
|
139
159
|
if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)
|
|
140
160
|
this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);
|
|
161
|
+
if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
|
|
162
|
+
this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));
|
|
141
163
|
}
|
|
142
164
|
}
|
|
143
165
|
/**
|
|
144
|
-
*
|
|
145
|
-
* * mask off the low 8 bits
|
|
146
|
-
* * interpolate the number
|
|
147
|
-
* * truncate to floor
|
|
148
|
-
* * shift left
|
|
149
|
-
* * Hence all numbers in and out of the floating point are 0..255.
|
|
150
|
-
* @param color0
|
|
151
|
-
* @param fraction
|
|
152
|
-
* @param color1
|
|
153
|
-
* @param shiftBits
|
|
154
|
-
*/
|
|
155
|
-
function interpolateByte(color0, fraction, color1, shiftBits) {
|
|
156
|
-
color0 = (color0 >>> shiftBits) & 0xFF;
|
|
157
|
-
color1 = (color1 >>> shiftBits) & 0xFF;
|
|
158
|
-
const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;
|
|
159
|
-
return color << shiftBits;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Interpolate each byte of color0 and color1 as integers.
|
|
163
|
-
* @param color0 32 bit color (e.g. rgb+transparency)
|
|
164
|
-
* @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
|
|
165
|
-
* @param color1
|
|
166
|
-
* @param shiftBits
|
|
167
|
-
* @internal
|
|
168
|
-
*/
|
|
169
|
-
export function interpolateColor(color0, fraction, color1) {
|
|
170
|
-
// don't allow fractions outside the individual byte ranges.
|
|
171
|
-
fraction = Geometry.clamp(fraction, 0, 1);
|
|
172
|
-
// interpolate each byte in place ....
|
|
173
|
-
/*
|
|
174
|
-
const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);
|
|
175
|
-
const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;
|
|
176
|
-
const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;
|
|
177
|
-
const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;
|
|
178
|
-
*/
|
|
179
|
-
const byte0 = interpolateByte(color0, fraction, color1, 0);
|
|
180
|
-
const byte1 = interpolateByte(color0, fraction, color1, 8);
|
|
181
|
-
const byte2 = interpolateByte(color0, fraction, color1, 16);
|
|
182
|
-
const byte3 = interpolateByte(color0, fraction, color1, 24);
|
|
183
|
-
return (byte0 | byte1 | byte2 | byte3);
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
|
|
166
|
+
* An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
|
|
187
167
|
* * The subset is defined by an array of facet indices provided when this visitor is created.
|
|
188
|
-
* * Within the subset visitor,
|
|
189
|
-
* * moveToNextFacet moves only within the subset
|
|
190
|
-
* * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
|
|
168
|
+
* * Within the subset visitor, `facetIndex` is understood as index within the subset array:
|
|
169
|
+
* * `moveToNextFacet` moves only within the subset.
|
|
170
|
+
* * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
|
|
191
171
|
* @public
|
|
192
172
|
*/
|
|
193
173
|
export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
@@ -196,17 +176,14 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
196
176
|
this._parentFacetIndices = activeFacetIndices.slice();
|
|
197
177
|
this._nextActiveIndex = 0;
|
|
198
178
|
}
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* * 1 -- add point 0 as closure point
|
|
203
|
-
* * 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.
|
|
204
|
-
* * The activeFacetIndices array indicates all facets to be visited.
|
|
179
|
+
/**
|
|
180
|
+
* Create a visitor for iterating a subset of the facets of `polyface`.
|
|
181
|
+
* * The `activeFacetIndices` array indicates all facets to be visited.
|
|
205
182
|
*/
|
|
206
183
|
static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
|
|
207
184
|
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
|
|
208
185
|
}
|
|
209
|
-
/** Advance the iterator to a particular facet in the client polyface */
|
|
186
|
+
/** Advance the iterator to a particular facet in the client polyface. */
|
|
210
187
|
moveToReadIndex(activeIndex) {
|
|
211
188
|
if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {
|
|
212
189
|
this._nextActiveIndex = activeIndex;
|
|
@@ -214,7 +191,7 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
214
191
|
}
|
|
215
192
|
return false;
|
|
216
193
|
}
|
|
217
|
-
/** Advance the iterator to
|
|
194
|
+
/** Advance the iterator to the next facet in the client polyface. */
|
|
218
195
|
moveToNextFacet() {
|
|
219
196
|
if (this._nextActiveIndex < this._parentFacetIndices.length) {
|
|
220
197
|
const result = this.moveToReadIndex(this._nextActiveIndex);
|
|
@@ -225,11 +202,11 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
225
202
|
}
|
|
226
203
|
return false;
|
|
227
204
|
}
|
|
228
|
-
/** Reset the iterator to start at the first facet
|
|
205
|
+
/** Reset the iterator to start at the first active facet in the polyface. */
|
|
229
206
|
reset() {
|
|
230
207
|
this._nextActiveIndex = 0;
|
|
231
208
|
}
|
|
232
|
-
/**
|
|
209
|
+
/** Return the parent facet index of the indicated index within the active facets. */
|
|
233
210
|
parentFacetIndex(activeIndex) {
|
|
234
211
|
if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {
|
|
235
212
|
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,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,sCAAsC;AAEtC;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IAMtD,0EAA0E;IAC1E,YAA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AI,IAAI,CAAC,gBAAgB,EAAE;YAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,OAAO,SAAS,CAAC;IACnB,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 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,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,sCAAsC;AAEtC;;;;GAIG;AACH,MAAM,OAAO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,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","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"]}
|
|
@@ -8,6 +8,7 @@ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
|
8
8
|
import { Range3d } from "../geometry3d/Range";
|
|
9
9
|
import { Transform } from "../geometry3d/Transform";
|
|
10
10
|
import { FacetFaceData } from "./FacetFaceData";
|
|
11
|
+
import { IndexedPolyfaceVisitor } from "./IndexedPolyfaceVisitor";
|
|
11
12
|
import { PolyfaceData } from "./PolyfaceData";
|
|
12
13
|
/**
|
|
13
14
|
* A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor
|
|
@@ -60,8 +61,9 @@ export declare abstract class Polyface extends GeometryQuery {
|
|
|
60
61
|
*/
|
|
61
62
|
export declare class IndexedPolyface extends Polyface {
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
-
* *
|
|
64
|
+
* Start indices of all facets of the polyface.
|
|
65
|
+
* * Each element is an index to the `this.data.pointIndex` array entry for a specific facet.
|
|
66
|
+
* * The facet count is `_facetStart.length - 1`.
|
|
65
67
|
* * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`
|
|
66
68
|
* up to (but not including) `_facetStart[i + 1]`.
|
|
67
69
|
* * Note the array is initialized with one entry (value 0).
|
|
@@ -131,10 +133,10 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
131
133
|
get zeroTerminatedIndexCount(): number;
|
|
132
134
|
/**
|
|
133
135
|
* Create an empty facet set with coordinate and index data to be supplied later.
|
|
134
|
-
* @param needNormals true
|
|
135
|
-
* @param needParams true
|
|
136
|
-
* @param needColors true
|
|
137
|
-
* @param twoSided true if the facets are to be considered viewable from the back.
|
|
136
|
+
* @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
|
|
137
|
+
* @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
|
|
138
|
+
* @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
|
|
139
|
+
* @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
|
|
138
140
|
*/
|
|
139
141
|
static create(needNormals?: boolean, needParams?: boolean, needColors?: boolean, twoSided?: boolean): IndexedPolyface;
|
|
140
142
|
/**
|
|
@@ -233,7 +235,7 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
233
235
|
/** ASSUME valid facet index. Return one past end index of facet in pointIndex arrays. */
|
|
234
236
|
facetIndex1(index: number): number;
|
|
235
237
|
/** Create a visitor for this polyface */
|
|
236
|
-
createVisitor(numWrap?: number):
|
|
238
|
+
createVisitor(numWrap?: number): IndexedPolyfaceVisitor;
|
|
237
239
|
/** Return the range of (optionally transformed) points in this mesh. */
|
|
238
240
|
range(transform?: Transform, result?: Range3d): Range3d;
|
|
239
241
|
/** Extend `range` with coordinates from this mesh. */
|
|
@@ -255,8 +257,8 @@ export declare class IndexedPolyface extends Polyface {
|
|
|
255
257
|
/**
|
|
256
258
|
* A PolyfaceVisitor manages data while walking through facets.
|
|
257
259
|
* * The polyface visitor holds data for one facet at a time.
|
|
258
|
-
* * The caller can request the position in the addressed polyfaceData as a "readIndex.
|
|
259
|
-
* * The readIndex values (as numbers) are not promised to be sequential
|
|
260
|
+
* * The caller can request the position in the addressed polyfaceData as a "readIndex".
|
|
261
|
+
* * The readIndex values (as numbers) are not promised to be sequential (i.e., it might be a simple facet count
|
|
260
262
|
* or might have "gaps" at the whim of the particular PolyfaceVisitor implementation).
|
|
261
263
|
* @public
|
|
262
264
|
*/
|
|
@@ -281,7 +283,14 @@ export interface PolyfaceVisitor extends PolyfaceData {
|
|
|
281
283
|
clientAuxIndex(i: number): number;
|
|
282
284
|
/** Return the client polyface. */
|
|
283
285
|
clientPolyface(): Polyface | undefined;
|
|
284
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* Set the number of vertices replicated in visitor arrays (both data and index arrays).
|
|
288
|
+
* * 0,1,2 are the most common as numWrap.
|
|
289
|
+
* * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
|
|
290
|
+
* 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.
|
|
291
|
+
* Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
|
|
292
|
+
* * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
|
|
293
|
+
*/
|
|
285
294
|
setNumWrap(numWrap: number): void;
|
|
286
295
|
/** Clear the contents of all arrays. Use this along with `pushDataFrom` to build up new facets. */
|
|
287
296
|
clearArrays(): void;
|