@itwin/core-geometry 5.2.0-dev.2 → 5.2.0-dev.21
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 +33 -1
- package/lib/cjs/Constant.js.map +1 -1
- 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/AnnounceTangentStrokeHandler.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/EllipticalArcApproximationContext.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/TransferWithSplitArcs.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.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +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.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.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.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/SmallSystem.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.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- 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.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.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.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/AnnounceTangentStrokeHandler.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/EllipticalArcApproximationContext.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/TransferWithSplitArcs.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.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +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.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.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.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/SmallSystem.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.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- 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.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.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AngleSweep.js","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAyE;AACzE,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,UAAU;IAC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C;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM;QACX,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD;;;;;OAKG;IACI,6BAA6B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACpG,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,oEAAoE;eACjG,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACtF,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACpG,CAAC;IACD;;;;;OAKG;IACI,0BAA0B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACjG,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACrF,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACjG,CAAC;IACD;;;;;OAKG;IACI,aAAa,CAAC,KAAiB;QACpC,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AAziBD,gCAyiBC","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/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\n\n/**\n * An `AngleSweep` is a pair of angles at start and end of an interval.\n *\n * * For stroking purposes, the \"included interval\" is all angles numerically reached\n * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\n * * Angles greater than 360 and less than 0 are fine as endpoints.\n * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).\n * * Be careful reading orientation from an AngleSweep without a reference vector!\n * * If \"start < end\" the angles in the sweep proceed counterclockwise around the reference vector.\n * * If \"start > end\" the angles in the sweep proceed clockwise around the reference vector.\n * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.\n * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.\n * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.\n * * Math details can be found at docs/learning/geometry/Angle.md .\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .\n * @public\n */\nexport class AngleSweep implements BeJSONFunctions {\n private _radians0: number;\n private _radians1: number;\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startDegrees() {\n return Angle.radiansToDegrees(this._radians0);\n }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endDegrees() {\n return Angle.radiansToDegrees(this._radians1);\n }\n /** Read-property for signed start-to-end sweep in degrees. */\n public get sweepDegrees() {\n return Angle.radiansToDegrees(this.sweepRadians);\n }\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startRadians() {\n return this._radians0;\n }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endRadians() {\n return this._radians1;\n }\n /** Read-property for signed start-to-end sweep in radians. */\n public get sweepRadians() {\n return this._radians1 - this._radians0;\n }\n /** Whether the sweep angles are within smallAngle tolerance, without period shift. */\n public get isEmpty() {\n return Angle.isAlmostEqualRadiansNoPeriodShift(0, this.sweepRadians);\n }\n /** Return the (strongly typed) start angle */\n public get startAngle() {\n return Angle.createRadians(this._radians0);\n }\n /** Return the (strongly typed) end angle */\n public get endAngle() {\n return Angle.createRadians(this._radians1);\n }\n /**\n * Create a sweep as one of\n * * A clone of a given sweep\n * * 0 to given angle\n * * full circle if no arg given (sweep 0 to 360 degrees)\n */\n public static create(data?: AngleSweep | Angle): AngleSweep {\n if (data instanceof AngleSweep)\n return data.clone();\n if (data instanceof Angle)\n return new AngleSweep(0, data.radians);\n return AngleSweep.create360();\n }\n /**\n * (private) constructor with start and end angles in radians.\n * * Use explicitly named static methods to clarify intent and units of inputs:\n *\n * * createStartEndRadians (startRadians:number, endRadians:number)\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\n */\n private constructor(startRadians: number = 0, endRadians: number = 0) {\n this._radians0 = startRadians;\n this._radians1 = endRadians;\n }\n /**\n * Directly set the start and end angles in radians\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\n */\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\n const delta = endRadians - startRadians;\n if (Angle.isFullCircleRadians(delta)) {\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\n }\n this._radians0 = startRadians;\n this._radians1 = endRadians;\n }\n /** Directly set the start and end angles in degrees */\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\n }\n /**\n * Create an AngleSweep from start and end angles given in radians.\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\n */\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, endRadians);\n return result;\n }\n /** Return the AngleSweep obtained by subtracting radians from the start and end angles of this sweep. */\n public cloneMinusRadians(radians: number): AngleSweep {\n return new AngleSweep(this._radians0 - radians, this._radians1 - radians);\n }\n /** Create an AngleSweep from start and end angles given in degrees. */\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\n }\n /** Create an angle sweep from strongly typed start and end angles */\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\n return result;\n }\n /** Create an AngleSweep from start and end angles given in radians. */\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\n return result;\n }\n /** Create an AngleSweep from start and sweep given in degrees. */\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\n }\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\n }\n /** Return a sweep with limits interpolated between this and other. */\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\n return new AngleSweep(\n Geometry.interpolate(this._radians0, fraction, other._radians0),\n Geometry.interpolate(this._radians1, fraction, other._radians1),\n );\n }\n /** Copy from other AngleSweep. */\n public setFrom(other: AngleSweep) {\n this._radians0 = other._radians0;\n this._radians1 = other._radians1;\n }\n /** Create a full circle sweep (CCW). startRadians defaults to 0 */\n public static create360(startRadians?: number): AngleSweep {\n startRadians = startRadians ? startRadians : 0.0;\n return new AngleSweep(startRadians, startRadians + 2.0 * Math.PI);\n }\n /** Create a sweep from the south pole to the north pole (-90 to +90). */\n public static createFullLatitude() {\n return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI);\n }\n /** Reverse the start and end angle in place. */\n public reverseInPlace() {\n const tmp = this._radians0;\n this._radians0 = this._radians1;\n this._radians1 = tmp;\n }\n /**\n * Return a sweep for the \"other\" part of the circle.\n * @param reverseDirection true to move backwards (CW) from start to end, false to more forwards (CCW) from start to end.\n */\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\n if (reverseDirection)\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\n else\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\n }\n /** Restrict start and end angles to the degree range [-90,+90]. */\n public capLatitudeInPlace(): void {\n const limit = 0.5 * Math.PI;\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\n }\n /**\n * Restrict [[sweepDegrees]] to the range [-360, 360].\n * The start angle and sign of the sweep angle are unchanged.\n */\n public clampToFullCircle(result?: AngleSweep): AngleSweep {\n result = result ?? new AngleSweep();\n const sweepRadians = Geometry.clampToStartEnd(this.sweepRadians, -Angle.pi2Radians, Angle.pi2Radians);\n result.setStartEndRadians(this._radians0, this._radians0 + sweepRadians);\n return result;\n }\n /** Ask if the sweep is counterclockwise, i.e. positive sweep. */\n public get isCCW(): boolean {\n return this._radians1 >= this._radians0;\n }\n /** Ask if the sweep is a full circle. */\n public get isFullCircle(): boolean {\n return Angle.isFullCircleRadians(this.sweepRadians);\n }\n /** Ask if the sweep is a full sweep from south pole to north pole. */\n public get isFullLatitudeSweep(): boolean {\n const a = Math.PI * 0.5;\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\n }\n /** Return a clone of this sweep. */\n public clone(): AngleSweep {\n return new AngleSweep(this._radians0, this._radians1);\n }\n /** Convert fractional position in the sweep to radians. */\n public fractionToRadians(fraction: number): number {\n return fraction < 0.5 ?\n this._radians0 + fraction * this.sweepRadians :\n this._radians1 + (fraction - 1.0) * this.sweepRadians;\n }\n /** Convert fractional position in the sweep to strongly typed Angle object. */\n public fractionToAngle(fraction: number) {\n return Angle.createRadians(this.fractionToRadians(fraction));\n }\n /**\n * Return 2PI divided by the sweep radians.\n * * This is the number of fractional intervals required to cover a whole circle.\n * @returns period of the sweep, or 1 if sweep is empty.\n */\n public fractionPeriod(): number {\n return this.isEmpty ? 1.0 : Angle.pi2Radians / Math.abs(this.sweepRadians);\n }\n /**\n * Return the fractionalized position of the given angle (as Angle) computed without consideration of\n * 2PI period and without consideration of angle sweep direction (CW or CCW).\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * negative fraction for angles \"before\" the start angle if start < end\n * * fraction larger than one for angles \"after\" the end angle if start < end\n * * fraction larger than one for angles \"before\" the start angle if start > end\n * * negative fraction for angles \"after\" the end angle if start > end\n * * does not allow period shift\n * @returns unbounded fraction, or 1 if sweep is empty.\n */\n public angleToUnboundedFraction(theta: Angle): number {\n return this.isEmpty ? 1.0 : (theta.radians - this._radians0) / this.sweepRadians;\n }\n\n /**\n * Convert a sweep fraction to the equivalent period-shifted fraction inside the sweep, or within one period of zero\n * on the desired side.\n * @param fraction fraction of the sweep.\n * @param radians0 start angle of sweep (in radians).\n * @param radians1 end angle of sweep (in radians).\n * @param toNegativeFraction exterior fraction handling:\n * * if true, return `fraction` period-shifted to within one period of the start\n * * if false, return `fraction` period-shifted to within one period of the end\n * * if undefined, return the period-shift of `fraction` closest to [0,1].\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\n * returned unchanged.\n */\n public static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number {\n const sweep = radians1 - radians0;\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\n return fraction; // empty sweep\n if (Geometry.isIn01(fraction))\n return fraction;\n const period = Angle.pi2Radians / Math.abs(sweep);\n fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction\n if (fraction + period < 1)\n fraction += period; // it's really an interior fraction\n if (Geometry.isIn01(fraction))\n return fraction;\n if (toNegativeFraction === true)\n return fraction < 0 ? fraction : fraction - period;\n if (toNegativeFraction === false)\n return fraction > 1 ? fraction : fraction + period;\n const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;\n const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign\n const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;\n return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]\n }\n /**\n * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of\n * zero on the desired side.\n * @param fraction fraction of the sweep.\n * @param toNegativeFraction exterior fraction handling:\n * * if true, return `fraction` period-shifted to within one period of the start\n * * if false, return `fraction` period-shifted to within one period of the end\n * * if undefined, return the period-shift of `fraction` closest to [0,1].\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\n * returned unchanged.\n */\n public fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number {\n return AngleSweep.fractionToSignedPeriodicFractionStartEnd(fraction, this._radians0, this._radians1, toNegativeFraction);\n }\n\n /**\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\n * * consider radians0 as `start` angle of the sweep and radians1 as `end` angle of the sweep\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * allows period shift\n * @param radians input angle (in radians)\n * @param radians0 start angle of sweep (in radians)\n * @param radians1 end angle of sweep (in radians)\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\n */\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\n const zeroSweepMarker = Geometry.largeCoordinateResult;\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\n if (fraction === zeroSweepMarker)\n return zeroSweepDefault;\n if (fraction < 0) {\n const period = Angle.pi2Radians / Math.abs(radians1 - radians0);\n fraction += period;\n }\n return fraction;\n }\n /**\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * allows period shift\n * @param radians input angle (in radians)\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\n */\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\n }\n /**\n * Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period.\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * allows period shift\n * @param theta input angle\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\n */\n public angleToPositivePeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\n return this.radiansToPositivePeriodicFraction(theta.radians, zeroSweepDefault);\n }\n /**\n * Return the fractionalized position of the given array of angles (as radian), computed with consideration of 2PI period.\n * * fraction is always positive\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * allows period shift\n */\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\n const n = data.length;\n for (let i = 0; i < n; i++) {\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\n }\n }\n /**\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * negative fraction for angles \"before\" the start angle\n * * fraction larger than one for angles \"after\" the end angle\n * * allows period shift\n * @param radians input angle (in radians)\n * @param radians0 start angle of sweep (in radians)\n * @param radians1 end angle of sweep (in radians)\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty.\n */\n public static radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\n const sweep = radians1 - radians0;\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\n return zeroSweepDefault;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians0, radians1)) {\n // for sweep = 2nPi !== 0, allow matching without period shift, else we never return 1.0\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians1))\n return 1.0;\n } else {\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\n return 1.0;\n }\n const fraction = (radians - radians0) / sweep;\n return this.fractionToSignedPeriodicFractionStartEnd(fraction, radians0, radians1, fraction < 0);\n }\n /**\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * negative fraction for angles \"before\" the start angle\n * * fraction larger than one for angles \"after\" the end angle\n * * allows period shift\n * @param radians input angle (in radians)\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\n */\n public radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\n return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\n }\n /**\n * Return the fractionalized position of the given angle (as Angle) computed with consideration of\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * negative fraction for angles \"before\" the start angle\n * * fraction larger than one for angles \"after\" the end angle\n * * allows period shift\n * @param theta input angle\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\n */\n public angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\n return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault);\n }\n\n /**\n * Return the fractionalized position of the given radian angle with respect to the sweep.\n * * The start angle returns fraction 0\n * * The end angle returns fraction 1\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\n * @param radians input angle (in radians)\n * @param radians0 start angle of sweep (in radians)\n * @param radians1 end angle of sweep (in radians)\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFractionStartEnd]].\n * @param zeroSweepDefault return value when the sweep is empty (default 0).\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty\n */\n public static radiansToSignedFractionStartEnd(radians: number, radians0: number, radians1: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\n const zeroSweepMarker = Geometry.largeCoordinateResult;\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\n if (fraction === zeroSweepMarker)\n return zeroSweepDefault;\n if ((toNegativeFraction && fraction > 1) || (!toNegativeFraction && fraction < 0)) {\n let period = Angle.pi2Radians / Math.abs(radians1 - radians0);\n if (toNegativeFraction)\n period = -period;\n fraction += period;\n }\n return fraction;\n }\n /**\n * Return the fractionalized position of the given radian angle with respect to this sweep.\n * * The start angle returns fraction 0\n * * The end angle returns fraction 1\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\n * @param radians input angle (in radians)\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFraction]].\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\n */\n public radiansToSignedFraction(radians: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\n return AngleSweep.radiansToSignedFractionStartEnd(radians, this._radians0, this._radians1, toNegativeFraction, zeroSweepDefault);\n }\n /**\n * Return the fractionalized position of the given angle with respect to this sweep.\n * * The start angle returns fraction 0\n * * The end angle returns fraction 1\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\n * @param theta input angle\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\n * a number greater than one (false, default). If false, this is just [[angleToPositivePeriodicFraction]].\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\n */\n public angleToSignedFraction(theta: Angle, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\n return this.radiansToSignedFraction(theta.radians, toNegativeFraction, zeroSweepDefault);\n }\n\n /** Test if the given angle (as radians) is within sweep (between radians0 and radians1) */\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\n const delta0 = radians - radians0;\n const delta1 = radians - radians1;\n if (delta0 * delta1 <= 0.0)\n return true;\n if (radians0 === radians1)\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\n }\n /** Test if the given angle (as radians) is within sweep */\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\n }\n /** Test if the given angle (as Angle) is within the sweep */\n public isAngleInSweep(angle: Angle): boolean {\n return this.isRadiansInSweep(angle.radians);\n }\n /**\n * Set this AngleSweep from various sources:\n * * if json is undefined, a full-circle sweep is returned.\n * * If json is an AngleSweep object, it is cloned\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\n * * Otherwise, a full-circle sweep is returned.\n */\n public setFromJSON(json?: any) {\n if (!json)\n this.setStartEndRadians(); // default full circle\n else if (json instanceof AngleSweep)\n this.setFrom(json);\n else if (Geometry.isNumberArray(json.degrees, 2))\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\n else if (Geometry.isNumberArray(json.radians, 2))\n this.setStartEndRadians(json.radians[0], json.radians[1]);\n else if (Geometry.isNumberArray(json, 2))\n this.setStartEndDegrees(json[0], json[1]);\n else\n this.setStartEndRadians(); // default full circle\n }\n /** Create an AngleSweep from a json object. */\n public static fromJSON(json?: AngleSweepProps): AngleSweep {\n const result = AngleSweep.create360();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Convert an AngleSweep to a JSON object.\n * @return {*} [startAngleInDegrees, endAngleInDegrees]\n */\n public toJSON(): any {\n return [this.startDegrees, this.endDegrees];\n }\n /**\n * Test if two angle sweeps match within the given tolerance.\n * * Period shifts are allowed, but orientations must be the same.\n * @param other sweep to compare to this instance\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\n */\n public isAlmostEqualAllowPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\n return this.isCCW === other.isCCW // this rules out equating opposite sweeps like [0,-100] and [0,260]\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0, radianTol)\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\n }\n /**\n * Test if two angle sweeps match within the given tolerance.\n * * Period shifts are not allowed.\n * @param other sweep to compare to this instance\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\n */\n public isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0, radianTol)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\n }\n /**\n * Test if start and end angles match with radians tolerance.\n * * Period shifts are not allowed.\n * * This function is equivalent to isAlmostEqualNoPeriodShift. It is present for consistency with other classes.\n * However, it is recommended to use isAlmostEqualNoPeriodShift which has a clearer name.\n */\n public isAlmostEqual(other: AngleSweep): boolean {\n return this.isAlmostEqualNoPeriodShift(other);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AngleSweep.js","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAyE;AACzE,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,UAAU;IACb,SAAS,CAAS;IAClB,SAAS,CAAS;IAC1B,iEAAiE;IACjE,IAAW,YAAY;QACrB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,+DAA+D;IAC/D,IAAW,UAAU;QACnB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,8DAA8D;IAC9D,IAAW,YAAY;QACrB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,Y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EAAE,SAAS,CAAC;eACtF,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACpG,CAAC;IACD;;;;;OAKG;IACI,0BAA0B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACjG,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACrF,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACjG,CAAC;IACD;;;;;OAKG;IACI,aAAa,CAAC,KAAiB;QACpC,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AAziBD,gCAyiBC","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/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * An `AngleSweep` is a pair of angles at start and end of an interval.\r\n *\r\n * * For stroking purposes, the \"included interval\" is all angles numerically reached\r\n * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.\r\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\r\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\r\n * * Angles greater than 360 and less than 0 are fine as endpoints.\r\n * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).\r\n * * Be careful reading orientation from an AngleSweep without a reference vector!\r\n * * If \"start < end\" the angles in the sweep proceed counterclockwise around the reference vector.\r\n * * If \"start > end\" the angles in the sweep proceed clockwise around the reference vector.\r\n * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.\r\n * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.\r\n * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.\r\n * * Math details can be found at docs/learning/geometry/Angle.md .\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .\r\n * @public\r\n */\r\nexport class AngleSweep implements BeJSONFunctions {\r\n private _radians0: number;\r\n private _radians1: number;\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startDegrees() {\r\n return Angle.radiansToDegrees(this._radians0);\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endDegrees() {\r\n return Angle.radiansToDegrees(this._radians1);\r\n }\r\n /** Read-property for signed start-to-end sweep in degrees. */\r\n public get sweepDegrees() {\r\n return Angle.radiansToDegrees(this.sweepRadians);\r\n }\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startRadians() {\r\n return this._radians0;\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endRadians() {\r\n return this._radians1;\r\n }\r\n /** Read-property for signed start-to-end sweep in radians. */\r\n public get sweepRadians() {\r\n return this._radians1 - this._radians0;\r\n }\r\n /** Whether the sweep angles are within smallAngle tolerance, without period shift. */\r\n public get isEmpty() {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(0, this.sweepRadians);\r\n }\r\n /** Return the (strongly typed) start angle */\r\n public get startAngle() {\r\n return Angle.createRadians(this._radians0);\r\n }\r\n /** Return the (strongly typed) end angle */\r\n public get endAngle() {\r\n return Angle.createRadians(this._radians1);\r\n }\r\n /**\r\n * Create a sweep as one of\r\n * * A clone of a given sweep\r\n * * 0 to given angle\r\n * * full circle if no arg given (sweep 0 to 360 degrees)\r\n */\r\n public static create(data?: AngleSweep | Angle): AngleSweep {\r\n if (data instanceof AngleSweep)\r\n return data.clone();\r\n if (data instanceof Angle)\r\n return new AngleSweep(0, data.radians);\r\n return AngleSweep.create360();\r\n }\r\n /**\r\n * (private) constructor with start and end angles in radians.\r\n * * Use explicitly named static methods to clarify intent and units of inputs:\r\n *\r\n * * createStartEndRadians (startRadians:number, endRadians:number)\r\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\r\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\r\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\r\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\r\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\r\n */\r\n private constructor(startRadians: number = 0, endRadians: number = 0) {\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /**\r\n * Directly set the start and end angles in radians\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\r\n const delta = endRadians - startRadians;\r\n if (Angle.isFullCircleRadians(delta)) {\r\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\r\n }\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /** Directly set the start and end angles in degrees */\r\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\r\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\r\n }\r\n /**\r\n * Create an AngleSweep from start and end angles given in radians.\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, endRadians);\r\n return result;\r\n }\r\n /** Return the AngleSweep obtained by subtracting radians from the start and end angles of this sweep. */\r\n public cloneMinusRadians(radians: number): AngleSweep {\r\n return new AngleSweep(this._radians0 - radians, this._radians1 - radians);\r\n }\r\n /** Create an AngleSweep from start and end angles given in degrees. */\r\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\r\n }\r\n /** Create an angle sweep from strongly typed start and end angles */\r\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and end angles given in radians. */\r\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and sweep given in degrees. */\r\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\r\n }\r\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\r\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\r\n }\r\n /** Return a sweep with limits interpolated between this and other. */\r\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\r\n return new AngleSweep(\r\n Geometry.interpolate(this._radians0, fraction, other._radians0),\r\n Geometry.interpolate(this._radians1, fraction, other._radians1),\r\n );\r\n }\r\n /** Copy from other AngleSweep. */\r\n public setFrom(other: AngleSweep) {\r\n this._radians0 = other._radians0;\r\n this._radians1 = other._radians1;\r\n }\r\n /** Create a full circle sweep (CCW). startRadians defaults to 0 */\r\n public static create360(startRadians?: number): AngleSweep {\r\n startRadians = startRadians ? startRadians : 0.0;\r\n return new AngleSweep(startRadians, startRadians + 2.0 * Math.PI);\r\n }\r\n /** Create a sweep from the south pole to the north pole (-90 to +90). */\r\n public static createFullLatitude() {\r\n return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI);\r\n }\r\n /** Reverse the start and end angle in place. */\r\n public reverseInPlace() {\r\n const tmp = this._radians0;\r\n this._radians0 = this._radians1;\r\n this._radians1 = tmp;\r\n }\r\n /**\r\n * Return a sweep for the \"other\" part of the circle.\r\n * @param reverseDirection true to move backwards (CW) from start to end, false to more forwards (CCW) from start to end.\r\n */\r\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\r\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\r\n if (reverseDirection)\r\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\r\n else\r\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\r\n }\r\n /** Restrict start and end angles to the degree range [-90,+90]. */\r\n public capLatitudeInPlace(): void {\r\n const limit = 0.5 * Math.PI;\r\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\r\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\r\n }\r\n /**\r\n * Restrict [[sweepDegrees]] to the range [-360, 360].\r\n * The start angle and sign of the sweep angle are unchanged.\r\n */\r\n public clampToFullCircle(result?: AngleSweep): AngleSweep {\r\n result = result ?? new AngleSweep();\r\n const sweepRadians = Geometry.clampToStartEnd(this.sweepRadians, -Angle.pi2Radians, Angle.pi2Radians);\r\n result.setStartEndRadians(this._radians0, this._radians0 + sweepRadians);\r\n return result;\r\n }\r\n /** Ask if the sweep is counterclockwise, i.e. positive sweep. */\r\n public get isCCW(): boolean {\r\n return this._radians1 >= this._radians0;\r\n }\r\n /** Ask if the sweep is a full circle. */\r\n public get isFullCircle(): boolean {\r\n return Angle.isFullCircleRadians(this.sweepRadians);\r\n }\r\n /** Ask if the sweep is a full sweep from south pole to north pole. */\r\n public get isFullLatitudeSweep(): boolean {\r\n const a = Math.PI * 0.5;\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\r\n }\r\n /** Return a clone of this sweep. */\r\n public clone(): AngleSweep {\r\n return new AngleSweep(this._radians0, this._radians1);\r\n }\r\n /** Convert fractional position in the sweep to radians. */\r\n public fractionToRadians(fraction: number): number {\r\n return fraction < 0.5 ?\r\n this._radians0 + fraction * this.sweepRadians :\r\n this._radians1 + (fraction - 1.0) * this.sweepRadians;\r\n }\r\n /** Convert fractional position in the sweep to strongly typed Angle object. */\r\n public fractionToAngle(fraction: number) {\r\n return Angle.createRadians(this.fractionToRadians(fraction));\r\n }\r\n /**\r\n * Return 2PI divided by the sweep radians.\r\n * * This is the number of fractional intervals required to cover a whole circle.\r\n * @returns period of the sweep, or 1 if sweep is empty.\r\n */\r\n public fractionPeriod(): number {\r\n return this.isEmpty ? 1.0 : Angle.pi2Radians / Math.abs(this.sweepRadians);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed without consideration of\r\n * 2PI period and without consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle if start < end\r\n * * fraction larger than one for angles \"after\" the end angle if start < end\r\n * * fraction larger than one for angles \"before\" the start angle if start > end\r\n * * negative fraction for angles \"after\" the end angle if start > end\r\n * * does not allow period shift\r\n * @returns unbounded fraction, or 1 if sweep is empty.\r\n */\r\n public angleToUnboundedFraction(theta: Angle): number {\r\n return this.isEmpty ? 1.0 : (theta.radians - this._radians0) / this.sweepRadians;\r\n }\r\n\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside the sweep, or within one period of zero\r\n * on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param radians0 start angle of sweep (in radians).\r\n * @param radians1 end angle of sweep (in radians).\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return fraction; // empty sweep\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n const period = Angle.pi2Radians / Math.abs(sweep);\r\n fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction\r\n if (fraction + period < 1)\r\n fraction += period; // it's really an interior fraction\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n if (toNegativeFraction === true)\r\n return fraction < 0 ? fraction : fraction - period;\r\n if (toNegativeFraction === false)\r\n return fraction > 1 ? fraction : fraction + period;\r\n const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;\r\n const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign\r\n const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;\r\n return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]\r\n }\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of\r\n * zero on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number {\r\n return AngleSweep.fractionToSignedPeriodicFractionStartEnd(fraction, this._radians0, this._radians1, toNegativeFraction);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * consider radians0 as `start` angle of the sweep and radians1 as `end` angle of the sweep\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if (fraction < 0) {\r\n const period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public angleToPositivePeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToPositivePeriodicFraction(theta.radians, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given array of angles (as radian), computed with consideration of 2PI period.\r\n * * fraction is always positive\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n */\r\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\r\n const n = data.length;\r\n for (let i = 0; i < n; i++) {\r\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\r\n }\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return zeroSweepDefault;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians0, radians1)) {\r\n // for sweep = 2nPi !== 0, allow matching without period shift, else we never return 1.0\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians1))\r\n return 1.0;\r\n } else {\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\r\n return 1.0;\r\n }\r\n const fraction = (radians - radians0) / sweep;\r\n return this.fractionToSignedPeriodicFractionStartEnd(fraction, radians0, radians1, fraction < 0);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to the sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFractionStartEnd]].\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty\r\n */\r\n public static radiansToSignedFractionStartEnd(radians: number, radians0: number, radians1: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if ((toNegativeFraction && fraction > 1) || (!toNegativeFraction && fraction < 0)) {\r\n let period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n if (toNegativeFraction)\r\n period = -period;\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public radiansToSignedFraction(radians: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToSignedFractionStartEnd(radians, this._radians0, this._radians1, toNegativeFraction, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param theta input angle\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[angleToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public angleToSignedFraction(theta: Angle, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToSignedFraction(theta.radians, toNegativeFraction, zeroSweepDefault);\r\n }\r\n\r\n /** Test if the given angle (as radians) is within sweep (between radians0 and radians1) */\r\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\r\n const delta0 = radians - radians0;\r\n const delta1 = radians - radians1;\r\n if (delta0 * delta1 <= 0.0)\r\n return true;\r\n if (radians0 === radians1)\r\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\r\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\r\n }\r\n /** Test if the given angle (as radians) is within sweep */\r\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\r\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\r\n }\r\n /** Test if the given angle (as Angle) is within the sweep */\r\n public isAngleInSweep(angle: Angle): boolean {\r\n return this.isRadiansInSweep(angle.radians);\r\n }\r\n /**\r\n * Set this AngleSweep from various sources:\r\n * * if json is undefined, a full-circle sweep is returned.\r\n * * If json is an AngleSweep object, it is cloned\r\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\r\n * * Otherwise, a full-circle sweep is returned.\r\n */\r\n public setFromJSON(json?: any) {\r\n if (!json)\r\n this.setStartEndRadians(); // default full circle\r\n else if (json instanceof AngleSweep)\r\n this.setFrom(json);\r\n else if (Geometry.isNumberArray(json.degrees, 2))\r\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\r\n else if (Geometry.isNumberArray(json.radians, 2))\r\n this.setStartEndRadians(json.radians[0], json.radians[1]);\r\n else if (Geometry.isNumberArray(json, 2))\r\n this.setStartEndDegrees(json[0], json[1]);\r\n else\r\n this.setStartEndRadians(); // default full circle\r\n }\r\n /** Create an AngleSweep from a json object. */\r\n public static fromJSON(json?: AngleSweepProps): AngleSweep {\r\n const result = AngleSweep.create360();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Convert an AngleSweep to a JSON object.\r\n * @return {*} [startAngleInDegrees, endAngleInDegrees]\r\n */\r\n public toJSON(): any {\r\n return [this.startDegrees, this.endDegrees];\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are allowed, but orientations must be the same.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualAllowPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return this.isCCW === other.isCCW // this rules out equating opposite sweeps like [0,-100] and [0,260]\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are not allowed.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if start and end angles match with radians tolerance.\r\n * * Period shifts are not allowed.\r\n * * This function is equivalent to isAlmostEqualNoPeriodShift. It is present for consistency with other classes.\r\n * However, it is recommended to use isAlmostEqualNoPeriodShift which has a clearer name.\r\n */\r\n public isAlmostEqual(other: AngleSweep): boolean {\r\n return this.isAlmostEqualNoPeriodShift(other);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IACjC,gDAAgD;IACzC,KAAK,CAAU;IACtB,4FAA4F;IACrF,KAAK,CAAU;IACtB,kCAAkC;IAC3B,CAAC,CAAS;IACjB,0EAA0E;IACnE,gBAAgB,CAAS;IAChC;;;;;OAKG;IACI,gBAAgB,CAAS;IAEhC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD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C,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B,EAAE,GAAY;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF;AAziBD,kDAyiBC","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/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\n\nimport { Geometry, PolygonLocation } from \"../Geometry\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Ray3d } from \"./Ray3d\";\nimport { Transform } from \"./Transform\";\n\n/**\n * Carries data about a location in the plane of a triangle.\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\n * services on the latter.\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\n * if they lie within a distance or parametric tolerance.\n *\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\n * `T` with vertices `v0, v1, v2`:\n * * `1 = b0 + b1 + b2`\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\n * be written `P = b1 * U + b2 * V`.\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\n * NOT sum to 1, then `p` is not coplanar with `T`\n * @public\n */\nexport class TriangleLocationDetail {\n /** The Cartesian coordinates of the point p. */\n public world: Point3d;\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\n public local: Point3d;\n /** Application-specific number */\n public a: number;\n /** Index of the triangle vertex at the start of the closest edge to p. */\n public closestEdgeIndex: number;\n /**\n * The parameter f along the closest edge to p of its projection q.\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\n * * Note that 0 <= f <= 1.\n */\n public closestEdgeParam: number;\n\n private constructor() {\n this.world = new Point3d();\n this.local = new Point3d();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /** Invalidate this detail (set all attributes to zero) . */\n public invalidate() {\n this.world.setZero();\n this.local.setZero();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /**\n * Create an invalid detail.\n * @param result optional pre-allocated object to fill and return\n */\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\n if (undefined === result)\n result = new TriangleLocationDetail();\n else\n result.invalidate();\n return result;\n }\n /**\n * Set the instance contents from the `other` detail.\n * @param other detail to clone\n */\n public copyContentsFrom(other: TriangleLocationDetail) {\n this.world.setFrom(other.world);\n this.local.setFrom(other.local);\n this.a = other.a;\n this.closestEdgeIndex = other.closestEdgeIndex;\n this.closestEdgeParam = other.closestEdgeParam;\n }\n /** Whether this detail is invalid. */\n public get isValid(): boolean {\n return !this.local.isZero;\n }\n /**\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\n * on the triangle.\n * @see classify\n */\n public get isInsideOrOn(): boolean {\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\n }\n /**\n * Queries this detail to classify the location of this instance with respect to the triangle.\n * @returns location code\n * @see isInsideOrOn\n */\n public get classify(): PolygonLocation {\n if (!this.isValid)\n return PolygonLocation.Unknown;\n if (this.isInsideOrOn) {\n let numZero = 0;\n if (Math.abs(this.local.x) === 0.0)\n ++numZero;\n if (Math.abs(this.local.y) === 0.0)\n ++numZero;\n if (Math.abs(this.local.z) === 0.0)\n ++numZero;\n if (2 === numZero)\n return PolygonLocation.OnPolygonVertex;\n if (1 === numZero)\n return PolygonLocation.OnPolygonEdgeInterior;\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\n }\n return (this.closestEdgeParam === 0.0) ?\n PolygonLocation.OutsidePolygonProjectsToVertex :\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\n }\n}\n\n/**\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\n * @public\n */\nexport class BarycentricTriangle {\n /** Array of 3 point coordinates for the triangle. */\n public points: Point3d[];\n /** Edge length squared cache, indexed by opposite vertex index */\n protected edgeLength2: number[];\n // private attributes\n private static _workPoint?: Point3d;\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workRay?: Ray3d;\n private static _workMatrix?: Matrix3d;\n /**\n * Constructor.\n * * Point references are CAPTURED\n */\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\n this.points = [];\n this.points.push(point0);\n this.points.push(point1);\n this.points.push(point2);\n this.edgeLength2 = [];\n this.edgeLength2.push(point1.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point1));\n }\n /**\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\n * is undefined.\n */\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\n this.points[0].setFromPoint3d(point0);\n this.points[1].setFromPoint3d(point1);\n this.points[2].setFromPoint3d(point2);\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\n }\n /** Copy all values from `other` */\n public setFrom(other: BarycentricTriangle) {\n for (let i = 0; i < 3; ++i) {\n this.points[i].setFromPoint3d(other.points[i]);\n this.edgeLength2[i] = other.edgeLength2[i];\n }\n }\n /**\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\n * @param result optional pre-allocated triangle.\n */\n public static createXYZXYZXYZ(\n x0: number, y0: number, z0: number,\n x1: number, y1: number, z1: number,\n x2: number, y2: number, z2: number,\n result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\n result.points[0].set(x0, y0, z0);\n result.points[1].set(x1, y1, z1);\n result.points[2].set(x2, y2, z2);\n return result;\n }\n /** Create a triangle with coordinates cloned from given points. */\n public static create(\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(point0.clone(), point1.clone(), point2.clone());\n result.set(point0, point1, point2);\n return result;\n }\n /** Return a new `BarycentricTriangle` with the same coordinates. */\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\n result,\n );\n }\n /** Return the area of the triangle. */\n public get area(): number {\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\n }\n /**\n * Compute squared length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLengthSquared(oppositeVertexIndex: number): number {\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\n }\n /**\n * Compute length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLength(oppositeVertexIndex: number): number {\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\n }\n /** Return area divided by sum of squared lengths. */\n public get aspectRatio(): number {\n return Geometry.safeDivideFraction(\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\n );\n }\n /** Return the perimeter of the triangle. */\n public get perimeter(): number {\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\n }\n /**\n * Return the unit normal of the triangle.\n * @param result optional pre-allocated vector to fill and return.\n * @returns unit normal, or undefined if cross product length is too small.\n */\n public normal(result?: Vector3d): Vector3d | undefined {\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\n if (cross.tryNormalizeInPlace())\n return cross;\n return undefined;\n }\n /**\n * Sum the triangle points with given scales.\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\n * @param b0 scale to apply to vertex 0\n * @param b1 scale to apply to vertex 1\n * @param b2 scale to apply to vertex 2\n * @param result optional pre-allocated point to fill and return\n * @return linear combination of the vertices of this triangle\n * @see [[pointToFraction]]\n */\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\n // p = b0 * v0 + b1 * v1 + b2 * v2\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\n }\n /**\n * Compute the projection of the given `point` onto the plane of this triangle.\n * @param point point p to project\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the projection point `P = d.world`:\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\n * @see [[fractionToPoint]]\n */\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\n if (undefined === normal)\n return TriangleLocationDetail.create(result);\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\n }\n /** Convert from opposite-vertex to start-vertex edge indexing. */\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\n return Geometry.cyclic3dAxis(edgeIndex + 1);\n }\n /** Convert from start-vertex to opposite-vertex edge indexing. */\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\n */\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 > 0 && b1 > 0 && b2 > 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\n */\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\n return 0;\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\n return 1;\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\n if (b1 < 0 && b2 < 0)\n return 0;\n if (b0 < 0 && b2 < 0)\n return 1;\n if (b0 < 0 && b1 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\n */\n private static isOnVertex(b0: number, b1: number, b2: number): number {\n if (b0 === 1 && b1 === 0 && b2 === 0)\n return 0;\n if (b0 === 0 && b1 === 1 && b2 === 0)\n return 1;\n if (b0 === 0 && b1 === 0 && b2 === 1)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\n */\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\n if (b0 === 0 && b1 > 0 && b2 > 0)\n return 0;\n if (b0 > 0 && b1 === 0 && b2 > 0)\n return 1;\n if (b0 > 0 && b1 > 0 && b2 === 0)\n return 2;\n return -1;\n }\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\n private static indexOfMinimum(fn: (index: number) => number): number {\n let i = 0;\n let min = fn(0);\n const val = fn(1);\n if (min > val) {\n i = 1;\n min = val;\n }\n if (min > fn(2))\n i = 2;\n return i;\n }\n /**\n * Compute the squared distance between two points given by their barycentric coordinates.\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\n */\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\n // The barycentric displacement vector distance formula\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\n }\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\n return BarycentricTriangle.indexOfMinimum((i: number) => {\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\n });\n }\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\n const j = Geometry.cyclic3dAxis(i + 1);\n const k = Geometry.cyclic3dAxis(j + 1);\n return Geometry.dotProductXYZXYZ(\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\n );\n }\n /**\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\n * @param k vertex v_k is opposite the edge e_k\n * @param b barycentric coordinates of point to project\n * @returns parameter f along e_k, such that:\n * * the projection point is q = v_i + f * (v_j - v_i)\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\n */\n private computeProjectionToEdge(k: number, b: number[]): number {\n /**\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\n * First we prove P = b_jU + b_kV.\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\n * = (b_j * U) + (b_k * V) + v_i - v_i\n * = (b_j * U) + (b_k * V)\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\n * Therefore, 0 = (p - q).(v_j - v_i)\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\n * = (b_jU + b_kV - fU).U\n * = b_jU.U + b_kU.V - fU.U\n * Thus f = b_j + b_k(U.V/U.U)\n */\n k = Geometry.cyclic3dAxis(k);\n const i = Geometry.cyclic3dAxis(k + 1);\n const j = Geometry.cyclic3dAxis(i + 1);\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\n }\n /**\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\n * @param b0 barycentric coordinate of p corresponding to v_0\n * @param b1 barycentric coordinate of p corresponding to v_1\n * @param b2 barycentric coordinate of p corresponding to v_2\n * @returns closest edge start vertex index i and projection parameter f such that the projection\n * q = v_i + f * (v_j - v_i).\n */\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\n const b: number[] = [b0, b1, b2];\n let edgeIndex = -1; // opposite-vertex index\n let edgeParam = 0.0;\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\n // We want smallest projection distance d_i of p to e_i.\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\n });\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\n }\n }\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0) {\n edgeParam = 0.0; // start of this edge\n } else if (edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\n }\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\n }\n // invalid edgeIndex shouldn't happen, but propagate it anyway\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\n return {\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\n closestEdgeParam: edgeParam,\n };\n }\n /**\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\n * * Intersection data is returned for the line-plane intersection.\n * * No intersection is returned if the line is parallel to the plane.\n * * As for the *ray*, it intersects this triangle if and only if the returned detail `d` has\n * `d.isValid === true` and `d.a >= 0` and `d.isInsideOrOn === true`.\n * * This method is slower than `Ray3d.intersectionWithTriangle` but returns more information about the intersection.\n * @param ray infinite line to intersect, as a ray\n * @param result optional pre-allocated object to fill and return\n * @returns details `d` of the intersection point `p` of the line and the plane of this triangle:\n * * `d.isValid`: false if and only if `ray.direction` is parallel to the plane, or the ray or triangle is degenerate.\n * * `d.world`: coordinates of `p`.\n * * `d.local`: barycentric coordinates of `p`.\n * * `d.a`: the intersection parameter of `p` along the ray. Negative means `p` is behind the ray origin.\n * * `d.classify`: where `p` lies with respect to the triangle.\n * * `d.isInsideOrOn`: whether `p` is inside or on the triangle.\n * * `d.closestEdgeIndex`: the index of the triangle edge `e` onto which `p` projects.\n * * `d.closestEdgeParam`: the edge parameter at which `p` projects onto `e`.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\n * @see [[pointToFraction]]\n */\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n result = TriangleLocationDetail.create(result);\n /**\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\n * b1*u + b2*v - s*d = c\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\n */\n const r0 = ray.origin;\n const d = ray.direction;\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\n );\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\n );\n const scaledVolume = d.tripleProduct(u, v);\n if (scaledVolume * scaledVolume <= u.dotProduct(u) * v.dotProduct(v) * d.dotProduct(d) * Geometry.smallAngleRadiansSquared)\n return result; // parallel (no solution)\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\n if (undefined === M.multiplyInverse(c, solution))\n return result; // invalid\n result.a = -solution.z; // = -(-s) = s\n ray.fractionToPoint(result.a, result.world);\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\n result.closestEdgeIndex = proj.closestEdgeIndex;\n result.closestEdgeParam = proj.closestEdgeParam;\n return result;\n }\n /**\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\n * @param point0 start point of segment on line to intersect\n * @param point1 end point of segment on line to intersect\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the line-plane intersection point `d.world`:\n * * `d.isValid` returns true if and only if the line intersects the plane.\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\n * @see [[intersectRay3d]]\n */\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\n }\n /**\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\n * @param location details of a point in the plane of the triangle (note that `location.local` and\n * `location.world` possibly updated to lie on the triangle closest edge)\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\n * @return whether the location was adjusted\n */\n public snapLocationToEdge(\n location: TriangleLocationDetail,\n distanceTolerance: number = Geometry.smallMetricDistance,\n parameterTolerance: number = Geometry.smallFloatingPoint,\n ): boolean {\n if (!location.isValid)\n return false;\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\n if (parameterTolerance > 0.0) {\n let numSnapped = 0;\n let newSum = 0.0;\n for (let i = 0; i < 3; i++) {\n const barycentricDist = Math.abs(location.local.at(i));\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\n location.local.setAt(i, 0.0);\n numSnapped++;\n }\n newSum += location.local.at(i);\n }\n if (numSnapped > 0 && newSum > 0.0) {\n location.local.scaleInPlace(1.0 / newSum);\n if (1 === numSnapped) {\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\n );\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\n } else { // 2 snapped, at vertex\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\n location.local.x, location.local.y, location.local.z,\n );\n location.closestEdgeParam = 0.0;\n }\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\n return true;\n }\n }\n // failing that, try distance tol to closest edge projection\n if (distanceTolerance > 0.0) {\n const i = location.closestEdgeIndex;\n const j = (i + 1) % 3;\n const k = (j + 1) % 3;\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\n );\n const dist = location.world.distance(edgeProjection);\n if (dist > 0.0 && dist < distanceTolerance) {\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\n location.local.setAt(j, location.closestEdgeParam);\n location.local.setAt(k, 0.0);\n location.world.setFrom(edgeProjection);\n return true;\n }\n }\n return false;\n }\n /**\n * Return the dot product of the scaled normals of the two triangles.\n * * The sign of the return value is useful for determining the triangles' relative orientation:\n * positive (negative) means the normals point into the same (opposite) half-space determined by\n * one of the triangles' planes; zero means the triangles are perpendicular.\n */\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\n );\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\n );\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\n }\n /** Return the centroid of the 3 points. */\n public centroid(result?: Point3d): Point3d {\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\n return Point3d.create(\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\n result,\n );\n }\n /** Return the incenter of the triangle. */\n public incenter(result?: Point3d): Point3d {\n const a = this.edgeLength(0);\n const b = this.edgeLength(1);\n const c = this.edgeLength(2);\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\n }\n /** Return the circumcenter of the triangle. */\n public circumcenter(result?: Point3d): Point3d {\n const a2 = this.edgeLengthSquared(0);\n const b2 = this.edgeLengthSquared(1);\n const c2 = this.edgeLengthSquared(2);\n const x = a2 * (b2 + c2 - a2);\n const y = b2 * (c2 + a2 - b2);\n const z = c2 * (a2 + b2 - c2);\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\n }\n /** Test for point-by-point `isAlmostEqual` relationship. */\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\n return this.points[0].isAlmostEqual(other.points[0], tol)\n && this.points[1].isAlmostEqual(other.points[1], tol)\n && this.points[2].isAlmostEqual(other.points[2], tol);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IACjC,gDAAgD;IACzC,KAAK,CAAU;IACtB,4FAA4F;IACrF,KAAK,CAAU;IACtB,kCAAkC;IAC3B,CAAC,CAAS;IACjB,0EAA0E;IACnE,gBAAgB,CAAS;IAChC;;;;;OAKG;IACI,gBAAgB,CAAS;IAEhC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD,4DAA4D;IACrD,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,MAA+B;QAClD,IAAI,SAAS,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C,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF;AAziBD,kDAyiBC","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/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\n\r\nimport { Geometry, PolygonLocation } from \"../Geometry\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Carries data about a location in the plane of a triangle.\r\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\r\n * services on the latter.\r\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\r\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\r\n * if they lie within a distance or parametric tolerance.\r\n *\r\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\r\n * `T` with vertices `v0, v1, v2`:\r\n * * `1 = b0 + b1 + b2`\r\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\r\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\r\n * be written `P = b1 * U + b2 * V`.\r\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\r\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\r\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\r\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\r\n * NOT sum to 1, then `p` is not coplanar with `T`\r\n * @public\r\n */\r\nexport class TriangleLocationDetail {\r\n /** The Cartesian coordinates of the point p. */\r\n public world: Point3d;\r\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\r\n public local: Point3d;\r\n /** Application-specific number */\r\n public a: number;\r\n /** Index of the triangle vertex at the start of the closest edge to p. */\r\n public closestEdgeIndex: number;\r\n /**\r\n * The parameter f along the closest edge to p of its projection q.\r\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\r\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\r\n * * Note that 0 <= f <= 1.\r\n */\r\n public closestEdgeParam: number;\r\n\r\n private constructor() {\r\n this.world = new Point3d();\r\n this.local = new Point3d();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /** Invalidate this detail (set all attributes to zero) . */\r\n public invalidate() {\r\n this.world.setZero();\r\n this.local.setZero();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /**\r\n * Create an invalid detail.\r\n * @param result optional pre-allocated object to fill and return\r\n */\r\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\r\n if (undefined === result)\r\n result = new TriangleLocationDetail();\r\n else\r\n result.invalidate();\r\n return result;\r\n }\r\n /**\r\n * Set the instance contents from the `other` detail.\r\n * @param other detail to clone\r\n */\r\n public copyContentsFrom(other: TriangleLocationDetail) {\r\n this.world.setFrom(other.world);\r\n this.local.setFrom(other.local);\r\n this.a = other.a;\r\n this.closestEdgeIndex = other.closestEdgeIndex;\r\n this.closestEdgeParam = other.closestEdgeParam;\r\n }\r\n /** Whether this detail is invalid. */\r\n public get isValid(): boolean {\r\n return !this.local.isZero;\r\n }\r\n /**\r\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\r\n * on the triangle.\r\n * @see classify\r\n */\r\n public get isInsideOrOn(): boolean {\r\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\r\n }\r\n /**\r\n * Queries this detail to classify the location of this instance with respect to the triangle.\r\n * @returns location code\r\n * @see isInsideOrOn\r\n */\r\n public get classify(): PolygonLocation {\r\n if (!this.isValid)\r\n return PolygonLocation.Unknown;\r\n if (this.isInsideOrOn) {\r\n let numZero = 0;\r\n if (Math.abs(this.local.x) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.y) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.z) === 0.0)\r\n ++numZero;\r\n if (2 === numZero)\r\n return PolygonLocation.OnPolygonVertex;\r\n if (1 === numZero)\r\n return PolygonLocation.OnPolygonEdgeInterior;\r\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\r\n }\r\n return (this.closestEdgeParam === 0.0) ?\r\n PolygonLocation.OutsidePolygonProjectsToVertex :\r\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\r\n }\r\n}\r\n\r\n/**\r\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\r\n * @public\r\n */\r\nexport class BarycentricTriangle {\r\n /** Array of 3 point coordinates for the triangle. */\r\n public points: Point3d[];\r\n /** Edge length squared cache, indexed by opposite vertex index */\r\n protected edgeLength2: number[];\r\n // private attributes\r\n private static _workPoint?: Point3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workRay?: Ray3d;\r\n private static _workMatrix?: Matrix3d;\r\n /**\r\n * Constructor.\r\n * * Point references are CAPTURED\r\n */\r\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\r\n this.points = [];\r\n this.points.push(point0);\r\n this.points.push(point1);\r\n this.points.push(point2);\r\n this.edgeLength2 = [];\r\n this.edgeLength2.push(point1.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point1));\r\n }\r\n /**\r\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\r\n * is undefined.\r\n */\r\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\r\n this.points[0].setFromPoint3d(point0);\r\n this.points[1].setFromPoint3d(point1);\r\n this.points[2].setFromPoint3d(point2);\r\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\r\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\r\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\r\n }\r\n /** Copy all values from `other` */\r\n public setFrom(other: BarycentricTriangle) {\r\n for (let i = 0; i < 3; ++i) {\r\n this.points[i].setFromPoint3d(other.points[i]);\r\n this.edgeLength2[i] = other.edgeLength2[i];\r\n }\r\n }\r\n /**\r\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\r\n * @param result optional pre-allocated triangle.\r\n */\r\n public static createXYZXYZXYZ(\r\n x0: number, y0: number, z0: number,\r\n x1: number, y1: number, z1: number,\r\n x2: number, y2: number, z2: number,\r\n result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\r\n result.points[0].set(x0, y0, z0);\r\n result.points[1].set(x1, y1, z1);\r\n result.points[2].set(x2, y2, z2);\r\n return result;\r\n }\r\n /** Create a triangle with coordinates cloned from given points. */\r\n public static create(\r\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(point0.clone(), point1.clone(), point2.clone());\r\n result.set(point0, point1, point2);\r\n return result;\r\n }\r\n /** Return a new `BarycentricTriangle` with the same coordinates. */\r\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(\r\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\r\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\r\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\r\n result,\r\n );\r\n }\r\n /** Return the area of the triangle. */\r\n public get area(): number {\r\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\r\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\r\n }\r\n /**\r\n * Compute squared length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLengthSquared(oppositeVertexIndex: number): number {\r\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\r\n }\r\n /**\r\n * Compute length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLength(oppositeVertexIndex: number): number {\r\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\r\n }\r\n /** Return area divided by sum of squared lengths. */\r\n public get aspectRatio(): number {\r\n return Geometry.safeDivideFraction(\r\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\r\n );\r\n }\r\n /** Return the perimeter of the triangle. */\r\n public get perimeter(): number {\r\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\r\n }\r\n /**\r\n * Return the unit normal of the triangle.\r\n * @param result optional pre-allocated vector to fill and return.\r\n * @returns unit normal, or undefined if cross product length is too small.\r\n */\r\n public normal(result?: Vector3d): Vector3d | undefined {\r\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\r\n if (cross.tryNormalizeInPlace())\r\n return cross;\r\n return undefined;\r\n }\r\n /**\r\n * Sum the triangle points with given scales.\r\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\r\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\r\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\r\n * @param b0 scale to apply to vertex 0\r\n * @param b1 scale to apply to vertex 1\r\n * @param b2 scale to apply to vertex 2\r\n * @param result optional pre-allocated point to fill and return\r\n * @return linear combination of the vertices of this triangle\r\n * @see [[pointToFraction]]\r\n */\r\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\r\n // p = b0 * v0 + b1 * v1 + b2 * v2\r\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\r\n }\r\n /**\r\n * Compute the projection of the given `point` onto the plane of this triangle.\r\n * @param point point p to project\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the projection point `P = d.world`:\r\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\r\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\r\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\r\n * @see [[fractionToPoint]]\r\n */\r\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\r\n if (undefined === normal)\r\n return TriangleLocationDetail.create(result);\r\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\r\n }\r\n /** Convert from opposite-vertex to start-vertex edge indexing. */\r\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\r\n return Geometry.cyclic3dAxis(edgeIndex + 1);\r\n }\r\n /** Convert from start-vertex to opposite-vertex edge indexing. */\r\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\r\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\r\n */\r\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 > 0 && b1 > 0 && b2 > 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\r\n */\r\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\r\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\r\n return 0;\r\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\r\n return 1;\r\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\r\n if (b1 < 0 && b2 < 0)\r\n return 0;\r\n if (b0 < 0 && b2 < 0)\r\n return 1;\r\n if (b0 < 0 && b1 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\r\n */\r\n private static isOnVertex(b0: number, b1: number, b2: number): number {\r\n if (b0 === 1 && b1 === 0 && b2 === 0)\r\n return 0;\r\n if (b0 === 0 && b1 === 1 && b2 === 0)\r\n return 1;\r\n if (b0 === 0 && b1 === 0 && b2 === 1)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\r\n */\r\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\r\n if (b0 === 0 && b1 > 0 && b2 > 0)\r\n return 0;\r\n if (b0 > 0 && b1 === 0 && b2 > 0)\r\n return 1;\r\n if (b0 > 0 && b1 > 0 && b2 === 0)\r\n return 2;\r\n return -1;\r\n }\r\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\r\n private static indexOfMinimum(fn: (index: number) => number): number {\r\n let i = 0;\r\n let min = fn(0);\r\n const val = fn(1);\r\n if (min > val) {\r\n i = 1;\r\n min = val;\r\n }\r\n if (min > fn(2))\r\n i = 2;\r\n return i;\r\n }\r\n /**\r\n * Compute the squared distance between two points given by their barycentric coordinates.\r\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\r\n */\r\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\r\n // The barycentric displacement vector distance formula\r\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\r\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\r\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\r\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\r\n }\r\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\r\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\r\n return BarycentricTriangle.indexOfMinimum((i: number) => {\r\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\r\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\r\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\r\n });\r\n }\r\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\r\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\r\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n const k = Geometry.cyclic3dAxis(j + 1);\r\n return Geometry.dotProductXYZXYZ(\r\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\r\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\r\n );\r\n }\r\n /**\r\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\r\n * @param k vertex v_k is opposite the edge e_k\r\n * @param b barycentric coordinates of point to project\r\n * @returns parameter f along e_k, such that:\r\n * * the projection point is q = v_i + f * (v_j - v_i)\r\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\r\n */\r\n private computeProjectionToEdge(k: number, b: number[]): number {\r\n /**\r\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\r\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\r\n * First we prove P = b_jU + b_kV.\r\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\r\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\r\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + v_i - v_i\r\n * = (b_j * U) + (b_k * V)\r\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\r\n * Therefore, 0 = (p - q).(v_j - v_i)\r\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\r\n * = (b_jU + b_kV - fU).U\r\n * = b_jU.U + b_kU.V - fU.U\r\n * Thus f = b_j + b_k(U.V/U.U)\r\n */\r\n k = Geometry.cyclic3dAxis(k);\r\n const i = Geometry.cyclic3dAxis(k + 1);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\r\n }\r\n /**\r\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\r\n * @param b0 barycentric coordinate of p corresponding to v_0\r\n * @param b1 barycentric coordinate of p corresponding to v_1\r\n * @param b2 barycentric coordinate of p corresponding to v_2\r\n * @returns closest edge start vertex index i and projection parameter f such that the projection\r\n * q = v_i + f * (v_j - v_i).\r\n */\r\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\r\n const b: number[] = [b0, b1, b2];\r\n let edgeIndex = -1; // opposite-vertex index\r\n let edgeParam = 0.0;\r\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\r\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\r\n // We want smallest projection distance d_i of p to e_i.\r\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\r\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\r\n });\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\r\n }\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0) {\r\n edgeParam = 0.0; // start of this edge\r\n } else if (edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\r\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\r\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\r\n }\r\n // invalid edgeIndex shouldn't happen, but propagate it anyway\r\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\r\n return {\r\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\r\n closestEdgeParam: edgeParam,\r\n };\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\r\n * * Intersection data is returned for the line-plane intersection.\r\n * * No intersection is returned if the line is parallel to the plane.\r\n * * As for the *ray*, it intersects this triangle if and only if the returned detail `d` has\r\n * `d.isValid === true` and `d.a >= 0` and `d.isInsideOrOn === true`.\r\n * * This method is slower than `Ray3d.intersectionWithTriangle` but returns more information about the intersection.\r\n * @param ray infinite line to intersect, as a ray\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details `d` of the intersection point `p` of the line and the plane of this triangle:\r\n * * `d.isValid`: false if and only if `ray.direction` is parallel to the plane, or the ray or triangle is degenerate.\r\n * * `d.world`: coordinates of `p`.\r\n * * `d.local`: barycentric coordinates of `p`.\r\n * * `d.a`: the intersection parameter of `p` along the ray. Negative means `p` is behind the ray origin.\r\n * * `d.classify`: where `p` lies with respect to the triangle.\r\n * * `d.isInsideOrOn`: whether `p` is inside or on the triangle.\r\n * * `d.closestEdgeIndex`: the index of the triangle edge `e` onto which `p` projects.\r\n * * `d.closestEdgeParam`: the edge parameter at which `p` projects onto `e`.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\r\n * @see [[pointToFraction]]\r\n */\r\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n result = TriangleLocationDetail.create(result);\r\n /**\r\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\r\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\r\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\r\n * b1*u + b2*v - s*d = c\r\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\r\n */\r\n const r0 = ray.origin;\r\n const d = ray.direction;\r\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\r\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\r\n );\r\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\r\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\r\n );\r\n const scaledVolume = d.tripleProduct(u, v);\r\n if (scaledVolume * scaledVolume <= u.dotProduct(u) * v.dotProduct(v) * d.dotProduct(d) * Geometry.smallAngleRadiansSquared)\r\n return result; // parallel (no solution)\r\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\r\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\r\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\r\n if (undefined === M.multiplyInverse(c, solution))\r\n return result; // invalid\r\n result.a = -solution.z; // = -(-s) = s\r\n ray.fractionToPoint(result.a, result.world);\r\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\r\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\r\n result.closestEdgeIndex = proj.closestEdgeIndex;\r\n result.closestEdgeParam = proj.closestEdgeParam;\r\n return result;\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\r\n * @param point0 start point of segment on line to intersect\r\n * @param point1 end point of segment on line to intersect\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection point `d.world`:\r\n * * `d.isValid` returns true if and only if the line intersects the plane.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\r\n * @see [[intersectRay3d]]\r\n */\r\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\r\n }\r\n /**\r\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\r\n * @param location details of a point in the plane of the triangle (note that `location.local` and\r\n * `location.world` possibly updated to lie on the triangle closest edge)\r\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\r\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\r\n * @return whether the location was adjusted\r\n */\r\n public snapLocationToEdge(\r\n location: TriangleLocationDetail,\r\n distanceTolerance: number = Geometry.smallMetricDistance,\r\n parameterTolerance: number = Geometry.smallFloatingPoint,\r\n ): boolean {\r\n if (!location.isValid)\r\n return false;\r\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\r\n if (parameterTolerance > 0.0) {\r\n let numSnapped = 0;\r\n let newSum = 0.0;\r\n for (let i = 0; i < 3; i++) {\r\n const barycentricDist = Math.abs(location.local.at(i));\r\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\r\n location.local.setAt(i, 0.0);\r\n numSnapped++;\r\n }\r\n newSum += location.local.at(i);\r\n }\r\n if (numSnapped > 0 && newSum > 0.0) {\r\n location.local.scaleInPlace(1.0 / newSum);\r\n if (1 === numSnapped) {\r\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\r\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\r\n );\r\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\r\n } else { // 2 snapped, at vertex\r\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\r\n location.local.x, location.local.y, location.local.z,\r\n );\r\n location.closestEdgeParam = 0.0;\r\n }\r\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\r\n return true;\r\n }\r\n }\r\n // failing that, try distance tol to closest edge projection\r\n if (distanceTolerance > 0.0) {\r\n const i = location.closestEdgeIndex;\r\n const j = (i + 1) % 3;\r\n const k = (j + 1) % 3;\r\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\r\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\r\n );\r\n const dist = location.world.distance(edgeProjection);\r\n if (dist > 0.0 && dist < distanceTolerance) {\r\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\r\n location.local.setAt(j, location.closestEdgeParam);\r\n location.local.setAt(k, 0.0);\r\n location.world.setFrom(edgeProjection);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return the dot product of the scaled normals of the two triangles.\r\n * * The sign of the return value is useful for determining the triangles' relative orientation:\r\n * positive (negative) means the normals point into the same (opposite) half-space determined by\r\n * one of the triangles' planes; zero means the triangles are perpendicular.\r\n */\r\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\r\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\r\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\r\n );\r\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\r\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\r\n );\r\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\r\n }\r\n /** Return the centroid of the 3 points. */\r\n public centroid(result?: Point3d): Point3d {\r\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\r\n return Point3d.create(\r\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\r\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\r\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\r\n result,\r\n );\r\n }\r\n /** Return the incenter of the triangle. */\r\n public incenter(result?: Point3d): Point3d {\r\n const a = this.edgeLength(0);\r\n const b = this.edgeLength(1);\r\n const c = this.edgeLength(2);\r\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\r\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\r\n }\r\n /** Return the circumcenter of the triangle. */\r\n public circumcenter(result?: Point3d): Point3d {\r\n const a2 = this.edgeLengthSquared(0);\r\n const b2 = this.edgeLengthSquared(1);\r\n const c2 = this.edgeLengthSquared(2);\r\n const x = a2 * (b2 + c2 - a2);\r\n const y = b2 * (c2 + a2 - b2);\r\n const z = c2 * (a2 + b2 - c2);\r\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\r\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\r\n }\r\n /** Test for point-by-point `isAlmostEqual` relationship. */\r\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\r\n return this.points[0].isAlmostEqual(other.points[0], tol)\r\n && this.points[1].isAlmostEqual(other.points[1], tol)\r\n && this.points[2].isAlmostEqual(other.points[2], tol);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BilinearPatch.js","sourceRoot":"","sources":["../../../src/geometry3d/BilinearPatch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,4EAA0G;AAC1G,sEAAmE;AACnE,0CAAuC;AACvC,yDAAsD;AAEtD,2EAAwE;AACxE,uDAA4C;AAK5C,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,aAAa;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB;;;;;;OAMG;IACH,YAAmB,OAAgB,EAAE,OAAgB,EAAE,OAAgB,EAAE,OAAgB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAAgB,EAAE,OAAgB,EAAE,OAAgB,EAAE,OAAgB;QACzF,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,KA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AAI,CAAC,IAAI,qDAA6B,CAC3C,yCAAmB,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EACzD,+CAAuB,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAC/D,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,mBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,mBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;CACF;AAlMD,sCAkMC","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 Solid\n */\n\nimport { CurveAndSurfaceLocationDetail, UVSurfaceLocationDetail } from \"../bspline/SurfaceLocationDetail\";\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\nimport { Geometry } from \"../Geometry\";\nimport { SmallSystem } from \"../numerics/SmallSystem\";\nimport { UVSurface } from \"./GeometryHandler\";\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\nimport { Point3d } from \"./Point3dVector3d\";\nimport { Range3d } from \"./Range\";\nimport { Ray3d } from \"./Ray3d\";\nimport { Transform } from \"./Transform\";\n\n// cspell:word uparrow, rightarrow\n\n/**\n * A bilinear patch is a surface defined by its 4 corner points.\n * * The corner points do not have to be coplanar, but if they are, the quadrilateral should be convex to avoid a self-intersecting surface.\n * ```\n * equation\n * \\begin{matrix}\n * v\\text{-direction}\\\\\n * \\uparrow\\\\\n * \\text{point01} &\\cdots &\\text{A1} &\\cdots &\\text{point11}\\\\\n * \\vdots &&\\vdots &&\\vdots\\\\\n * \\text{B0} &\\cdots &\\text{X} &\\cdots &\\text{B1}\\\\\n * \\vdots &&\\vdots &&\\vdots\\\\\n * \\text{point00} &\\cdots &\\text{A0} &\\cdots &\\text{point10} &\\rightarrow~u\\text{-direction}\n * \\end{matrix}\n * ```\n * * To evaluate the point at (u,v), the following are equivalent:\n * * interpolate first with u then with v:\n * * A0 = interpolate between point00 and point10 at fraction u\n * * A1 = interpolate between point01 and point11 at fraction u\n * * X = interpolate between A0 and A1 at fraction v\n * * interpolate first with v then with u:\n * * B0 = interpolate between point00 and point01 at fraction v\n * * B1 = interpolate between point10 and point11 at fraction v\n * * X = interpolate between B0 and B1 at fraction u\n * * sum all at once:\n * * X = (1-u)(1-v)point00 + (1-u)(v)point01 + (u)(1-v)point10 + (u)(v)point11\n * @public\n */\nexport class BilinearPatch implements UVSurface {\n /** corner at parametric coordinate (0,0) */\n public point00: Point3d;\n /** corner at parametric coordinate (1,0) */\n public point10: Point3d;\n /** corner at parametric coordinate (0,1) */\n public point01: Point3d;\n /** corner at parametric coordinate (1,1) */\n public point11: Point3d;\n /**\n * Capture (not clone) corners to create a new BilinearPatch.\n * @param point00 Point at uv=0,0\n * @param point10 Point at uv=1,0\n * @param point10 Point at uv=0,1\n * @param point11 Point at uv=1,1\n */\n public constructor(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\n this.point00 = point00;\n this.point10 = point10;\n this.point01 = point01;\n this.point11 = point11;\n }\n /**\n * Clone (not capture) corners to create a new BilinearPatch.\n * @param point00 Point at uv=0,0\n * @param point10 Point at uv=1,0\n * @param point10 Point at uv=0,1\n * @param point11 Point at uv=1,1\n */\n public static create(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\n return new BilinearPatch(point00.clone(), point10.clone(), point01.clone(), point11.clone());\n }\n /** Create a patch from xyz values of the 4 corners. */\n public static createXYZ(\n x00: number, y00: number, z00: number,\n x10: number, y10: number, z10: number,\n x01: number, y01: number, z01: number,\n x11: number, y11: number, z11: number,\n ) {\n return new BilinearPatch(\n Point3d.create(x00, y00, z00),\n Point3d.create(x10, y10, z10),\n Point3d.create(x01, y01, z01),\n Point3d.create(x11, y11, z11),\n );\n }\n /** Return a cloned patch. */\n public clone(): BilinearPatch {\n return new BilinearPatch(\n this.point00.clone(),\n this.point10.clone(),\n this.point01.clone(),\n this.point11.clone(),\n );\n }\n /** Test equality of the 4 points. */\n public isAlmostEqual(other: BilinearPatch): boolean {\n return this.point00.isAlmostEqual(other.point00)\n && this.point10.isAlmostEqual(other.point10)\n && this.point01.isAlmostEqual(other.point01)\n && this.point11.isAlmostEqual(other.point11);\n }\n /** Apply the transform to each point. */\n public tryTransformInPlace(transform: Transform): boolean {\n transform.multiplyPoint3d(this.point00, this.point00);\n transform.multiplyPoint3d(this.point10, this.point10);\n transform.multiplyPoint3d(this.point01, this.point01);\n transform.multiplyPoint3d(this.point11, this.point11);\n return true;\n }\n /** Return a cloned and transformed patch. */\n public cloneTransformed(transform: Transform): BilinearPatch | undefined {\n const result = this.clone();\n result.tryTransformInPlace(transform);\n return result;\n }\n /** Extend a range by the range of the (optionally transformed) patch. */\n public extendRange(range: Range3d, transform?: Transform) {\n if (transform) {\n range.extendTransformedPoint(transform, this.point00);\n range.extendTransformedPoint(transform, this.point10);\n range.extendTransformedPoint(transform, this.point01);\n range.extendTransformedPoint(transform, this.point11);\n } else {\n range.extendPoint(this.point00);\n range.extendPoint(this.point10);\n range.extendPoint(this.point01);\n range.extendPoint(this.point11);\n }\n }\n /**\n * Convert fractional u and v coordinates to surface point\n * @param u fractional coordinate in u direction\n * @param v fractional coordinate in v direction\n * @param result optional pre-allocated point\n */\n public uvFractionToPoint(u: number, v: number, result?: Point3d): Point3d {\n const f00 = (1.0 - u) * (1.0 - v);\n const f10 = u * (1.0 - v);\n const f01 = (1.0 - u) * v;\n const f11 = u * v;\n return Point3d.create(\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\n result,\n );\n }\n /** Evaluate as a uv surface, returning point and two derivative vectors.\n * @param u fractional coordinate in u direction\n * @param v fractional coordinate in v direction\n * @param result optional pre-allocated carrier for point and vectors\n */\n public uvFractionToPointAndTangents(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const u0 = 1.0 - u;\n const v0 = 1.0 - v;\n const f00 = u0 * v0;\n const f10 = u * v0;\n const f01 = u0 * v;\n const f11 = u * v;\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\n // u derivative ..\n v0 * (this.point10.x - this.point00.x) + v * (this.point11.x - this.point01.x),\n v0 * (this.point10.y - this.point00.y) + v * (this.point11.y - this.point01.y),\n v0 * (this.point10.z - this.point00.z) + v * (this.point11.z - this.point01.z),\n // v derivative ..\n u0 * (this.point01.x - this.point00.x) + u * (this.point11.x - this.point10.x),\n u0 * (this.point01.y - this.point00.y) + u * (this.point11.y - this.point10.y),\n u0 * (this.point01.z - this.point00.z) + u * (this.point11.z - this.point10.z),\n result,\n );\n }\n /** If data[iB][pivotColumn] is larger in absolute value than data[iA][pivotColumn], then swap rows iA and iB. */\n private static conditionalPivot(pivotColumn: number, data: Float64Array[], iA: number, iB: number) {\n if (Math.abs(data[iB][pivotColumn]) > Math.abs(data[iA][pivotColumn])) {\n const q = data[iA];\n data[iA] = data[iB];\n data[iB] = q;\n }\n }\n /**\n * Compute the points of intersection with a ray.\n * @param ray ray in space\n * @returns 1 or 2 points if there are intersections, undefined if no intersections\n */\n public intersectRay(ray: Ray3d): CurveAndSurfaceLocationDetail[] | undefined {\n const vectorU = this.point10.minus(this.point00);\n const vectorV = this.point01.minus(this.point00);\n const vectorW = this.point11.minus(this.point10);\n vectorW.subtractInPlace(vectorV);\n // We seek t, u, v such that:\n // `ray.origin + t*ray.direction = point00 + u*vectorU + v*vectorV + u*v*vectorW`\n // For typical direction as x, the scalar equation with coefficient order for arrays is:\n // `0 = -t*ray.direction.x + (point00.x - ray.origin.x) + u*vectorU.x + v*vectorV.x + u*v*vectorW.x`\n // and this particular equation is invoked to compute t when u and v are known.\n const coffs = [\n new Float64Array([-ray.direction.x, this.point00.x - ray.origin.x, vectorU.x, vectorV.x, vectorW.x]),\n new Float64Array([-ray.direction.y, this.point00.y - ray.origin.y, vectorU.y, vectorV.y, vectorW.y]),\n new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z]),\n ];\n // swap rows so that the equation with largest ray.direction coefficient is first.\n BilinearPatch.conditionalPivot(0, coffs, 0, 1);\n BilinearPatch.conditionalPivot(0, coffs, 0, 2);\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[1], -1.0);\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[2], -1.0);\n const uvArray = SmallSystem.solveBilinearPair(\n coffs[1][1], coffs[1][2], coffs[1][3], coffs[1][4],\n coffs[2][1], coffs[2][2], coffs[2][3], coffs[2][4],\n );\n if (uvArray) {\n const result: CurveAndSurfaceLocationDetail[] = [];\n for (const uv of uvArray) {\n const t = -(coffs[0][1] + coffs[0][2] * uv.x + (coffs[0][3] + coffs[0][4] * uv.x) * uv.y) / coffs[0][0];\n const point = ray.fractionToPoint(t);\n result.push(new CurveAndSurfaceLocationDetail(\n CurveLocationDetail.createRayFractionPoint(ray, t, point),\n UVSurfaceLocationDetail.createSurfaceUVPoint(this, uv, point)),\n );\n }\n return result;\n }\n return undefined;\n }\n /** Returns the larger of the u-direction edge lengths at v=0 and v=1. */\n public maxUEdgeLength(): number {\n return Geometry.maxXY(this.point00.distance(this.point10), this.point01.distance(this.point11));\n }\n /** Returns the larger of the v-direction edge lengths at u=0 and u=1. */\n public maxVEdgeLength(): number {\n return Geometry.maxXY(this.point00.distance(this.point01), this.point10.distance(this.point11));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BilinearPatch.js","sourceRoot":"","sources":["../../../src/geometry3d/BilinearPatch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,4EAA0G;AAC1G,sEAAmE;AACnE,0CAAuC;AACvC,yDAAsD;AAEtD,2EAAwE;AACxE,uDAA4C;AAK5C,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,aAAa;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB,4CAA4C;IACrC,OAAO,CAAU;IACxB;;;;;;OAMG;IACH,YAAmB,OAAgB,EAAE,OAAgB,EAAE,OAAgB,EAAE,OAAgB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAAgB,EAAE,OAAgB,EAAE,OAAgB,EAAE,OAAgB;QACzF,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE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,eAAe,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,IAAI,qDAA6B,CAC3C,yCAAmB,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EACzD,+CAAuB,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAC/D,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,mBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,mBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;CACF;AAlMD,sCAkMC","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 Solid\r\n */\r\n\r\nimport { CurveAndSurfaceLocationDetail, UVSurfaceLocationDetail } from \"../bspline/SurfaceLocationDetail\";\r\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/SmallSystem\";\r\nimport { UVSurface } from \"./GeometryHandler\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n// cspell:word uparrow, rightarrow\r\n\r\n/**\r\n * A bilinear patch is a surface defined by its 4 corner points.\r\n * * The corner points do not have to be coplanar, but if they are, the quadrilateral should be convex to avoid a self-intersecting surface.\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * v\\text{-direction}\\\\\r\n * \\uparrow\\\\\r\n * \\text{point01} &\\cdots &\\text{A1} &\\cdots &\\text{point11}\\\\\r\n * \\vdots &&\\vdots &&\\vdots\\\\\r\n * \\text{B0} &\\cdots &\\text{X} &\\cdots &\\text{B1}\\\\\r\n * \\vdots &&\\vdots &&\\vdots\\\\\r\n * \\text{point00} &\\cdots &\\text{A0} &\\cdots &\\text{point10} &\\rightarrow~u\\text{-direction}\r\n * \\end{matrix}\r\n * ```\r\n * * To evaluate the point at (u,v), the following are equivalent:\r\n * * interpolate first with u then with v:\r\n * * A0 = interpolate between point00 and point10 at fraction u\r\n * * A1 = interpolate between point01 and point11 at fraction u\r\n * * X = interpolate between A0 and A1 at fraction v\r\n * * interpolate first with v then with u:\r\n * * B0 = interpolate between point00 and point01 at fraction v\r\n * * B1 = interpolate between point10 and point11 at fraction v\r\n * * X = interpolate between B0 and B1 at fraction u\r\n * * sum all at once:\r\n * * X = (1-u)(1-v)point00 + (1-u)(v)point01 + (u)(1-v)point10 + (u)(v)point11\r\n * @public\r\n */\r\nexport class BilinearPatch implements UVSurface {\r\n /** corner at parametric coordinate (0,0) */\r\n public point00: Point3d;\r\n /** corner at parametric coordinate (1,0) */\r\n public point10: Point3d;\r\n /** corner at parametric coordinate (0,1) */\r\n public point01: Point3d;\r\n /** corner at parametric coordinate (1,1) */\r\n public point11: Point3d;\r\n /**\r\n * Capture (not clone) corners to create a new BilinearPatch.\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=1,1\r\n */\r\n public constructor(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n this.point00 = point00;\r\n this.point10 = point10;\r\n this.point01 = point01;\r\n this.point11 = point11;\r\n }\r\n /**\r\n * Clone (not capture) corners to create a new BilinearPatch.\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=1,1\r\n */\r\n public static create(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n return new BilinearPatch(point00.clone(), point10.clone(), point01.clone(), point11.clone());\r\n }\r\n /** Create a patch from xyz values of the 4 corners. */\r\n public static createXYZ(\r\n x00: number, y00: number, z00: number,\r\n x10: number, y10: number, z10: number,\r\n x01: number, y01: number, z01: number,\r\n x11: number, y11: number, z11: number,\r\n ) {\r\n return new BilinearPatch(\r\n Point3d.create(x00, y00, z00),\r\n Point3d.create(x10, y10, z10),\r\n Point3d.create(x01, y01, z01),\r\n Point3d.create(x11, y11, z11),\r\n );\r\n }\r\n /** Return a cloned patch. */\r\n public clone(): BilinearPatch {\r\n return new BilinearPatch(\r\n this.point00.clone(),\r\n this.point10.clone(),\r\n this.point01.clone(),\r\n this.point11.clone(),\r\n );\r\n }\r\n /** Test equality of the 4 points. */\r\n public isAlmostEqual(other: BilinearPatch): boolean {\r\n return this.point00.isAlmostEqual(other.point00)\r\n && this.point10.isAlmostEqual(other.point10)\r\n && this.point01.isAlmostEqual(other.point01)\r\n && this.point11.isAlmostEqual(other.point11);\r\n }\r\n /** Apply the transform to each point. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n transform.multiplyPoint3d(this.point00, this.point00);\r\n transform.multiplyPoint3d(this.point10, this.point10);\r\n transform.multiplyPoint3d(this.point01, this.point01);\r\n transform.multiplyPoint3d(this.point11, this.point11);\r\n return true;\r\n }\r\n /** Return a cloned and transformed patch. */\r\n public cloneTransformed(transform: Transform): BilinearPatch | undefined {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Extend a range by the range of the (optionally transformed) patch. */\r\n public extendRange(range: Range3d, transform?: Transform) {\r\n if (transform) {\r\n range.extendTransformedPoint(transform, this.point00);\r\n range.extendTransformedPoint(transform, this.point10);\r\n range.extendTransformedPoint(transform, this.point01);\r\n range.extendTransformedPoint(transform, this.point11);\r\n } else {\r\n range.extendPoint(this.point00);\r\n range.extendPoint(this.point10);\r\n range.extendPoint(this.point01);\r\n range.extendPoint(this.point11);\r\n }\r\n }\r\n /**\r\n * Convert fractional u and v coordinates to surface point\r\n * @param u fractional coordinate in u direction\r\n * @param v fractional coordinate in v direction\r\n * @param result optional pre-allocated point\r\n */\r\n public uvFractionToPoint(u: number, v: number, result?: Point3d): Point3d {\r\n const f00 = (1.0 - u) * (1.0 - v);\r\n const f10 = u * (1.0 - v);\r\n const f01 = (1.0 - u) * v;\r\n const f11 = u * v;\r\n return Point3d.create(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n result,\r\n );\r\n }\r\n /** Evaluate as a uv surface, returning point and two derivative vectors.\r\n * @param u fractional coordinate in u direction\r\n * @param v fractional coordinate in v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n public uvFractionToPointAndTangents(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const u0 = 1.0 - u;\r\n const v0 = 1.0 - v;\r\n const f00 = u0 * v0;\r\n const f10 = u * v0;\r\n const f01 = u0 * v;\r\n const f11 = u * v;\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n // u derivative ..\r\n v0 * (this.point10.x - this.point00.x) + v * (this.point11.x - this.point01.x),\r\n v0 * (this.point10.y - this.point00.y) + v * (this.point11.y - this.point01.y),\r\n v0 * (this.point10.z - this.point00.z) + v * (this.point11.z - this.point01.z),\r\n // v derivative ..\r\n u0 * (this.point01.x - this.point00.x) + u * (this.point11.x - this.point10.x),\r\n u0 * (this.point01.y - this.point00.y) + u * (this.point11.y - this.point10.y),\r\n u0 * (this.point01.z - this.point00.z) + u * (this.point11.z - this.point10.z),\r\n result,\r\n );\r\n }\r\n /** If data[iB][pivotColumn] is larger in absolute value than data[iA][pivotColumn], then swap rows iA and iB. */\r\n private static conditionalPivot(pivotColumn: number, data: Float64Array[], iA: number, iB: number) {\r\n if (Math.abs(data[iB][pivotColumn]) > Math.abs(data[iA][pivotColumn])) {\r\n const q = data[iA];\r\n data[iA] = data[iB];\r\n data[iB] = q;\r\n }\r\n }\r\n /**\r\n * Compute the points of intersection with a ray.\r\n * @param ray ray in space\r\n * @returns 1 or 2 points if there are intersections, undefined if no intersections\r\n */\r\n public intersectRay(ray: Ray3d): CurveAndSurfaceLocationDetail[] | undefined {\r\n const vectorU = this.point10.minus(this.point00);\r\n const vectorV = this.point01.minus(this.point00);\r\n const vectorW = this.point11.minus(this.point10);\r\n vectorW.subtractInPlace(vectorV);\r\n // We seek t, u, v such that:\r\n // `ray.origin + t*ray.direction = point00 + u*vectorU + v*vectorV + u*v*vectorW`\r\n // For typical direction as x, the scalar equation with coefficient order for arrays is:\r\n // `0 = -t*ray.direction.x + (point00.x - ray.origin.x) + u*vectorU.x + v*vectorV.x + u*v*vectorW.x`\r\n // and this particular equation is invoked to compute t when u and v are known.\r\n const coffs = [\r\n new Float64Array([-ray.direction.x, this.point00.x - ray.origin.x, vectorU.x, vectorV.x, vectorW.x]),\r\n new Float64Array([-ray.direction.y, this.point00.y - ray.origin.y, vectorU.y, vectorV.y, vectorW.y]),\r\n new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z]),\r\n ];\r\n // swap rows so that the equation with largest ray.direction coefficient is first.\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 1);\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 2);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[1], -1.0);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[2], -1.0);\r\n const uvArray = SmallSystem.solveBilinearPair(\r\n coffs[1][1], coffs[1][2], coffs[1][3], coffs[1][4],\r\n coffs[2][1], coffs[2][2], coffs[2][3], coffs[2][4],\r\n );\r\n if (uvArray) {\r\n const result: CurveAndSurfaceLocationDetail[] = [];\r\n for (const uv of uvArray) {\r\n const t = -(coffs[0][1] + coffs[0][2] * uv.x + (coffs[0][3] + coffs[0][4] * uv.x) * uv.y) / coffs[0][0];\r\n const point = ray.fractionToPoint(t);\r\n result.push(new CurveAndSurfaceLocationDetail(\r\n CurveLocationDetail.createRayFractionPoint(ray, t, point),\r\n UVSurfaceLocationDetail.createSurfaceUVPoint(this, uv, point)),\r\n );\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /** Returns the larger of the u-direction edge lengths at v=0 and v=1. */\r\n public maxUEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point10), this.point01.distance(this.point11));\r\n }\r\n /** Returns the larger of the v-direction edge lengths at u=0 and u=1. */\r\n public maxVEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point01), this.point10.distance(this.point11));\r\n }\r\n}\r\n"]}
|