MSAGL Support
Added new tech tree layout implementation using Microsoft Automatic Graph Layouts Added some functionality to the database editor tools
This commit is contained in:
parent
d1492eb04c
commit
01a956eef6
1110 changed files with 119054 additions and 151 deletions
616
.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
generated
616
.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
generated
|
|
@ -409,6 +409,620 @@
|
|||
<e p="Vertex2.cs" t="Include" />
|
||||
<e p="Vertex3.cs" t="Include" />
|
||||
</e>
|
||||
<e p="MSAGL" t="Include">
|
||||
<e p="Core" t="Include">
|
||||
<e p="AlgorithmBase.cs" t="Include" />
|
||||
<e p="CancelToken.cs" t="Include" />
|
||||
<e p="DataStructures" t="Include">
|
||||
<e p="BinaryHeapPriorityQueue.cs" t="Include" />
|
||||
<e p="BinaryHeapWithComparer.cs" t="Include" />
|
||||
<e p="CollectionUtilities.cs" t="Include" />
|
||||
<e p="GenericBinaryHeapPriorityQueue.cs" t="Include" />
|
||||
<e p="GenericBinaryHeapPriorityQueueWithTimestamp.cs" t="Include" />
|
||||
<e p="GenericHeapElement.cs" t="Include" />
|
||||
<e p="GenericHeapElementWithTimestamp.cs" t="Include" />
|
||||
<e p="RBTree" t="Include">
|
||||
<e p="ComparerOnDelegate.cs" t="Include" />
|
||||
<e p="DefaultComperer.cs" t="Include" />
|
||||
<e p="RBColor.cs" t="Include" />
|
||||
<e p="RBNode.cs" t="Include" />
|
||||
<e p="RBTree.cs" t="Include" />
|
||||
<e p="RBTreeEnumerator.cs" t="Include" />
|
||||
</e>
|
||||
<e p="RealNumberSpan.cs" t="Include" />
|
||||
<e p="Set.cs" t="Include" />
|
||||
<e p="Size.cs" t="Include" />
|
||||
<e p="SymmetricTuple.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Geometry" t="Include">
|
||||
<e p="ApproximateComparer.cs" t="Include" />
|
||||
<e p="CompassVector.cs" t="Include" />
|
||||
<e p="ConvexHull" t="Include">
|
||||
<e p="ConvexHull.cs" t="Include" />
|
||||
<e p="HullPoint.cs" t="Include" />
|
||||
<e p="HullPointComparer.cs" t="Include" />
|
||||
<e p="HullStack.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Curves" t="Include">
|
||||
<e p="ClosestPointOnCurve.cs" t="Include" />
|
||||
<e p="CubicBezierSegment.cs" t="Include" />
|
||||
<e p="CurvatureDerivative.cs" t="Include" />
|
||||
<e p="Curve.cs" t="Include" />
|
||||
<e p="CurveFactory.cs" t="Include" />
|
||||
<e p="CurveLengthAndParams.cs" t="Include" />
|
||||
<e p="CurveTangent.cs" t="Include" />
|
||||
<e p="Ellipse.cs" t="Include" />
|
||||
<e p="ICurve.cs" t="Include" />
|
||||
<e p="IFunction.cs" t="Include" />
|
||||
<e p="IntersectionInfo.cs" t="Include" />
|
||||
<e p="LinearSystem2.cs" t="Include" />
|
||||
<e p="LineSegment.cs" t="Include" />
|
||||
<e p="MinDistCurveCurve.cs" t="Include" />
|
||||
<e p="Parallelogram.cs" t="Include" />
|
||||
<e p="ParallelogramBinaryTreeNode.cs" t="Include" />
|
||||
<e p="ParallelogramInternalTreeNode.cs" t="Include" />
|
||||
<e p="ParallelogramLeaf.cs" t="Include" />
|
||||
<e p="ParallelogramNode.cs" t="Include" />
|
||||
<e p="ParallelogramNodeOverICurve.cs" t="Include" />
|
||||
<e p="PenetrationDepth.cs" t="Include" />
|
||||
<e p="PlaneTransformation.cs" t="Include" />
|
||||
<e p="PointLocation.cs" t="Include" />
|
||||
<e p="Polyline.cs" t="Include" />
|
||||
<e p="PolylineIterator.cs" t="Include" />
|
||||
<e p="PolylinePoint.cs" t="Include" />
|
||||
<e p="RootFinder.cs" t="Include" />
|
||||
<e p="RoundedRect.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Direction.cs" t="Include" />
|
||||
<e p="MinEnclosingDisc" t="Include">
|
||||
<e p="Disc.cs" t="Include" />
|
||||
<e p="MinimumEnclosingDisc.cs" t="Include" />
|
||||
</e>
|
||||
<e p="MultidimensionalScaling.cs" t="Include" />
|
||||
<e p="OverlapRemoval" t="Include">
|
||||
<e p="BorderInfo.cs" t="Include" />
|
||||
<e p="ConstraintGenerator.cs" t="Include" />
|
||||
<e p="OverlapRemovalCluster.cs" t="Include" />
|
||||
<e p="OverlapRemovalClusterEvent.cs" t="Include" />
|
||||
<e p="OverlapRemovalClusterScanLine.cs" t="Include" />
|
||||
<e p="OverlapRemovalGlobalConfiguration.cs" t="Include" />
|
||||
<e p="OverlapRemovalNode.cs" t="Include" />
|
||||
<e p="OverlapRemovalParameters.cs" t="Include" />
|
||||
<e p="RectangularClusterBoundary.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Point.cs" t="Include" />
|
||||
<e p="PointNodesList.cs" t="Include" />
|
||||
<e p="PointPair.cs" t="Include" />
|
||||
<e p="Rectangle.cs" t="Include" />
|
||||
<e p="RectanglePacking" t="Include">
|
||||
<e p="ColumnPacking.cs" t="Include" />
|
||||
<e p="OptimalColumnPacking.cs" t="Include" />
|
||||
<e p="OptimalPacking.cs" t="Include" />
|
||||
<e p="OptimalRectanglePacking.cs" t="Include" />
|
||||
<e p="Packing.cs" t="Include" />
|
||||
<e p="PackingConstants.cs" t="Include" />
|
||||
<e p="RectanglePacking.cs" t="Include" />
|
||||
<e p="RectangleToPack.cs" t="Include" />
|
||||
</e>
|
||||
<e p="RTree" t="Include">
|
||||
<e p="HitTestBehavior.cs" t="Include" />
|
||||
<e p="IntervalNode.cs" t="Include" />
|
||||
<e p="IntervalNodeUtils.cs" t="Include" />
|
||||
<e p="IntervalRTree.cs" t="Include" />
|
||||
<e p="RectangleNode.cs" t="Include" />
|
||||
<e p="RectangleNodeUtils.cs" t="Include" />
|
||||
<e p="RTree.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Site.cs" t="Include" />
|
||||
<e p="SmoothedPolyline.cs" t="Include" />
|
||||
<e p="TriangleOrientation.cs" t="Include" />
|
||||
</e>
|
||||
<e p="GraphAlgorithms" t="Include">
|
||||
<e p="BasicGraph.cs" t="Include" />
|
||||
<e p="CycleRemoval" t="Include">
|
||||
<e p="ConnectedComponentCalculator.cs" t="Include" />
|
||||
<e p="CycleRemoval.cs" t="Include" />
|
||||
<e p="CycleRemovalWithConstraints.cs" t="Include" />
|
||||
<e p="GraphForCycleRemoval.cs" t="Include" />
|
||||
<e p="NodeInfo.cs" t="Include" />
|
||||
</e>
|
||||
<e p="IEdge.cs" t="Include" />
|
||||
<e p="IntPair.cs" t="Include" />
|
||||
<e p="MinimumSpanningTreeByPrim.cs" t="Include" />
|
||||
<e p="TopologicalSort.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Layout" t="Include">
|
||||
<e p="Arrowhead.cs" t="Include" />
|
||||
<e p="Arrowheads.cs" t="Include" />
|
||||
<e p="Cluster.cs" t="Include" />
|
||||
<e p="CurvePort.cs" t="Include" />
|
||||
<e p="Edge.cs" t="Include" />
|
||||
<e p="EdgeCollection.cs" t="Include" />
|
||||
<e p="EdgeGeometry.cs" t="Include" />
|
||||
<e p="EdgeLabelPlacement.cs" t="Include" />
|
||||
<e p="FloatingPort.cs" t="Include" />
|
||||
<e p="GeometryGraph.cs" t="Include" />
|
||||
<e p="GeometryObject.cs" t="Include" />
|
||||
<e p="GraphConnectedComponents.cs" t="Include" />
|
||||
<e p="HookUpAnywhereFromInsidePort.cs" t="Include" />
|
||||
<e p="IdealEdgeLengthSettings.cs" t="Include" />
|
||||
<e p="ILabeledObject.cs" t="Include" />
|
||||
<e p="IObstacle.cs" t="Include" />
|
||||
<e p="IsOpenChangeEventArgs.cs" t="Include" />
|
||||
<e p="Label.cs" t="Include" />
|
||||
<e p="LabelPlacementResult.cs" t="Include" />
|
||||
<e p="LayoutAlgorithmHelpers.cs" t="Include" />
|
||||
<e p="LayoutAlgorithmSettings.cs" t="Include" />
|
||||
<e p="LayoutChangeEventArgs.cs" t="Include" />
|
||||
<e p="LgInfoBase.cs" t="Include" />
|
||||
<e p="LgNodeInfo.cs" t="Include" />
|
||||
<e p="LgNodeInfoKind.cs" t="Include" />
|
||||
<e p="MultiLocationFloatingPort.cs" t="Include" />
|
||||
<e p="Node.cs" t="Include" />
|
||||
<e p="NodeCollection.cs" t="Include" />
|
||||
<e p="PackingMethod.cs" t="Include" />
|
||||
<e p="Port.cs" t="Include" />
|
||||
<e p="PortEntry.cs" t="Include" />
|
||||
<e p="PortEntryOnCurve.cs" t="Include" />
|
||||
<e p="PortObstacle.cs" t="Include" />
|
||||
<e p="ProximityOverlapRemoval" t="Include">
|
||||
<e p="ConjugateGradient" t="Include">
|
||||
<e p="LinearSystemSolver.cs" t="Include" />
|
||||
<e p="SparseMatrix.cs" t="Include" />
|
||||
<e p="Vector.cs" t="Include" />
|
||||
</e>
|
||||
<e p="IOverlapRemoval.cs" t="Include" />
|
||||
<e p="MST" t="Include">
|
||||
<e p="GTreeOverlapRemoval.cs" t="Include" />
|
||||
<e p="MstLineSweeper.cs" t="Include" />
|
||||
<e p="MstOnDelaunayTriangulation.cs" t="Include" />
|
||||
</e>
|
||||
<e p="OverlapRemovalMethod.cs" t="Include" />
|
||||
<e p="OverlapRemovalSettings.cs" t="Include" />
|
||||
<e p="ProximityOverlapRemoval.cs" t="Include" />
|
||||
<e p="StressEnergy" t="Include">
|
||||
<e p="ExampleStressMajorization.cs" t="Include" />
|
||||
<e p="MaxIterationMethod.cs" t="Include" />
|
||||
<e p="NodeVoting.cs" t="Include" />
|
||||
<e p="SolvingMethod.cs" t="Include" />
|
||||
<e p="StressMajorization.cs" t="Include" />
|
||||
<e p="StressMajorizationSettings.cs" t="Include" />
|
||||
<e p="UpdateMethod.cs" t="Include" />
|
||||
<e p="Vote.cs" t="Include" />
|
||||
<e p="VoteBlock.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="RectangleObstacle.cs" t="Include" />
|
||||
<e p="RelativeFloatingPort.cs" t="Include" />
|
||||
<e p="SimpleIntEdge.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ParallelUtilities.cs" t="Include" />
|
||||
<e p="ProgressChangedEventArgs.cs" t="Include" />
|
||||
<e p="ProjectionSolver" t="Include">
|
||||
<e p="Block.cs" t="Include" />
|
||||
<e p="BlockVector.cs" t="Include" />
|
||||
<e p="Constraint.cs" t="Include" />
|
||||
<e p="ConstraintVector.cs" t="Include" />
|
||||
<e p="DfDvNode.cs" t="Include" />
|
||||
<e p="GlobalConfiguration.cs" t="Include" />
|
||||
<e p="ISolverShell.cs" t="Include" />
|
||||
<e p="Parameters.cs" t="Include" />
|
||||
<e p="QPSC.cs" t="Include" />
|
||||
<e p="Solution.cs" t="Include" />
|
||||
<e p="Solver.cs" t="Include" />
|
||||
<e p="SolverAlgorithm.cs" t="Include" />
|
||||
<e p="SolverShell.cs" t="Include" />
|
||||
<e p="UniformOneDimensionalSolver.cs" t="Include" />
|
||||
<e p="UniformSolverVar.cs" t="Include" />
|
||||
<e p="Variable.cs" t="Include" />
|
||||
<e p="ViolationCache.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Routing" t="Include">
|
||||
<e p="BundlingSettings.cs" t="Include" />
|
||||
<e p="EdgeRoutingMode.cs" t="Include" />
|
||||
<e p="EdgeRoutingSettings.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="DebugHelpers" t="Include">
|
||||
<e p="CurveSerializer.cs" t="Include" />
|
||||
<e p="DebugCurve.cs" t="Include" />
|
||||
<e p="DebugCurveCollection.cs" t="Include" />
|
||||
<e p="DebugEllipse.cs" t="Include" />
|
||||
<e p="DebugGraphics.cs" t="Include" />
|
||||
<e p="DebugRectangle.cs" t="Include" />
|
||||
<e p="DebugShape.cs" t="Include" />
|
||||
<e p="DevTrace.cs" t="Include" />
|
||||
<e p="IDebugGraphics.cs" t="Include" />
|
||||
<e p="Persistence" t="Include">
|
||||
<e p="CharStreamElement.cs" t="Include" />
|
||||
<e p="ClusterWithChildLists.cs" t="Include" />
|
||||
<e p="CurveStream.cs" t="Include" />
|
||||
<e p="CurveStreamElement.cs" t="Include" />
|
||||
<e p="DoubleStreamElement.cs" t="Include" />
|
||||
<e p="GeometryGraphReader.cs" t="Include" />
|
||||
<e p="GeometryGraphWriter.cs" t="Include" />
|
||||
<e p="GeometryToken.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Show.cs" t="Include" />
|
||||
<e p="ShowDatabase.cs" t="Include" />
|
||||
<e p="ShowDebugCurves.cs" t="Include" />
|
||||
<e p="ShowDebugCurvesEnumeration.cs" t="Include" />
|
||||
<e p="Timer.cs" t="Include" />
|
||||
</e>
|
||||
<e p="GlobalSuppressions.cs" t="Include" />
|
||||
<e p="GraphmapsWithMesh" t="Include">
|
||||
<e p="Angle.cs" t="Include" />
|
||||
<e p="ComponentCollection.cs" t="Include" />
|
||||
<e p="DijkstraAlgo.cs" t="Include" />
|
||||
<e p="LocalModifications.cs" t="Include" />
|
||||
<e p="MeshCreator.cs" t="Include" />
|
||||
<e p="MeshGraph.cs" t="Include" />
|
||||
<e p="MsaglUtilities.cs" t="Include" />
|
||||
<e p="Network.cs" t="Include" />
|
||||
<e p="PlanarGraphUtilities.cs" t="Include" />
|
||||
<e p="PointSet.cs" t="Include" />
|
||||
<e p="PointToSegmentDistance.cs" t="Include" />
|
||||
<e p="SteinerTree.cs" t="Include" />
|
||||
<e p="Tiling.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Layout" t="Include">
|
||||
<e p="Incremental" t="Include">
|
||||
<e p="AxisSolver.cs" t="Include" />
|
||||
<e p="EdgeConstraintGenerator.cs" t="Include" />
|
||||
<e p="FastIncrementalLayout.cs" t="Include" />
|
||||
<e p="FastIncrementalLayoutSettings.cs" t="Include" />
|
||||
<e p="Feasibility.cs" t="Include" />
|
||||
<e p="FiEdge.cs" t="Include" />
|
||||
<e p="FiNode.cs" t="Include" />
|
||||
<e p="HorizontalSeparationConstraint.cs" t="Include" />
|
||||
<e p="IConstraint.cs" t="Include" />
|
||||
<e p="LockPosition.cs" t="Include" />
|
||||
<e p="MaxSeparationConstraint.cs" t="Include" />
|
||||
<e p="MinSeparationConstraint.cs" t="Include" />
|
||||
<e p="Multipole" t="Include">
|
||||
<e p="KDTree.cs" t="Include" />
|
||||
<e p="MultipoleCoefficients.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ProcrustesCircleConstraint.cs" t="Include" />
|
||||
<e p="Relayout.cs" t="Include" />
|
||||
<e p="StickConstraint.cs" t="Include" />
|
||||
<e p="VerticalSeparationConstraint.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Initial" t="Include">
|
||||
<e p="InitialLayout.cs" t="Include" />
|
||||
<e p="InitialLayoutByCluster.cs" t="Include" />
|
||||
<e p="InitialLayoutHelpers.cs" t="Include" />
|
||||
</e>
|
||||
<e p="LargeGraphLayout" t="Include">
|
||||
<e p="DeviceIndependedZoomCalculatorForNodes.cs" t="Include" />
|
||||
<e p="EdgePicker.cs" t="Include" />
|
||||
<e p="Interval.cs" t="Include" />
|
||||
<e p="IZoomLevelCalculator.cs" t="Include" />
|
||||
<e p="LevelCalculator.cs" t="Include" />
|
||||
<e p="LgCellInfo.cs" t="Include" />
|
||||
<e p="LgData.cs" t="Include" />
|
||||
<e p="LgEdgeInfo.cs" t="Include" />
|
||||
<e p="LgInteractor.cs" t="Include" />
|
||||
<e p="LgLayoutSettings.cs" t="Include" />
|
||||
<e p="LgLevel.cs" t="Include" />
|
||||
<e p="LgNodeCollection.cs" t="Include" />
|
||||
<e p="LgPathRouter.cs" t="Include" />
|
||||
<e p="LgSkeletonLevel.cs" t="Include" />
|
||||
<e p="NodeRailLevelCalculator" t="Include">
|
||||
<e p="GreedyNodeRailLevelCalculator.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Rail.cs" t="Include" />
|
||||
<e p="RailGraph.cs" t="Include" />
|
||||
<e p="RouteSimplifier.cs" t="Include" />
|
||||
<e p="ShortestPartRouterForLg.cs" t="Include" />
|
||||
<e p="SimpleEdgeCollection.cs" t="Include" />
|
||||
<e p="SimpleNodeCollection.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Layered" t="Include">
|
||||
<e p="Anchor.cs" t="Include" />
|
||||
<e p="Balancing.cs" t="Include" />
|
||||
<e p="DataBase.cs" t="Include" />
|
||||
<e p="EdgePathsInserter.cs" t="Include" />
|
||||
<e p="FlatEdgeRouter.cs" t="Include" />
|
||||
<e p="HierarchyCalculator.cs" t="Include" />
|
||||
<e p="HorizontalConstraintsForSugiyama.cs" t="Include" />
|
||||
<e p="IntEdge.cs" t="Include" />
|
||||
<e p="LayerArrays.cs" t="Include" />
|
||||
<e p="LayerCalculator.cs" t="Include" />
|
||||
<e p="LayerEdge.cs" t="Include" />
|
||||
<e p="LayeredLayout.cs" t="Include" />
|
||||
<e p="LayeredLayoutEngine.cs" t="Include" />
|
||||
<e p="Layering" t="Include">
|
||||
<e p="LongestPathLayering.cs" t="Include" />
|
||||
<e p="NetworkSimplex.cs" t="Include" />
|
||||
</e>
|
||||
<e p="LayerInserter.cs" t="Include" />
|
||||
<e p="NetworkEdge.cs" t="Include" />
|
||||
<e p="NetworkSimplexForGeneralGraph.cs" t="Include" />
|
||||
<e p="Ordering" t="Include">
|
||||
<e p="AdjacentSwaps.cs" t="Include" />
|
||||
<e p="AdjacentSwapsWithConstraints.cs" t="Include" />
|
||||
<e p="ConstrainedOrdering.cs" t="Include" />
|
||||
<e p="ConstrainedOrderMeasure.cs" t="Include" />
|
||||
<e p="EdgeComparerBySource.cs" t="Include" />
|
||||
<e p="EdgeComparerByTarget.cs" t="Include" />
|
||||
<e p="LayerInfo.cs" t="Include" />
|
||||
<e p="MetroMapOrdering.cs" t="Include" />
|
||||
<e p="Ordering.cs" t="Include" />
|
||||
<e p="OrderingMeasure.cs" t="Include" />
|
||||
<e p="SweepMode.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ProperLayeredGraph.cs" t="Include" />
|
||||
<e p="RecoveryLayerCalculator.cs" t="Include" />
|
||||
<e p="RecoveryLayeredLayoutEngine.cs" t="Include" />
|
||||
<e p="RefinerBetweenTwoLayers.cs" t="Include" />
|
||||
<e p="Routing.cs" t="Include" />
|
||||
<e p="SmoothedPolylineCalculator.cs" t="Include" />
|
||||
<e p="SugiyamaLayoutLogger.cs" t="Include" />
|
||||
<e p="SugiyamaLayoutSettings.cs" t="Include" />
|
||||
<e p="TwoLayerFlatEdgeRouter.cs" t="Include" />
|
||||
<e p="VertexEnumerators.cs" t="Include" />
|
||||
<e p="VerticalConstraintsForSugiyama.cs" t="Include" />
|
||||
<e p="XCoordsWithAlignment.cs" t="Include" />
|
||||
<e p="XLayoutGraph.cs" t="Include" />
|
||||
</e>
|
||||
<e p="MDS" t="Include">
|
||||
<e p="AllPairsDistances.cs" t="Include" />
|
||||
<e p="MDSGraphLayout.cs" t="Include" />
|
||||
<e p="MDSLayoutSettings.cs" t="Include" />
|
||||
<e p="PivotDistances.cs" t="Include" />
|
||||
<e p="PivotMDS.cs" t="Include" />
|
||||
<e p="SingleSourceDistances.cs" t="Include" />
|
||||
<e p="Transform.cs" t="Include" />
|
||||
</e>
|
||||
<e p="OverlapRemovalFixedSegments" t="Include">
|
||||
<e p="FakeBitmap.cs" t="Include" />
|
||||
<e p="OverlapRemovalFixedSegmentsBitmap.cs" t="Include" />
|
||||
<e p="OverlapRemovalFixedSegmentsMst.cs" t="Include" />
|
||||
<e p="PixelPoint.cs" t="Include" />
|
||||
<e p="RectSegIntersection.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="Miscellaneous" t="Include">
|
||||
<e p="ConstrainedSkeleton" t="Include">
|
||||
<e p="SteinerCdt.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Constraints" t="Include">
|
||||
<e p="AlignmentConstraint.cs" t="Include" />
|
||||
</e>
|
||||
<e p="LayoutEditing" t="Include">
|
||||
<e p="BumperPusher.cs" t="Include" />
|
||||
<e p="EdgeRestoreData.cs" t="Include" />
|
||||
<e p="GraphRestoreData.cs" t="Include" />
|
||||
<e p="IncrementalDragger.cs" t="Include" />
|
||||
<e p="LabelFixture.cs" t="Include" />
|
||||
<e p="LabelRestoreData.cs" t="Include" />
|
||||
<e p="NodeRestoreData.cs" t="Include" />
|
||||
<e p="ObstacleCalculator.cs" t="Include" />
|
||||
<e p="RestoreData.cs" t="Include" />
|
||||
<e p="RestoreHelper.cs" t="Include" />
|
||||
<e p="RouterBetweenTwoNodes.cs" t="Include" />
|
||||
<e p="WeightedEdge.cs" t="Include" />
|
||||
</e>
|
||||
<e p="LayoutHelpers.cs" t="Include" />
|
||||
<e p="MultiScale" t="Include">
|
||||
<e p="MultiScaleLayout.cs" t="Include" />
|
||||
</e>
|
||||
<e p="NonOverlappingBoundaries" t="Include">
|
||||
<e p="AllPairsNonOverlappingBoundaries.cs" t="Include" />
|
||||
<e p="ProximityQuery.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Phylo" t="Include">
|
||||
<e p="PhyloEdge.cs" t="Include" />
|
||||
<e p="PhyloTree.cs" t="Include" />
|
||||
<e p="PhyloTreeLayoutCalclulation.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Ranking" t="Include">
|
||||
<e p="Centrality.cs" t="Include" />
|
||||
<e p="RankingLayout.cs" t="Include" />
|
||||
<e p="RankingLayoutSettings.cs" t="Include" />
|
||||
</e>
|
||||
<e p="RegularGrid" t="Include">
|
||||
<e p="GridTraversal.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Routing" t="Include">
|
||||
<e p="ShortestPathTree.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="Routing" t="Include">
|
||||
<e p="ClusterBoundaryPort.cs" t="Include" />
|
||||
<e p="ConstrainedDelaunayTriangulation" t="Include">
|
||||
<e p="Cdt.cs" t="Include" />
|
||||
<e p="CdtEdge.cs" t="Include" />
|
||||
<e p="CdtFront.cs" t="Include" />
|
||||
<e p="CdtFrontElement.cs" t="Include" />
|
||||
<e p="CdtSite.cs" t="Include" />
|
||||
<e p="CdtSweeper.cs" t="Include" />
|
||||
<e p="CdtTriangle.cs" t="Include" />
|
||||
<e p="EdgeInserter.cs" t="Include" />
|
||||
<e p="EdgeTracer.cs" t="Include" />
|
||||
<e p="PerimeterEdge.cs" t="Include" />
|
||||
<e p="ThreeArray.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Corner.cs" t="Include" />
|
||||
<e p="InteractiveEdgeRouter.cs" t="Include" />
|
||||
<e p="InteractiveObstacleCalculator.cs" t="Include" />
|
||||
<e p="MultiEdgeRouter.cs" t="Include" />
|
||||
<e p="MultipleSourceMultipleTargetsShortestPathOnVisibilityGraph.cs" t="Include" />
|
||||
<e p="NodeKind.cs" t="Include" />
|
||||
<e p="PreGraph.cs" t="Include" />
|
||||
<e p="Rectilinear" t="Include">
|
||||
<e p="AxisCoordinateEvent.cs" t="Include" />
|
||||
<e p="BasicObstacleSide.cs" t="Include" />
|
||||
<e p="BasicReflectionEvent.cs" t="Include" />
|
||||
<e p="BasicVertexEvent.cs" t="Include" />
|
||||
<e p="CloseVertexEvent.cs" t="Include" />
|
||||
<e p="Clump.cs" t="Include" />
|
||||
<e p="EnumeratorWrapper.cs" t="Include" />
|
||||
<e p="EventQueue.cs" t="Include" />
|
||||
<e p="FreePoint.cs" t="Include" />
|
||||
<e p="FullVisibilityGraphGenerator.cs" t="Include" />
|
||||
<e p="GroupBoundaryCrossing.cs" t="Include" />
|
||||
<e p="GroupBoundaryCrossingMap.cs" t="Include" />
|
||||
<e p="HighBendVertexEvent.cs" t="Include" />
|
||||
<e p="HighObstacleSide.cs" t="Include" />
|
||||
<e p="HighReflectionEvent.cs" t="Include" />
|
||||
<e p="LookaheadScan.cs" t="Include" />
|
||||
<e p="LowBendVertexEvent.cs" t="Include" />
|
||||
<e p="LowObstacleSide.cs" t="Include" />
|
||||
<e p="LowReflectionEvent.cs" t="Include" />
|
||||
<e p="MsmtRectilinearPath.cs" t="Include" />
|
||||
<e p="NeighborSides.cs" t="Include" />
|
||||
<e p="Nudging" t="Include">
|
||||
<e p="AxisEdge.cs" t="Include" />
|
||||
<e p="AxisEdgeHighPointEvent.cs" t="Include" />
|
||||
<e p="AxisEdgeLowPointEvent.cs" t="Include" />
|
||||
<e p="AxisEdgesContainer.cs" t="Include" />
|
||||
<e p="CombinatorialNudger.cs" t="Include" />
|
||||
<e p="FreeSpaceFinder.cs" t="Include" />
|
||||
<e p="LinkedPoint.cs" t="Include" />
|
||||
<e p="LinkedPointSplitter.cs" t="Include" />
|
||||
<e p="LongestNudgedSegment.cs" t="Include" />
|
||||
<e p="Nudger.cs" t="Include" />
|
||||
<e p="Path.cs" t="Include" />
|
||||
<e p="PathEdge.cs" t="Include" />
|
||||
<e p="PathMerger.cs" t="Include" />
|
||||
<e p="PathRefiner.cs" t="Include" />
|
||||
<e p="PointByDelegateComparer.cs" t="Include" />
|
||||
<e p="PointProjection.cs" t="Include" />
|
||||
<e p="SegWithIndex.cs" t="Include" />
|
||||
<e p="SpaceCalculationEvent.cs" t="Include" />
|
||||
<e p="StaircaseRemover.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Obstacle.cs" t="Include" />
|
||||
<e p="ObstaclePort.cs" t="Include" />
|
||||
<e p="ObstaclePortEntrance.cs" t="Include" />
|
||||
<e p="ObstacleTree.cs" t="Include" />
|
||||
<e p="OpenVertexEvent.cs" t="Include" />
|
||||
<e p="OverlapConvexHull.cs" t="Include" />
|
||||
<e p="PointAndCrossings.cs" t="Include" />
|
||||
<e p="PointAndCrossingsList.cs" t="Include" />
|
||||
<e p="PointComparer.cs" t="Include" />
|
||||
<e p="PortManager.cs" t="Include" />
|
||||
<e p="RectilinearEdgeRouter.cs" t="Include" />
|
||||
<e p="RectilinearInteractiveEditor.cs" t="Include" />
|
||||
<e p="RectilinearScanLine.cs" t="Include" />
|
||||
<e p="ScanDirection.cs" t="Include" />
|
||||
<e p="ScanSegment.cs" t="Include" />
|
||||
<e p="ScanSegmentTree.cs" t="Include" />
|
||||
<e p="ScanSegmentVector.cs" t="Include" />
|
||||
<e p="ScanSegmentVectorItem.cs" t="Include" />
|
||||
<e p="SegmentIntersector.cs" t="Include" />
|
||||
<e p="SparseVisibilityGraphGenerator.cs" t="Include" />
|
||||
<e p="SpliceUtility.cs" t="Include" />
|
||||
<e p="SsstRectilinearPath.cs" t="Include" />
|
||||
<e p="StaticGraphUtility.cs" t="Include" />
|
||||
<e p="TransientGraphUtility.cs" t="Include" />
|
||||
<e p="VertexEntry.cs" t="Include" />
|
||||
<e p="VisibilityGraphGenerator.cs" t="Include" />
|
||||
<e p="VisibilityVertexRectilinear.cs" t="Include" />
|
||||
<e p="WaypointPort.cs" t="Include" />
|
||||
</e>
|
||||
<e p="RelativeShape.cs" t="Include" />
|
||||
<e p="RelaxedPolylinePoint.cs" t="Include" />
|
||||
<e p="Shape.cs" t="Include" />
|
||||
<e p="ShapeCreator.cs" t="Include" />
|
||||
<e p="ShapeCreatorForRoutingToParents.cs" t="Include" />
|
||||
<e p="ShapeObstacleCalculator.cs" t="Include" />
|
||||
<e p="SingleSourceMultipleTargetsShortestPathOnVisibilityGraph.cs" t="Include" />
|
||||
<e p="SingleSourceSingleTargetShortestPathOnVisibilityGraph.cs" t="Include" />
|
||||
<e p="Spline" t="Include">
|
||||
<e p="Bundling" t="Include">
|
||||
<e p="BundleBase.cs" t="Include" />
|
||||
<e p="BundleBasesCalculator.cs" t="Include" />
|
||||
<e p="BundleInfo.cs" t="Include" />
|
||||
<e p="BundleRouter.cs" t="Include" />
|
||||
<e p="BundlingStatus.cs" t="Include" />
|
||||
<e p="CdtIntersections.cs" t="Include" />
|
||||
<e p="CdtThreader.cs" t="Include" />
|
||||
<e p="ChannelFlag.cs" t="Include" />
|
||||
<e p="CostCalculator.cs" t="Include" />
|
||||
<e p="EdgeNudger.cs" t="Include" />
|
||||
<e p="FlipCollapser.cs" t="Include" />
|
||||
<e p="FlipSwitcher.cs" t="Include" />
|
||||
<e p="GeneralMetroMapOrdering.cs" t="Include" />
|
||||
<e p="HubDebugger.cs" t="Include" />
|
||||
<e p="HubRadiiCalculator.cs" t="Include" />
|
||||
<e p="IMetroMapOrderingAlgorithm.cs" t="Include" />
|
||||
<e p="IntersectionCache.cs" t="Include" />
|
||||
<e p="Intersections.cs" t="Include" />
|
||||
<e p="LinearMetroMapOrdering.cs" t="Include" />
|
||||
<e p="MetroGraphData.cs" t="Include" />
|
||||
<e p="MetroLine.cs" t="Include" />
|
||||
<e p="MetroNodeInfo.cs" t="Include" />
|
||||
<e p="NodePositionsAdjuster.cs" t="Include" />
|
||||
<e p="OrientedHubSegment.cs" t="Include" />
|
||||
<e p="PathFixer.cs" t="Include" />
|
||||
<e p="PointPairOrder.cs" t="Include" />
|
||||
<e p="SdBoneEdge.cs" t="Include" />
|
||||
<e p="SdShortestPath.cs" t="Include" />
|
||||
<e p="SdVertex.cs" t="Include" />
|
||||
<e p="SimulatedAnnealing.cs" t="Include" />
|
||||
<e p="Station.cs" t="Include" />
|
||||
<e p="StationEdgeInfo.cs" t="Include" />
|
||||
<e p="TimeMeasurer.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ConeSpanner" t="Include">
|
||||
<e p="BrokenConeSide.cs" t="Include" />
|
||||
<e p="Cone.cs" t="Include" />
|
||||
<e p="ConeClosureEvent.cs" t="Include" />
|
||||
<e p="ConeLeftSide.cs" t="Include" />
|
||||
<e p="ConeRightSide.cs" t="Include" />
|
||||
<e p="ConeSide.cs" t="Include" />
|
||||
<e p="ConeSideComparer.cs" t="Include" />
|
||||
<e p="ConeSpanner.cs" t="Include" />
|
||||
<e p="ConeSpannerForPortLocations.cs" t="Include" />
|
||||
<e p="IConeSweeper.cs" t="Include" />
|
||||
<e p="LeftIntersectionEvent.cs" t="Include" />
|
||||
<e p="LeftObstacleSide.cs" t="Include" />
|
||||
<e p="LeftVertexEvent.cs" t="Include" />
|
||||
<e p="LineSweeper.cs" t="Include" />
|
||||
<e p="LineSweeperForPortLocations.cs" t="Include" />
|
||||
<e p="LowestVertexEvent.cs" t="Include" />
|
||||
<e p="ObstacleSide.cs" t="Include" />
|
||||
<e p="PortLocationEvent.cs" t="Include" />
|
||||
<e p="RightIntersectionEvent.cs" t="Include" />
|
||||
<e p="RightObstacleSide.cs" t="Include" />
|
||||
<e p="RightVertexEvent.cs" t="Include" />
|
||||
<e p="SweepEvent.cs" t="Include" />
|
||||
<e p="VertexEvent.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="SplineRouter.cs" t="Include" />
|
||||
<e p="StraightLineEdges.cs" t="Include" />
|
||||
<e p="TightLooseCouple.cs" t="Include" />
|
||||
<e p="Visibility" t="Include">
|
||||
<e p="ActiveDiagonalComparerWithRay.cs" t="Include" />
|
||||
<e p="ActiveEdgeComparerWithRay.cs" t="Include" />
|
||||
<e p="BimodalSequence.cs" t="Include" />
|
||||
<e p="Diagonal.cs" t="Include" />
|
||||
<e p="InteractiveTangentVisibilityGraphCalculator.cs" t="Include" />
|
||||
<e p="LineSweeperBase.cs" t="Include" />
|
||||
<e p="ObstacleSideComparer.cs" t="Include" />
|
||||
<e p="PointVisibilityCalculator.cs" t="Include" />
|
||||
<e p="Polygon.cs" t="Include" />
|
||||
<e p="PortObstacleEvent.cs" t="Include" />
|
||||
<e p="SegmentBase.cs" t="Include" />
|
||||
<e p="Stem.cs" t="Include" />
|
||||
<e p="StemStartPointComparer.cs" t="Include" />
|
||||
<e p="Tangent.cs" t="Include" />
|
||||
<e p="TangentPair.cs" t="Include" />
|
||||
<e p="TangentVisibilityGraphCalculator.cs" t="Include" />
|
||||
<e p="TollFreeVisibilityEdge.cs" t="Include" />
|
||||
<e p="UnimodalSequence.cs" t="Include" />
|
||||
<e p="VisibilityEdge.cs" t="Include" />
|
||||
<e p="VisibilityGraph.cs" t="Include" />
|
||||
<e p="VisibilityKind.cs" t="Include" />
|
||||
<e p="VisibilityVertex.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="ValidateArg.cs" t="Include" />
|
||||
</e>
|
||||
<e p="NaughtyAttributes" t="Include">
|
||||
<e p="Scripts" t="Include">
|
||||
<e p="Core" t="Include">
|
||||
|
|
@ -1258,12 +1872,12 @@
|
|||
</e>
|
||||
<e p="Rect.cs" t="Include" />
|
||||
<e p="Ship.cs" t="Include" />
|
||||
<e p="Technology.cs" t="Include" />
|
||||
<e p="ZoneData.cs" t="Include" />
|
||||
<e p="ZoneGenerator.cs" t="Include" />
|
||||
</e>
|
||||
<e p="StrategyGameManager.cs" t="Include" />
|
||||
<e p="TechTreeTest.cs" t="Include" />
|
||||
<e p="TechTreeTestMsagl.cs" t="Include" />
|
||||
<e p="UI" t="Include">
|
||||
<e p="BackgroundRenderer.cs" t="Include" />
|
||||
<e p="ClickableCollider.cs" t="Include" />
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;TEST_MSAGL;REPORTING;PERSISTENCE;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>0169</NoWarn>
|
||||
|
|
@ -383,6 +383,9 @@
|
|||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -410,9 +413,6 @@
|
|||
<Reference Include="Grpc.Core.Api">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.17f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;TEST_MSAGL;REPORTING;PERSISTENCE;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>0169</NoWarn>
|
||||
|
|
@ -297,6 +297,9 @@
|
|||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -321,9 +324,6 @@
|
|||
<Reference Include="Grpc.Core.Api">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.17f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Temp\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2018_4_17;UNITY_2018_4;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;UNITY_POST_PROCESSING_STACK_V2;TEST_MSAGL;REPORTING;PERSISTENCE;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>0169</NoWarn>
|
||||
|
|
@ -241,6 +241,516 @@
|
|||
<Compile Include="Assets\Scripts\NIH\MIConvexHull\Triangulation\VoronoiMesh.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MIConvexHull\Vertex2.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MIConvexHull\Vertex3.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\AlgorithmBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\CancelToken.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\BinaryHeapPriorityQueue.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\BinaryHeapWithComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\CollectionUtilities.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\GenericBinaryHeapPriorityQueue.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\GenericBinaryHeapPriorityQueueWithTimestamp.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\GenericHeapElement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\GenericHeapElementWithTimestamp.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\ComparerOnDelegate.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\DefaultComperer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\RBColor.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\RBNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\RBTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RBTree\RBTreeEnumerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\RealNumberSpan.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\Set.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\Size.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\DataStructures\SymmetricTuple.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\ApproximateComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\CompassVector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\ConvexHull\ConvexHull.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\ConvexHull\HullPoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\ConvexHull\HullPointComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\ConvexHull\HullStack.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ClosestPointOnCurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\CubicBezierSegment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\CurvatureDerivative.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\Curve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\CurveFactory.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\CurveLengthAndParams.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\CurveTangent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\Ellipse.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ICurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\IFunction.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\IntersectionInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\LinearSystem2.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\LineSegment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\MinDistCurveCurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\Parallelogram.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ParallelogramBinaryTreeNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ParallelogramInternalTreeNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ParallelogramLeaf.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ParallelogramNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\ParallelogramNodeOverICurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PenetrationDepth.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PlaneTransformation.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PointLocation.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\Polyline.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PolylineIterator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\PolylinePoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\RootFinder.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Curves\RoundedRect.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Direction.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\MinEnclosingDisc\Disc.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\MinEnclosingDisc\MinimumEnclosingDisc.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\MultidimensionalScaling.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\BorderInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\ConstraintGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalCluster.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalClusterEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalClusterScanLine.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalGlobalConfiguration.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\OverlapRemovalParameters.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\OverlapRemoval\RectangularClusterBoundary.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Point.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\PointNodesList.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\PointPair.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Rectangle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\ColumnPacking.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\OptimalColumnPacking.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\OptimalPacking.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\OptimalRectanglePacking.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\Packing.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\PackingConstants.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\RectanglePacking.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RectanglePacking\RectangleToPack.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\HitTestBehavior.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\IntervalNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\IntervalNodeUtils.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\IntervalRTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\RectangleNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\RectangleNodeUtils.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\RTree\RTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\Site.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\SmoothedPolyline.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Geometry\TriangleOrientation.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\BasicGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\CycleRemoval\ConnectedComponentCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\CycleRemoval\CycleRemoval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\CycleRemoval\CycleRemovalWithConstraints.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\CycleRemoval\GraphForCycleRemoval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\CycleRemoval\NodeInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\IEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\IntPair.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\MinimumSpanningTreeByPrim.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\GraphAlgorithms\TopologicalSort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Arrowhead.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Arrowheads.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Cluster.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\CurvePort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Edge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\EdgeCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\EdgeGeometry.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\EdgeLabelPlacement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\FloatingPort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\GeometryGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\GeometryObject.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\GraphConnectedComponents.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\HookUpAnywhereFromInsidePort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\IdealEdgeLengthSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ILabeledObject.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\IObstacle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\IsOpenChangeEventArgs.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Label.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LabelPlacementResult.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LayoutAlgorithmHelpers.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LayoutAlgorithmSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LayoutChangeEventArgs.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LgInfoBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LgNodeInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\LgNodeInfoKind.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\MultiLocationFloatingPort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Node.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\NodeCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\PackingMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\Port.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\PortEntry.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\PortEntryOnCurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\PortObstacle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\ConjugateGradient\LinearSystemSolver.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\ConjugateGradient\SparseMatrix.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\ConjugateGradient\Vector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\IOverlapRemoval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\MST\GTreeOverlapRemoval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\MST\MstLineSweeper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\MST\MstOnDelaunayTriangulation.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\OverlapRemovalMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\OverlapRemovalSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\ProximityOverlapRemoval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\ExampleStressMajorization.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\MaxIterationMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\NodeVoting.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\SolvingMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\StressMajorization.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\StressMajorizationSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\UpdateMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\Vote.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\ProximityOverlapRemoval\StressEnergy\VoteBlock.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\RectangleObstacle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\RelativeFloatingPort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Layout\SimpleIntEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ParallelUtilities.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProgressChangedEventArgs.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Block.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\BlockVector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Constraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\ConstraintVector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\DfDvNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\GlobalConfiguration.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\ISolverShell.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Parameters.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\QPSC.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Solution.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Solver.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\SolverAlgorithm.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\SolverShell.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\UniformOneDimensionalSolver.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\UniformSolverVar.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\Variable.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\ProjectionSolver\ViolationCache.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Routing\BundlingSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Routing\EdgeRoutingMode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Core\Routing\EdgeRoutingSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\CurveSerializer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugCurve.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugCurveCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugEllipse.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugGraphics.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugRectangle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugShape.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DevTrace.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\IDebugGraphics.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\CharStreamElement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\ClusterWithChildLists.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\CurveStream.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\CurveStreamElement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\DoubleStreamElement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\GeometryGraphReader.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\GeometryGraphWriter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Persistence\GeometryToken.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Show.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\ShowDatabase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\ShowDebugCurves.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\ShowDebugCurvesEnumeration.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\Timer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GlobalSuppressions.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\Angle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\ComponentCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\DijkstraAlgo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\LocalModifications.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\MeshCreator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\MeshGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\MsaglUtilities.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\Network.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\PlanarGraphUtilities.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\PointSet.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\PointToSegmentDistance.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\SteinerTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\GraphmapsWithMesh\Tiling.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\AxisSolver.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\EdgeConstraintGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\FastIncrementalLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\FastIncrementalLayoutSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\Feasibility.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\FiEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\FiNode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\HorizontalSeparationConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\IConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\LockPosition.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\MaxSeparationConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\MinSeparationConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\Multipole\KDTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\Multipole\MultipoleCoefficients.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\ProcrustesCircleConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\Relayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\StickConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Incremental\VerticalSeparationConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Initial\InitialLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Initial\InitialLayoutByCluster.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Initial\InitialLayoutHelpers.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\DeviceIndependedZoomCalculatorForNodes.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\EdgePicker.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\Interval.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\IZoomLevelCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LevelCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgCellInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgEdgeInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgInteractor.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgLayoutSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgLevel.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgNodeCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgPathRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgSkeletonLevel.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\NodeRailLevelCalculator\GreedyNodeRailLevelCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\Rail.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\RailGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\RouteSimplifier.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\ShortestPartRouterForLg.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\SimpleEdgeCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\SimpleNodeCollection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Anchor.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Balancing.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\DataBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\EdgePathsInserter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\FlatEdgeRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\HierarchyCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\HorizontalConstraintsForSugiyama.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\IntEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayerArrays.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayerCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayerEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayeredLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayeredLayoutEngine.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Layering\LongestPathLayering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Layering\NetworkSimplex.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\LayerInserter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\NetworkEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\NetworkSimplexForGeneralGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\AdjacentSwaps.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\AdjacentSwapsWithConstraints.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\ConstrainedOrdering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\ConstrainedOrderMeasure.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\EdgeComparerBySource.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\EdgeComparerByTarget.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\LayerInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\MetroMapOrdering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\Ordering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\OrderingMeasure.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Ordering\SweepMode.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\ProperLayeredGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\RecoveryLayerCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\RecoveryLayeredLayoutEngine.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\RefinerBetweenTwoLayers.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\Routing.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\SmoothedPolylineCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\SugiyamaLayoutLogger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\SugiyamaLayoutSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\TwoLayerFlatEdgeRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\VertexEnumerators.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\VerticalConstraintsForSugiyama.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\XCoordsWithAlignment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\Layered\XLayoutGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\AllPairsDistances.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\MDSGraphLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\MDSLayoutSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\PivotDistances.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\PivotMDS.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\SingleSourceDistances.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\MDS\Transform.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\OverlapRemovalFixedSegments\FakeBitmap.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\OverlapRemovalFixedSegments\OverlapRemovalFixedSegmentsBitmap.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\OverlapRemovalFixedSegments\OverlapRemovalFixedSegmentsMst.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\OverlapRemovalFixedSegments\PixelPoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\OverlapRemovalFixedSegments\RectSegIntersection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\ConstrainedSkeleton\SteinerCdt.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Constraints\AlignmentConstraint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\BumperPusher.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\EdgeRestoreData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\GraphRestoreData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\IncrementalDragger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\LabelFixture.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\LabelRestoreData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\NodeRestoreData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\ObstacleCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\RestoreData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\RestoreHelper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\RouterBetweenTwoNodes.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutEditing\WeightedEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\LayoutHelpers.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\MultiScale\MultiScaleLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\NonOverlappingBoundaries\AllPairsNonOverlappingBoundaries.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\NonOverlappingBoundaries\ProximityQuery.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Phylo\PhyloEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Phylo\PhyloTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Phylo\PhyloTreeLayoutCalclulation.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Ranking\Centrality.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Ranking\RankingLayout.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Ranking\RankingLayoutSettings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\RegularGrid\GridTraversal.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Miscellaneous\Routing\ShortestPathTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ClusterBoundaryPort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\Cdt.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtFront.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtFrontElement.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtSite.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtSweeper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\CdtTriangle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\EdgeInserter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\EdgeTracer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\PerimeterEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ConstrainedDelaunayTriangulation\ThreeArray.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Corner.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\InteractiveEdgeRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\InteractiveObstacleCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\MultiEdgeRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\MultipleSourceMultipleTargetsShortestPathOnVisibilityGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\NodeKind.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\PreGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\AxisCoordinateEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\BasicObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\BasicReflectionEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\BasicVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\CloseVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Clump.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\EnumeratorWrapper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\EventQueue.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\FreePoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\FullVisibilityGraphGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\GroupBoundaryCrossing.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\GroupBoundaryCrossingMap.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\HighBendVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\HighObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\HighReflectionEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\LookaheadScan.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\LowBendVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\LowObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\LowReflectionEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\MsmtRectilinearPath.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\NeighborSides.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\AxisEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\AxisEdgeHighPointEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\AxisEdgeLowPointEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\AxisEdgesContainer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\CombinatorialNudger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\FreeSpaceFinder.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\LinkedPoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\LinkedPointSplitter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\LongestNudgedSegment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\Nudger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\Path.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PathEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PathMerger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PathRefiner.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PointByDelegateComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\PointProjection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\SegWithIndex.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\SpaceCalculationEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Nudging\StaircaseRemover.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\Obstacle.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ObstaclePort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ObstaclePortEntrance.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ObstacleTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\OpenVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\OverlapConvexHull.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\PointAndCrossings.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\PointAndCrossingsList.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\PointComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\PortManager.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\RectilinearEdgeRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\RectilinearInteractiveEditor.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\RectilinearScanLine.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ScanDirection.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ScanSegment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ScanSegmentTree.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ScanSegmentVector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\ScanSegmentVectorItem.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\SegmentIntersector.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\SparseVisibilityGraphGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\SpliceUtility.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\SsstRectilinearPath.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\StaticGraphUtility.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\TransientGraphUtility.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\VertexEntry.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\VisibilityGraphGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\VisibilityVertexRectilinear.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Rectilinear\WaypointPort.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\RelativeShape.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\RelaxedPolylinePoint.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Shape.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ShapeCreator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ShapeCreatorForRoutingToParents.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\ShapeObstacleCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\SingleSourceMultipleTargetsShortestPathOnVisibilityGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\SingleSourceSingleTargetShortestPathOnVisibilityGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\BundleBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\BundleBasesCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\BundleInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\BundleRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\BundlingStatus.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\CdtIntersections.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\CdtThreader.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\ChannelFlag.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\CostCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\EdgeNudger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\FlipCollapser.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\FlipSwitcher.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\GeneralMetroMapOrdering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\HubDebugger.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\HubRadiiCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\IMetroMapOrderingAlgorithm.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\IntersectionCache.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\Intersections.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\LinearMetroMapOrdering.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\MetroGraphData.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\MetroLine.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\MetroNodeInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\NodePositionsAdjuster.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\OrientedHubSegment.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\PathFixer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\PointPairOrder.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\SdBoneEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\SdShortestPath.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\SdVertex.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\SimulatedAnnealing.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\Station.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\StationEdgeInfo.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\TimeMeasurer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\BrokenConeSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\Cone.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeClosureEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeLeftSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeRightSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeSideComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeSpanner.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeSpannerForPortLocations.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\IConeSweeper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LeftIntersectionEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LeftObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LeftVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LineSweeper.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LineSweeperForPortLocations.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\LowestVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\PortLocationEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\RightIntersectionEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\RightObstacleSide.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\RightVertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\SweepEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\VertexEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\SplineRouter.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\StraightLineEdges.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\TightLooseCouple.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\ActiveDiagonalComparerWithRay.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\ActiveEdgeComparerWithRay.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\BimodalSequence.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\Diagonal.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\InteractiveTangentVisibilityGraphCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\LineSweeperBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\ObstacleSideComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\PointVisibilityCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\Polygon.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\PortObstacleEvent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\SegmentBase.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\Stem.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\StemStartPointComparer.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\Tangent.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\TangentPair.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\TangentVisibilityGraphCalculator.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\TollFreeVisibilityEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\UnimodalSequence.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\VisibilityEdge.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\VisibilityGraph.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\VisibilityKind.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Visibility\VisibilityVertex.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\MSAGL\ValidateArg.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\NaughtyAttributes\Scripts\Core\DrawConditionAttributes\DrawConditionAttribute.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\NaughtyAttributes\Scripts\Core\DrawConditionAttributes\HideIfAttribute.cs" />
|
||||
<Compile Include="Assets\Scripts\NIH\NaughtyAttributes\Scripts\Core\DrawConditionAttributes\ShowIfAttribute.cs" />
|
||||
|
|
@ -511,6 +1021,7 @@
|
|||
<Compile Include="Assets\Scripts\Prototype.cs" />
|
||||
<Compile Include="Assets\Scripts\StrategyGameManager.cs" />
|
||||
<Compile Include="Assets\Scripts\TechTreeTest.cs" />
|
||||
<Compile Include="Assets\Scripts\TechTreeTestMsagl.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\BackgroundRenderer.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ClickableCollider.cs" />
|
||||
<Compile Include="Assets\Scripts\UI\ClickCatcher.cs" />
|
||||
|
|
@ -793,6 +1304,9 @@
|
|||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -817,9 +1331,6 @@
|
|||
<Reference Include="Grpc.Core.Api">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph">
|
||||
<HintPath>C:/Users/rwvens/Documents/GitHub/Aetheria-Economy/Assets/Plugins/QuickGraph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib">
|
||||
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.17f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
BIN
Assets/Resources/Elysium.asset
(Stored with Git LFS)
BIN
Assets/Resources/Elysium.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -7880,7 +7880,7 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 435654366}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0ae6f9307731b8f469a018c69d95d2ba, type: 3}
|
||||
m_Name:
|
||||
|
|
@ -11412,12 +11412,12 @@ PrefabInstance:
|
|||
- target: {fileID: 3856099931455214244, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Zone
|
||||
value: Sector
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_text
|
||||
value: Zone
|
||||
value: Sector
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
|
|
@ -11427,7 +11427,7 @@ PrefabInstance:
|
|||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_textInfo.characterCount
|
||||
value: 4
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
|
|
@ -11449,6 +11449,11 @@ PrefabInstance:
|
|||
propertyPath: m_textInfo.pageCount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_subTextObjects.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 105783976}
|
||||
- target: {fileID: 5318229203699776728, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
|
@ -11562,7 +11567,7 @@ PrefabInstance:
|
|||
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 68.3
|
||||
value: 78.765
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
|
|
@ -14296,6 +14301,7 @@ GameObject:
|
|||
- component: {fileID: 712278634}
|
||||
- component: {fileID: 712278633}
|
||||
- component: {fileID: 712278632}
|
||||
- component: {fileID: 712278635}
|
||||
m_Layer: 0
|
||||
m_Name: Tech View
|
||||
m_TagString: Untagged
|
||||
|
|
@ -14310,7 +14316,7 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 712278631}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6270ad993ac7b944786c936b7b058263, type: 3}
|
||||
m_Name:
|
||||
|
|
@ -14322,24 +14328,28 @@ MonoBehaviour:
|
|||
RadialLink: {fileID: 1417816149}
|
||||
Arrow: {fileID: 1083812776}
|
||||
Algorithm: 1
|
||||
TechCount: 1000
|
||||
SeedTechs: 15
|
||||
RollingWindowSize: 50
|
||||
TechCount: 200
|
||||
SeedTechs: 10
|
||||
RollingWindowSize: 20
|
||||
EliminateIslands: 0
|
||||
DisconnectedMultiplier: 2
|
||||
MultipleDependencies: 0
|
||||
MultipleDependencyProbability: 0.5
|
||||
MaxDependencyDistance: 4
|
||||
MaxDependencyTierDifference: 2
|
||||
DisconnectedMultiplier: 4
|
||||
K: 0.25
|
||||
LengthFactor: 1
|
||||
Iterations: 100
|
||||
LengthFactor: 2
|
||||
Iterations: 1000
|
||||
LayerDistance: 1
|
||||
VertexDistance: 0.1
|
||||
VertexDistance: 1
|
||||
WidthPerHeight: 1
|
||||
PositionMode: -1
|
||||
Radial: 1
|
||||
MinimizeEdgeLength: 0
|
||||
OptimizeWidth: 0
|
||||
MinimizeEdgeLength: 1
|
||||
OptimizeWidth: 1
|
||||
Sections: 360
|
||||
PaddingRadians: 3.14
|
||||
StartTier: 10
|
||||
StartTier: 4
|
||||
Scale: 2
|
||||
LinkPoints: 32
|
||||
LinkDepth: 5
|
||||
|
|
@ -14347,7 +14357,7 @@ MonoBehaviour:
|
|||
RingDepth: 6
|
||||
ArrowDepth: 3
|
||||
Saturation: 0.95
|
||||
HueMin: 0.5
|
||||
HueMin: 0
|
||||
HueMax: 1
|
||||
Brightness: 1
|
||||
RingInnerSaturation: 1
|
||||
|
|
@ -14394,6 +14404,56 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &712278635
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 712278631}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d47bb1c8e9ce08e41877db523d91a2f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
IconsPath: Sprites/Icons/Tech
|
||||
Ring: {fileID: 680383218}
|
||||
Tech: {fileID: 586612708}
|
||||
RadialLink: {fileID: 1417816149}
|
||||
Arrow: {fileID: 1083812776}
|
||||
TechCount: 500
|
||||
SeedTechs: 15
|
||||
RollingWindowSize: 100
|
||||
Radial: 1
|
||||
MultipleDependencyProbability: 0.15
|
||||
DependencyDepth: 2
|
||||
DependencyAncestorDepth: 4
|
||||
PackingMethod: 0
|
||||
Sections: 360
|
||||
PaddingRadians: 3.14
|
||||
StartTier: 12
|
||||
Scale: 2
|
||||
LinkPoints: 16
|
||||
LinkDepth: 5
|
||||
LinkTargetDistance: 0.75
|
||||
RingDepth: 6
|
||||
ArrowDepth: 3
|
||||
LayerDistance: 1.25
|
||||
Saturation: 0.95
|
||||
HueMin: 0
|
||||
HueMax: 1
|
||||
Brightness: 1
|
||||
RingInnerSaturation: 1
|
||||
RingOuterSaturation: 0.25
|
||||
RingInnerBrightness: 1
|
||||
RingOuterBrightness: 0.25
|
||||
RingColorKeys: 8
|
||||
FillOpacity: 0.3
|
||||
GlowOpacity: 0.6
|
||||
TechFillMaterial: {fileID: 2100000, guid: c3c13ba00125fdf4c92bd96210dc7230, type: 2}
|
||||
TechGlowMaterial: {fileID: 2100000, guid: 1426b25e088759647b77658321197be7, type: 2}
|
||||
TechArrowMaterial: {fileID: 2100000, guid: 2a2ec810cb24ddb4d869e73fe8a1510a, type: 2}
|
||||
TechLinkMaterial: {fileID: 2100000, guid: 67e23cda35beab546a57003dd2d33de1, type: 2}
|
||||
--- !u!1 &716116810
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -22522,7 +22582,7 @@ MonoBehaviour:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1126386499}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1c1faf0a46b9cf24498cd5ec93c34c71, type: 3}
|
||||
m_Name:
|
||||
|
|
@ -38510,6 +38570,11 @@ PrefabInstance:
|
|||
propertyPath: m_textInfo.pageCount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_subTextObjects.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 426675036}
|
||||
- target: {fileID: 5318229203699776728, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
|
@ -39972,6 +40037,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 1941419274}
|
||||
- component: {fileID: 1941419275}
|
||||
- component: {fileID: 1941419276}
|
||||
m_Layer: 0
|
||||
m_Name: Link
|
||||
m_TagString: Untagged
|
||||
|
|
@ -40006,6 +40072,19 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1941419276
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1941419273}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d54298fa75eb6304489e19a84af3413f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Icon: {fileID: 1813193646}
|
||||
--- !u!1 &1944537660
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -43547,9 +43626,7 @@ PrefabInstance:
|
|||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_text
|
||||
value: 'Corporation
|
||||
|
||||
'
|
||||
value: Corporation
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
|
|
@ -43559,7 +43636,7 @@ PrefabInstance:
|
|||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_textInfo.characterCount
|
||||
value: 12
|
||||
value: 11
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
|
|
@ -43581,6 +43658,16 @@ PrefabInstance:
|
|||
propertyPath: m_subTextObjects.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 650897775}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_textInfo.lineCount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4750078953547169287, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_textInfo.pageCount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5318229203699776728, guid: b93e36d73a071274d8e9225e077ce92a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ public class DatabaseInspector : EditorWindow
|
|||
else if (type == typeof(Dictionary<Guid, int>))
|
||||
{
|
||||
var dict = (Dictionary<Guid, int>) field.GetValue(obj);
|
||||
Inspect(field.Name.SplitCamelCase(), ref dict);
|
||||
Inspect(field.Name.SplitCamelCase(), ref dict, link.EntryType);
|
||||
}
|
||||
else if (type == typeof(Dictionary<Guid, float>))
|
||||
{
|
||||
|
|
@ -611,7 +611,7 @@ public class DatabaseInspector : EditorWindow
|
|||
return value;
|
||||
}
|
||||
|
||||
public void Inspect(string label, ref Dictionary<Guid,int> value)
|
||||
public void Inspect(string label, ref Dictionary<Guid,int> value, Type referenceType)
|
||||
{
|
||||
Space();
|
||||
LabelField(label, EditorStyles.boldLabel);
|
||||
|
|
@ -629,7 +629,11 @@ public class DatabaseInspector : EditorWindow
|
|||
{
|
||||
using (var h = new HorizontalScope(_list.ListItemStyle))
|
||||
{
|
||||
GUILayout.Label(DatabaseCache.Get<ItemData>(ingredient.Key).Name);
|
||||
var entry = DatabaseCache.Get(ingredient.Key);
|
||||
if(entry is INamedEntry named)
|
||||
GUILayout.Label(named.EntryName);
|
||||
else GUILayout.Label(entry.ID.ToString());
|
||||
|
||||
value[ingredient.Key] = DelayedIntField(value[ingredient.Key], GUILayout.Width(50));
|
||||
|
||||
var rect = GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
|
||||
|
|
@ -641,15 +645,18 @@ public class DatabaseInspector : EditorWindow
|
|||
|
||||
if (v.rect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
var dragData = DragAndDrop.GetGenericData("Item");
|
||||
var isId = dragData is Guid guid;
|
||||
var dragEntry = isId ? DatabaseCache.Get(guid) : null;
|
||||
var correctType = referenceType.IsInstanceOfType(dragEntry);
|
||||
if(Event.current.type == EventType.DragUpdated)
|
||||
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
|
||||
DragAndDrop.visualMode = correctType ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
|
||||
else if(Event.current.type == EventType.DragPerform)
|
||||
{
|
||||
var guid = DragAndDrop.GetGenericData("Item");
|
||||
if (guid is Guid)
|
||||
if (isId && correctType)
|
||||
{
|
||||
DragAndDrop.AcceptDrag();
|
||||
value[(Guid) guid] = 1;
|
||||
value[guid] = 1;
|
||||
GUI.changed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,8 @@ public class DatabaseListView : EditorWindow
|
|||
var result = await R
|
||||
.Db("Aetheria")
|
||||
.Table(table)
|
||||
.Update(entry)
|
||||
.Get(entry.ID)
|
||||
.Replace(entry)
|
||||
.RunAsync(_connection);
|
||||
Debug.Log($"Uploaded entry to RethinkDB: {entry.ID} result: {result}");
|
||||
};
|
||||
|
|
|
|||
8
Assets/Scripts/NIH/MSAGL.meta
Normal file
8
Assets/Scripts/NIH/MSAGL.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a80bb5b7ce4059d40a0eddd80b4b4ae5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/NIH/MSAGL/AutomaticGraphLayout.csproj
Normal file
17
Assets/Scripts/NIH/MSAGL/AutomaticGraphLayout.csproj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<DefineConstants>PERSISTENCE;REPORTING</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>PERSISTENCE;REPORTING;TEST_MSAGL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="AutomaticGraphLayout.nuspec" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 40dcc7efbe87de246a2a5146c5128222
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/NIH/MSAGL/AutomaticGraphLayout.nuspec
Normal file
24
Assets/Scripts/NIH/MSAGL/AutomaticGraphLayout.nuspec
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<package>
|
||||
<metadata>
|
||||
<id>AutomaticGraphLayout</id>
|
||||
<version>1.1.4</version>
|
||||
<authors>paulovila</authors>
|
||||
<owners>Microsoft</owners>
|
||||
<licenseUrl>https://github.com/Microsoft/automatic-graph-layout/blob/master/LICENSE</licenseUrl>
|
||||
<projectUrl>https://github.com/Microsoft/automatic-graph-layout</projectUrl>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>This .NET asssembly contains the core MSAGL layout functionality. Use this library if you just want MSAGL to perform the layout only and afterwards you will use a separate tool to perform the rendering and visalization.</description>
|
||||
<releaseNotes>
|
||||
</releaseNotes>
|
||||
<copyright>Copyright © Microsoft Corporation</copyright>
|
||||
<language>en-US</language>
|
||||
<tags>MSAGL Graph Layout</tags>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<frameworkAssemblies>
|
||||
</frameworkAssemblies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="./bin/release/netstandard2.0/AutomaticGraphLayout.dll" target="lib/netstandard2.0" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 64a9bda5ccebb9e45b4c45a2f2d7d9da
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3f9e18906f0e744eb7e5b695467d1cc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
305
Assets/Scripts/NIH/MSAGL/Core/AlgorithmBase.cs
Normal file
305
Assets/Scripts/NIH/MSAGL/Core/AlgorithmBase.cs
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
using System;
|
||||
namespace Microsoft.Msagl.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for algorithms that are cancelable and report progress
|
||||
/// </summary>
|
||||
public abstract class AlgorithmBase
|
||||
{
|
||||
#region Running
|
||||
/// <summary>
|
||||
/// Runs the algorithm.
|
||||
/// Inherits any preexisting cancel tokens.
|
||||
/// </summary>
|
||||
public void Run()
|
||||
{
|
||||
this.progressRatio = 0;
|
||||
this.localStepCount = 0;
|
||||
|
||||
this.cancelToken = threadStaticCancelToken;
|
||||
this.ThrowIfCanceled();
|
||||
|
||||
this.ProgressSteps(0); // Initial progress
|
||||
|
||||
this.RunInternal();
|
||||
|
||||
if (!this.IsCanceled)
|
||||
{
|
||||
this.ProgressComplete();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the algorithm, setting up the cancel token and reverting to the old cancel token before finishing
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "cancelToken")]
|
||||
public void Run(CancelToken cancelToken)
|
||||
{
|
||||
this.progressRatio = 0;
|
||||
this.localStepCount = 0;
|
||||
|
||||
CancelToken oldCancelToken = this.SetCancelToken(cancelToken);
|
||||
|
||||
try
|
||||
{
|
||||
this.ProgressSteps(0); // Initial progress
|
||||
|
||||
this.RunInternal();
|
||||
|
||||
if (!this.IsCanceled)
|
||||
{
|
||||
this.ProgressComplete();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
threadStaticCancelToken = oldCancelToken;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the actual algorithm.
|
||||
/// </summary>
|
||||
protected abstract void RunInternal();
|
||||
|
||||
#endregion Running
|
||||
|
||||
#region Cancel
|
||||
|
||||
/// <summary>
|
||||
/// Set the cancel token. Returns the old cancel token, in case you need to revert at some stage.
|
||||
/// </summary>
|
||||
/// <param name="cancelToken">new cancel token</param>
|
||||
/// <returns>old cancel token</returns>
|
||||
public CancelToken SetCancelToken(CancelToken cancelToken)
|
||||
{
|
||||
this.cancelToken = cancelToken;
|
||||
this.ThrowIfCanceled();
|
||||
CancelToken oldCancelToken = threadStaticCancelToken;
|
||||
threadStaticCancelToken = cancelToken;
|
||||
return oldCancelToken;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the algorithm that is currently in progress.
|
||||
/// </summary>
|
||||
public void Cancel()
|
||||
{
|
||||
if (this.cancelToken != null)
|
||||
{
|
||||
this.cancelToken.Canceled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the algorithm has been canceled.
|
||||
/// </summary>
|
||||
public bool IsCanceled
|
||||
{
|
||||
get { return this.cancelToken != null && this.cancelToken.Canceled; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an OperationCanceledException if the current algorithm has been canceled.
|
||||
/// </summary>
|
||||
protected void ThrowIfCanceled()
|
||||
{
|
||||
if (this.cancelToken != null)
|
||||
{
|
||||
this.cancelToken.ThrowIfCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current cancel token - one per thread, cached by cancelToken, below.
|
||||
/// </summary>
|
||||
[ThreadStatic]
|
||||
private static CancelToken threadStaticCancelToken;
|
||||
|
||||
/// <summary>
|
||||
/// ThreadStatic field above has about 10X the lookup cost of a local field, so we
|
||||
/// cache its value in cancelToken
|
||||
/// </summary>
|
||||
private volatile CancelToken cancelToken;
|
||||
|
||||
/// <summary>
|
||||
/// the current cancel token
|
||||
/// </summary>
|
||||
protected CancelToken CancelToken { get { return cancelToken; } }
|
||||
|
||||
#endregion Cancel
|
||||
|
||||
#region Progress
|
||||
|
||||
/// <summary>
|
||||
/// notifies whenever progress is made by the algorithm. ProgressChangedEventArgs report
|
||||
/// 0 < progressRatio <= 1
|
||||
/// </summary>
|
||||
public event EventHandler<ProgressChangedEventArgs> ProgressChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Total progress to date
|
||||
/// </summary>
|
||||
private double progressRatio = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Step size to increment progressRatio when ProgressStep is called
|
||||
/// </summary>
|
||||
private double localProgressStepSize = LocalProgressStepSizeDefault;
|
||||
|
||||
/// <summary>
|
||||
/// True if the progress step count has been specified using StartListenToLocalProgress.
|
||||
/// </summary>
|
||||
private bool localProgressSpecified = false;
|
||||
|
||||
/// <summary>
|
||||
/// The number of times ProgressStep has been called.
|
||||
/// </summary>
|
||||
private int localStepCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// When running sub-algorithms this gives the progressRatio start point
|
||||
/// </summary>
|
||||
private double stageStartRatio = 0;
|
||||
|
||||
/// <summary>
|
||||
/// When running sub-algorithms this gives the progressRatio end point
|
||||
/// </summary>
|
||||
private double stageEndRatio = 1;
|
||||
|
||||
/// <summary>
|
||||
/// if StartListenToLocalProgress is not used to setup step size the following will be the
|
||||
/// (rather arbitrary) default.
|
||||
/// </summary>
|
||||
private const double LocalProgressStepSizeDefault = 0.05;
|
||||
|
||||
/// <summary>
|
||||
/// setup to start listening to ProgressStep() invocations from this algorithm.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
|
||||
protected void StartListenToLocalProgress(int expectedSteps, double stageRatio = 1)
|
||||
{
|
||||
localProgressStepSize = stageRatio / Math.Max(1, expectedSteps); // at least 1, to prevent divide by 0
|
||||
localProgressSpecified = true;
|
||||
localStepCount = 0;
|
||||
stageStartRatio = 0;
|
||||
stageEndRatio = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When starting a sub-algorithm start listening to its progress, transforming
|
||||
/// the progressRatio it reports (between 0 and 1) to between progressRatio and progressRatio+stageRatio
|
||||
/// </summary>
|
||||
/// <param name="childAlgorithm">The child algorithm.</param>
|
||||
/// <param name="stageRatio">The fraction of time the child algorithm will take of the parent algorithm.</param>
|
||||
protected void StartListenToProgress(AlgorithmBase childAlgorithm, double stageRatio)
|
||||
{
|
||||
ValidateArg.IsNotNull(childAlgorithm, "childAlgorithm");
|
||||
childAlgorithm.ProgressChanged += NotifyProgressChanged;
|
||||
stageStartRatio = progressRatio;
|
||||
stageEndRatio = progressRatio + stageRatio;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the sub-algorithm is completed this reverts us to listening to local progress
|
||||
/// </summary>
|
||||
/// <param name="childAlgorithm"></param>
|
||||
protected void StopListenToProgress(AlgorithmBase childAlgorithm)
|
||||
{
|
||||
ValidateArg.IsNotNull(childAlgorithm, "childAlgorithm");
|
||||
childAlgorithm.ProgressChanged -= NotifyProgressChanged;
|
||||
progressRatio = stageEndRatio;
|
||||
stageStartRatio = 0;
|
||||
stageEndRatio = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the child algorithm and listens for progress changes.
|
||||
/// </summary>
|
||||
protected void RunChildAlgorithm(AlgorithmBase childAlgorithm, double stageRatio)
|
||||
{
|
||||
ValidateArg.IsNotNull(childAlgorithm, "childAlgorithm");
|
||||
try
|
||||
{
|
||||
StartListenToProgress(childAlgorithm, stageRatio);
|
||||
childAlgorithm.Run();
|
||||
}
|
||||
finally
|
||||
{
|
||||
StopListenToProgress(childAlgorithm);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this to report 100% progress if your algorithm finishes early
|
||||
/// </summary>
|
||||
protected void ProgressComplete()
|
||||
{
|
||||
ThrowIfCanceled();
|
||||
if (progressRatio != 1.0)
|
||||
{
|
||||
this.progressRatio = 1.0;
|
||||
this.NotifyProgressChanged(this, new ProgressChangedEventArgs(progressRatio));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for cancel, increases progress, and notifies any listeners of progress.
|
||||
/// Call whenever the algorithm makes progress.
|
||||
/// </summary>
|
||||
protected void ProgressStep()
|
||||
{
|
||||
this.ProgressSteps(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for cancel, increases progress, and notifies any listeners of progress.
|
||||
/// Call whenever the algorithm makes progress.
|
||||
/// </summary>
|
||||
protected void ProgressSteps(int stepsTaken)
|
||||
{
|
||||
ThrowIfCanceled();
|
||||
localStepCount += stepsTaken;
|
||||
|
||||
if (localProgressSpecified)
|
||||
{
|
||||
progressRatio = progressRatio + (localProgressStepSize * stepsTaken);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no local step count was specified, use a progress bar
|
||||
// which never reaches 100% and gets slower as time goes on.
|
||||
// It approaches 85% (instead of 100%) so it never appears to be completed.
|
||||
const double Limit = 0.85;
|
||||
const double HalfLife = 50.0; // 50 was chosen as the default since it represents one ProgressStep per percentage at the start (i.e. 50 steps reach 50%)
|
||||
const double Numerator = Limit * HalfLife;
|
||||
progressRatio = Limit - (Numerator / (HalfLife + localStepCount));
|
||||
}
|
||||
|
||||
// Round up to 100% if the sum of steps doesn't quite reach it.
|
||||
if (Math.Round(progressRatio, 6) == 1.0)
|
||||
{
|
||||
progressRatio = 1.0;
|
||||
}
|
||||
|
||||
this.NotifyProgressChanged(this, new ProgressChangedEventArgs(progressRatio));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// notifies whenever progress is made by the algorithm. ProgressChangedEventArgs report
|
||||
/// 0 < progressRatio <= 1. Progress from sub-algorithms are converted to the correct ratio
|
||||
/// of the local progress
|
||||
/// </summary>
|
||||
private void NotifyProgressChanged(object sender, ProgressChangedEventArgs args)
|
||||
{
|
||||
if (ProgressChanged != null)
|
||||
{
|
||||
double stageRatio = stageEndRatio - stageStartRatio;
|
||||
double stageProgress = stageRatio * args.RatioComplete;
|
||||
ProgressChanged(this, new ProgressChangedEventArgs(stageStartRatio + stageProgress));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Progress Logic
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/AlgorithmBase.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/AlgorithmBase.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8f0e154226de7c44d93b02694d82946a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Assets/Scripts/NIH/MSAGL/Core/CancelToken.cs
Normal file
57
Assets/Scripts/NIH/MSAGL/Core/CancelToken.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
|
||||
#if PPC
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
|
||||
namespace Microsoft.Msagl.Core {
|
||||
|
||||
/// <summary>
|
||||
/// a place holder for the cancelled flag
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
|
||||
public class CancelToken {
|
||||
|
||||
volatile bool canceled;
|
||||
|
||||
/// <summary>
|
||||
/// Set this flag to true when you want to cancel the layout.
|
||||
/// </summary>
|
||||
public bool Canceled {
|
||||
get { return canceled; }
|
||||
set {
|
||||
canceled = value;
|
||||
#if PPC
|
||||
if (canceled)
|
||||
{
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// throws is the layout has been cancelled
|
||||
/// </summary>
|
||||
public void ThrowIfCanceled()
|
||||
{
|
||||
#if PPC
|
||||
cancellationTokenSource.Token.ThrowIfCancellationRequested();
|
||||
#endif
|
||||
if (this.Canceled)
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
|
||||
#if PPC
|
||||
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
/// <summary>
|
||||
/// Pass this cancelation token for use in cancellable parallel for-each operations
|
||||
/// </summary>
|
||||
public CancellationToken CancellationToken
|
||||
{
|
||||
get { return cancellationTokenSource.Token; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/CancelToken.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/CancelToken.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 838ad0009928e604e94e5580a15ada26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core/DataStructures.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core/DataStructures.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 500f7d7386669de4abbd734ecd9ae3c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A priority queue based on the binary heap algorithm
|
||||
/// </summary>
|
||||
internal class BinaryHeapPriorityQueue {
|
||||
//indexing for A starts from 1
|
||||
|
||||
readonly int[] _heap;//array of heap elements
|
||||
readonly int[] _reverse_heap; // the map from [0,..., n-1] to their places in heap
|
||||
/// <summary>
|
||||
/// the array of priorities
|
||||
/// </summary>
|
||||
readonly double[] _priors;
|
||||
internal int Count { get { return heapSize; } }
|
||||
int heapSize;
|
||||
/// <summary>
|
||||
/// the constructor
|
||||
/// we suppose that all integers inserted into the queue will be less then n
|
||||
/// </summary>
|
||||
/// <param name="n">it is the number of different integers that will be inserted into the queue </param>
|
||||
internal BinaryHeapPriorityQueue(int n) {
|
||||
_priors = new double[n];
|
||||
_heap = new int[n + 1];//because indexing for A starts from 1
|
||||
_reverse_heap = new int[n];
|
||||
}
|
||||
|
||||
|
||||
void SwapWithParent(int i) {
|
||||
int parent = _heap[i >> 1];
|
||||
PutAtI(i >> 1, _heap[i]);
|
||||
PutAtI(i, parent);
|
||||
}
|
||||
|
||||
internal void Enqueue(int o, double priority) {
|
||||
heapSize++;
|
||||
int i = heapSize;
|
||||
_priors[o] = priority;
|
||||
PutAtI(i, o);
|
||||
while (i > 1 && _priors[_heap[i >> 1]] > priority) {
|
||||
SwapWithParent(i);
|
||||
i >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void PutAtI(int i, int h) {
|
||||
_heap[i] = h;
|
||||
_reverse_heap[h] = i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return the first element of the queue and removes it from the queue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal int Dequeue() {
|
||||
if (heapSize == 0)
|
||||
throw new InvalidOperationException();
|
||||
int ret = _heap[1];
|
||||
if (heapSize > 1)
|
||||
{
|
||||
PutAtI(1, _heap[heapSize]);
|
||||
int i = 1;
|
||||
while (true)
|
||||
{
|
||||
int smallest = i;
|
||||
int l = i << 1;
|
||||
|
||||
if (l <= heapSize && _priors[_heap[l]] <_priors[ _heap[i]])
|
||||
smallest = l;
|
||||
|
||||
int r = l + 1;
|
||||
|
||||
if (r <= heapSize && _priors[_heap[r]] < _priors[_heap[smallest]])
|
||||
smallest = r;
|
||||
|
||||
if (smallest != i)
|
||||
SwapWithParent(smallest);
|
||||
else
|
||||
break;
|
||||
|
||||
i = smallest;
|
||||
|
||||
}
|
||||
}
|
||||
heapSize--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the object priority to c
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal void DecreasePriority(int o, double newPriority) {
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("delcrease "+ o.ToString()+" to "+ newPriority.ToString());
|
||||
|
||||
_priors[o] = newPriority;
|
||||
int i = _reverse_heap[o];
|
||||
while (i > 1) {
|
||||
if (_priors[_heap[i]] < _priors[_heap[i >> 1]])
|
||||
SwapWithParent(i);
|
||||
else
|
||||
break;
|
||||
i >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void Test() {
|
||||
var q = new BinaryHeapPriorityQueue(10);
|
||||
q.Enqueue(2, 2);
|
||||
q.Enqueue(1, 1);
|
||||
q.Enqueue(9, 9);
|
||||
q.Enqueue(8, 8);
|
||||
q.Enqueue(5, 5);
|
||||
q.Enqueue(3, 3);
|
||||
q.Enqueue(4, 4);
|
||||
q.Enqueue(7, 7);
|
||||
q.Enqueue(6, 6);
|
||||
q.Enqueue(0, 0);
|
||||
for (int i = 0; i < 10; i++)
|
||||
Console.WriteLine(q.Dequeue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a62428fef9112304eb0439efc749dc37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// A priority queue based on the binary heap algorithm.
|
||||
/// This class needs a comparer object to compare elements of the queue.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
internal class BinaryHeapWithComparer<T> {
|
||||
const int initialHeapCapacity = 16;
|
||||
T[] A; //array of the heap elems starting at A[1]
|
||||
|
||||
int heapSize = 0;
|
||||
|
||||
internal void Enqueue(T element) {
|
||||
if (heapSize == A.Length - 1) {
|
||||
var newA = new T[A.Length*2];
|
||||
Array.Copy(A, 1, newA, 1, heapSize);
|
||||
A = newA;
|
||||
}
|
||||
|
||||
int i = heapSize + 1;
|
||||
A[i] = element;
|
||||
heapSize++;
|
||||
int j = i >> 1;
|
||||
T parent, son;
|
||||
while (i > 1 && Less(son = A[i], parent = A[j])) {
|
||||
A[j] = son;
|
||||
A[i] = parent;
|
||||
i = j;
|
||||
j = i >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal T Dequeue() {
|
||||
if (heapSize < 1)
|
||||
throw new InvalidOperationException();
|
||||
T ret = A[1];
|
||||
|
||||
T candidate = A[heapSize];
|
||||
|
||||
heapSize--;
|
||||
|
||||
ChangeMinimum(candidate);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal void ChangeMinimum(T candidate) {
|
||||
A[1] = candidate;
|
||||
|
||||
int j = 1;
|
||||
int i = 2;
|
||||
bool done = false;
|
||||
while (i < heapSize && !done) {
|
||||
done = true;
|
||||
//both sons exist
|
||||
T leftSon = A[i];
|
||||
T rigthSon = A[i + 1];
|
||||
int compareResult = comparer.Compare(leftSon, rigthSon);
|
||||
if (compareResult < 0) {
|
||||
//left son is the smallest
|
||||
if (comparer.Compare(leftSon, candidate) < 0) {
|
||||
A[j] = leftSon;
|
||||
A[i] = candidate;
|
||||
done = false;
|
||||
j = i;
|
||||
i = j << 1;
|
||||
}
|
||||
} else {
|
||||
//right son in not the greatest
|
||||
if (comparer.Compare(rigthSon, candidate) < 0) {
|
||||
A[j] = rigthSon;
|
||||
A[i + 1] = candidate;
|
||||
done = false;
|
||||
j = i + 1;
|
||||
i = j << 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == heapSize) {
|
||||
//can we do one more step:
|
||||
T leftSon = A[i];
|
||||
if (comparer.Compare(leftSon, candidate) < 0) {
|
||||
A[j] = leftSon;
|
||||
A[i] = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal int Count {
|
||||
get { return heapSize; }
|
||||
}
|
||||
|
||||
internal bool Less(T a, T b) {
|
||||
return comparer.Compare(a, b) < 0;
|
||||
}
|
||||
|
||||
IComparer<T> comparer;
|
||||
|
||||
internal BinaryHeapWithComparer(IComparer<T> comparer) {
|
||||
A = new T[initialHeapCapacity + 1];
|
||||
this.comparer = comparer;
|
||||
}
|
||||
|
||||
#if TEST_MSAGL
|
||||
|
||||
public override string ToString() {
|
||||
int i = 1;
|
||||
return "{" + Print(i) + "}";
|
||||
}
|
||||
|
||||
string Print(int i) {
|
||||
if (2*i + 1 <= heapSize)
|
||||
return String.Format(CultureInfo.InvariantCulture, "({0}->{1},{2})", A[i], A[i*2], A[i*2 + 1]) +
|
||||
Print(i*2) + Print(i*2 + 1);
|
||||
if (2*i == heapSize)
|
||||
return String.Format(CultureInfo.InvariantCulture, "({0}->{1}", A[i], A[i*2]);
|
||||
if (i == heapSize && i == 1)
|
||||
return " " + A[i].ToString() + " ";
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public T GetMinimum() {
|
||||
return A[1];
|
||||
}
|
||||
|
||||
#if TEST_MSAGL
|
||||
//internal void UpdateMinimum() {
|
||||
// throw new NotImplementedException();
|
||||
//}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 78dc14a0e35a20145a57e0314da9ab9b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// various utilities for collections
|
||||
/// </summary>
|
||||
public class CollectionUtilities {
|
||||
/// <summary>
|
||||
/// Add value to dictionary
|
||||
/// </summary>
|
||||
internal static void AddToMap<TS, T, TC>(Dictionary<T, TC> dictionary, T key, TS value)
|
||||
where TC : ICollection<TS>, new() {
|
||||
TC tc;
|
||||
if (!dictionary.TryGetValue(key, out tc))
|
||||
dictionary[key] = tc = new TC();
|
||||
|
||||
tc.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove value from dictionary
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix", MessageId = "T"),
|
||||
SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S"),
|
||||
SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
|
||||
internal static void RemoveFromMap<TS, T, TC>(Dictionary<T, TC> dictionary, T key, TS value)
|
||||
where TC : ICollection<TS> {
|
||||
var tc = dictionary[key];
|
||||
tc.Remove(value);
|
||||
if (tc.Count == 0)
|
||||
dictionary.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6e8b582a3d0c32a41bc4eb7f0db98f96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,281 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A generic version priority queue based on the binary heap algorithm where
|
||||
/// the priority of each element is passed as a parameter.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
|
||||
public class GenericBinaryHeapPriorityQueue<T> : IEnumerable<T> {
|
||||
|
||||
const int InitialHeapCapacity = 16;
|
||||
|
||||
|
||||
//indexing for A starts from 1
|
||||
|
||||
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
//internal void Clear()
|
||||
//{
|
||||
// if(heapSize>0)
|
||||
// {
|
||||
// for(int i=0;i<cache.Length;i++)
|
||||
// this.cache[i]=null;
|
||||
|
||||
// heapSize=0;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
GenericHeapElement<T>[] A;//array of heap elements
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
/// <summary>
|
||||
/// it is a mapping from queue elements and their correspondent HeapElements
|
||||
/// </summary>
|
||||
readonly Dictionary<T, GenericHeapElement<T>> cache;
|
||||
internal int Count { get { return heapSize; } }
|
||||
int heapSize;
|
||||
|
||||
internal bool ContainsElement(T key) {
|
||||
return cache.ContainsKey(key);
|
||||
}
|
||||
|
||||
|
||||
internal GenericBinaryHeapPriorityQueue() {
|
||||
cache = new Dictionary<T, GenericHeapElement<T>>();
|
||||
A = new GenericHeapElement<T>[InitialHeapCapacity + 1];
|
||||
}
|
||||
|
||||
|
||||
void SwapWithParent(int i) {
|
||||
var parent = A[i >> 1];
|
||||
|
||||
PutAtI(i >> 1, A[i]);
|
||||
PutAtI(i, parent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal void Enqueue(T element, double priority) {
|
||||
if (heapSize == A.Length - 1) {
|
||||
var newA = new GenericHeapElement<T>[A.Length * 2];
|
||||
Array.Copy(A, 1, newA, 1, heapSize);
|
||||
A = newA;
|
||||
}
|
||||
|
||||
heapSize++;
|
||||
int i = heapSize;
|
||||
GenericHeapElement<T> h;
|
||||
|
||||
A[i] = cache[element] = h = new GenericHeapElement<T>(i, priority, element);
|
||||
while (i > 1 && A[i >> 1].priority.CompareTo(priority) > 0) {
|
||||
SwapWithParent(i);
|
||||
i >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsEmpty() {
|
||||
return heapSize == 0;
|
||||
}
|
||||
|
||||
void PutAtI(int i, GenericHeapElement<T> h) {
|
||||
A[i] = h;
|
||||
h.indexToA = i;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// return the first element of the queue without removing it
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
//internal int Peek() {
|
||||
// return A[1].v;
|
||||
//}
|
||||
|
||||
internal T Dequeue() {
|
||||
if (heapSize == 0)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
var ret = A[1].v;
|
||||
|
||||
MoveQueueOneStepForward(ret);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
internal T Dequeue(out double priority) {
|
||||
if (heapSize == 0) throw new InvalidOperationException();
|
||||
|
||||
var ret = A[1].v;
|
||||
priority = A[1].priority;
|
||||
MoveQueueOneStepForward(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MoveQueueOneStepForward(T ret) {
|
||||
cache.Remove(ret);
|
||||
PutAtI(1, A[heapSize]);
|
||||
int i = 1;
|
||||
while (true) {
|
||||
int smallest = i;
|
||||
int l = i << 1;
|
||||
|
||||
if (l <= heapSize && A[l].priority.CompareTo(A[i].priority) < 0)
|
||||
smallest = l;
|
||||
|
||||
int r = l + 1;
|
||||
|
||||
if (r <= heapSize && A[r].priority.CompareTo(A[smallest].priority) < 0)
|
||||
smallest = r;
|
||||
|
||||
if (smallest != i)
|
||||
SwapWithParent(smallest);
|
||||
else
|
||||
break;
|
||||
|
||||
i = smallest;
|
||||
|
||||
}
|
||||
|
||||
heapSize--;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the object priority to c
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal void DecreasePriority(T element, double newPriority)
|
||||
{
|
||||
GenericHeapElement<T> h;
|
||||
//ignore the element if it is not in the queue
|
||||
if (!cache.TryGetValue(element, out h)) return;
|
||||
|
||||
//var h = cache[element];
|
||||
h.priority = newPriority;
|
||||
int i = h.indexToA;
|
||||
while (i > 1) {
|
||||
if (A[i].priority.CompareTo(A[i >> 1].priority) < 0)
|
||||
SwapWithParent(i);
|
||||
else
|
||||
break;
|
||||
i >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
// public static void Test() {
|
||||
// Timer nm = new Timer();
|
||||
// var bound = 1000000;
|
||||
// nm.Start();
|
||||
// {
|
||||
// var q = new BinaryHeapPriorityQueue(bound + 1);
|
||||
// Random random = new Random();
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.Enqueue(i, random.NextDouble());
|
||||
// }
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.DecreasePriority(i, -random.NextDouble());
|
||||
// }
|
||||
//
|
||||
// while (q.IsEmpty() == false) {
|
||||
// q.Dequeue();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// nm.Stop();
|
||||
// Console.WriteLine(nm.Duration);
|
||||
// nm.Start();
|
||||
// {
|
||||
// var q = new GenericBinaryHeapPriorityQueue<int>();
|
||||
// Random random = new Random();
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.Enqueue(i, random.NextDouble());
|
||||
// }
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.DecreasePriority(i, -random.NextDouble());
|
||||
// }
|
||||
//
|
||||
// while (q.IsEmpty() == false) {
|
||||
// q.Dequeue();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// nm.Stop();
|
||||
// Console.WriteLine(nm.Duration);
|
||||
//}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void Test() {
|
||||
var q = new GenericBinaryHeapPriorityQueue<int>();
|
||||
q.Enqueue(2, 2);
|
||||
q.Enqueue(1, 1);
|
||||
q.Enqueue(9, 9);
|
||||
q.Enqueue(8, 8);
|
||||
q.Enqueue(5, 5);
|
||||
q.Enqueue(3, 3);
|
||||
q.Enqueue(4, 4);
|
||||
q.Enqueue(7, 7);
|
||||
q.Enqueue(6, 6);
|
||||
q.Enqueue(0, 0);
|
||||
|
||||
q.DecreasePriority(4, 2.5);
|
||||
|
||||
while (q.IsEmpty() == false)
|
||||
Console.WriteLine(q.Dequeue());
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// enumerator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerator<T> GetEnumerator() {
|
||||
for (int i = 1; i <= heapSize; i++)
|
||||
yield return A[i].v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="priority"></param>
|
||||
/// <returns></returns>
|
||||
public T Peek(out double priority) {
|
||||
if (Count == 0) {
|
||||
priority = 0.0;
|
||||
return default(T);
|
||||
}
|
||||
priority = A[1].priority;
|
||||
return A[1].v;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
for (int i = 1; i <= heapSize; i++)
|
||||
yield return A[i].v;
|
||||
}
|
||||
#if TEST_MSAGL
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
foreach (var i in this)
|
||||
sb.Append(i + ",");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e122f1c5e2b7ce4e91aa5792a19a862
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
// TODO: Move and expand the commented tests below into PriorityQueueTests unit tests for all 3 PQ classes.
|
||||
// TODO: Reduce duplication with GenericBinaryHeapPriorityQueue by breaking most functionality out into a
|
||||
// GenericBinaryHeapPriorityQueue<T, THeapElement> class and using THeapElement.ComparePriority, keeping only Enqueue
|
||||
// and DecreasePriority in the derived classes as these must know about timestamp.
|
||||
|
||||
/// <summary>
|
||||
/// A generic version priority queue based on the binary heap algorithm where
|
||||
/// the priority of each element is passed as a parameter and priority ties are broken by timestamp.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
|
||||
public class GenericBinaryHeapPriorityQueueWithTimestamp<T> : IEnumerable<T> {
|
||||
|
||||
const int InitialHeapCapacity = 16;
|
||||
|
||||
|
||||
//indexing for A starts from 1
|
||||
|
||||
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
//internal void Clear()
|
||||
//{
|
||||
// if(heapSize>0)
|
||||
// {
|
||||
// for(int i=0;i<cache.Length;i++)
|
||||
// this.cache[i]=null;
|
||||
|
||||
// heapSize=0;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
GenericHeapElementWithTimestamp<T>[] A;//array of heap elements
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
UInt64 timestamp;
|
||||
UInt64 NextTimestamp { get { return ++this.timestamp; } }
|
||||
|
||||
/// <summary>
|
||||
/// it is a mapping from queue elements and their correspondent HeapElements
|
||||
/// </summary>
|
||||
readonly Dictionary<T, GenericHeapElementWithTimestamp<T>> cache;
|
||||
internal int Count { get { return heapSize; } }
|
||||
int heapSize;
|
||||
|
||||
internal GenericBinaryHeapPriorityQueueWithTimestamp() {
|
||||
cache = new Dictionary<T, GenericHeapElementWithTimestamp<T>>();
|
||||
A = new GenericHeapElementWithTimestamp<T>[InitialHeapCapacity + 1];
|
||||
}
|
||||
|
||||
|
||||
void SwapWithParent(int i) {
|
||||
var parent = A[i >> 1];
|
||||
|
||||
PutAtI(i >> 1, A[i]);
|
||||
PutAtI(i, parent);
|
||||
}
|
||||
|
||||
internal void Enqueue(T element, double priority) {
|
||||
if (heapSize == A.Length - 1) {
|
||||
var newA = new GenericHeapElementWithTimestamp<T>[A.Length * 2];
|
||||
Array.Copy(A, 1, newA, 1, heapSize);
|
||||
A = newA;
|
||||
}
|
||||
|
||||
heapSize++;
|
||||
int i = heapSize;
|
||||
GenericHeapElementWithTimestamp<T> h;
|
||||
|
||||
A[i] = cache[element] = h = new GenericHeapElementWithTimestamp<T>(i, priority, element, this.NextTimestamp);
|
||||
while (i > 1 && A[i >> 1].ComparePriority(A[i]) > 0) {
|
||||
SwapWithParent(i);
|
||||
i >>= 1;
|
||||
}
|
||||
System.Diagnostics.Debug.Assert(A[i] == h);
|
||||
A[i] = h;
|
||||
|
||||
}
|
||||
|
||||
void PutAtI(int i, GenericHeapElementWithTimestamp<T> h) {
|
||||
A[i] = h;
|
||||
h.indexToA = i;
|
||||
}
|
||||
|
||||
#if TEST_MSAGL
|
||||
/// <summary>
|
||||
/// Gets the next element to be dequeued, without dequeueing it.
|
||||
/// </summary>
|
||||
internal T Peek() {
|
||||
if (heapSize == 0) {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
return A[1].v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timestamp of the next element to be dequeued, without dequeueing it.
|
||||
/// </summary>
|
||||
internal UInt64 PeekTimestamp() {
|
||||
if (heapSize == 0) {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
return A[1].Timestamp;
|
||||
}
|
||||
#endif // TEST_MSAGL
|
||||
|
||||
internal T Dequeue() {
|
||||
if (heapSize == 0)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
var ret = A[1].v;
|
||||
|
||||
MoveQueueOneStepForward(ret);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
void MoveQueueOneStepForward(T ret) {
|
||||
cache.Remove(ret);
|
||||
PutAtI(1, A[heapSize]);
|
||||
int i = 1;
|
||||
while (true) {
|
||||
int smallest = i;
|
||||
int l = i << 1;
|
||||
|
||||
if (l <= heapSize && A[l].ComparePriority(A[i]) < 0)
|
||||
smallest = l;
|
||||
|
||||
int r = l + 1;
|
||||
|
||||
if (r <= heapSize && A[r].ComparePriority(A[smallest]) < 0)
|
||||
smallest = r;
|
||||
|
||||
if (smallest != i)
|
||||
SwapWithParent(smallest);
|
||||
else
|
||||
break;
|
||||
|
||||
i = smallest;
|
||||
|
||||
}
|
||||
|
||||
heapSize--;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the object priority to c
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal void DecreasePriority(T element, double newPriority)
|
||||
{
|
||||
GenericHeapElementWithTimestamp<T> h;
|
||||
//ignore the element if it is not in the queue
|
||||
if (!cache.TryGetValue(element, out h)) return;
|
||||
|
||||
//var h = cache[element];
|
||||
h.priority = newPriority;
|
||||
int i = h.indexToA;
|
||||
while (i > 1) {
|
||||
if (A[i].ComparePriority(A[i >> 1]) < 0)
|
||||
SwapWithParent(i);
|
||||
else
|
||||
break;
|
||||
i >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
// public static void Test() {
|
||||
// Timer nm = new Timer();
|
||||
// var bound = 1000000;
|
||||
// nm.Start();
|
||||
// {
|
||||
// var q = new BinaryHeapPriorityQueue(bound + 1);
|
||||
// Random random = new Random();
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.Enqueue(i, random.NextDouble());
|
||||
// }
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.DecreasePriority(i, -random.NextDouble());
|
||||
// }
|
||||
//
|
||||
// while (q.IsEmpty() == false) {
|
||||
// q.Dequeue();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// nm.Stop();
|
||||
// Console.WriteLine(nm.Duration);
|
||||
// nm.Start();
|
||||
// {
|
||||
// var q = new GenericBinaryHeapPriorityQueue<int>();
|
||||
// Random random = new Random();
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.Enqueue(i, random.NextDouble());
|
||||
// }
|
||||
// for (int i = 0; i < bound; i++) {
|
||||
// q.DecreasePriority(i, -random.NextDouble());
|
||||
// }
|
||||
//
|
||||
// while (q.IsEmpty() == false) {
|
||||
// q.Dequeue();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// nm.Stop();
|
||||
// Console.WriteLine(nm.Duration);
|
||||
//}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
public static void Test() {
|
||||
var q = new GenericBinaryHeapPriorityQueue<int>();
|
||||
q.Enqueue(2, 2);
|
||||
q.Enqueue(1, 1);
|
||||
q.Enqueue(9, 9);
|
||||
q.Enqueue(8, 8);
|
||||
q.Enqueue(5, 5);
|
||||
q.Enqueue(3, 3);
|
||||
q.Enqueue(4, 4);
|
||||
q.Enqueue(7, 7);
|
||||
q.Enqueue(6, 6);
|
||||
q.Enqueue(0, 0);
|
||||
|
||||
q.DecreasePriority(4, 2.5);
|
||||
|
||||
while (q.IsEmpty() == false)
|
||||
Console.WriteLine(q.Dequeue());
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// enumerator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerator<T> GetEnumerator() {
|
||||
for (int i = 1; i <= heapSize; i++)
|
||||
yield return A[i].v;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
for (int i = 1; i <= heapSize; i++)
|
||||
yield return A[i].v;
|
||||
}
|
||||
#if TEST_MSAGL
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
var sb=new StringBuilder();
|
||||
foreach (var i in this)
|
||||
sb.Append(i + ",");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a84290ac5fe1bdb4f9bd404eb9dfc396
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
class GenericHeapElement<T> {
|
||||
internal int indexToA;
|
||||
internal double priority;
|
||||
internal T v;//value
|
||||
internal GenericHeapElement(int index, double priority, T v) {
|
||||
indexToA = index;
|
||||
this.priority = priority;
|
||||
this.v = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bc99aab509d5d5846b25d73984a920c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// A priority queue element that is compared by priority and timestamp
|
||||
/// </summary>
|
||||
internal class GenericHeapElementWithTimestamp<T> : GenericHeapElement<T> {
|
||||
// Timestamp operates as a tiebreaker when priorities are equal.
|
||||
internal UInt64 Timestamp { get; set; }
|
||||
|
||||
internal GenericHeapElementWithTimestamp(int index, double priority, T v, UInt64 timestamp)
|
||||
: base(index, priority, v) {
|
||||
this.Timestamp = timestamp;
|
||||
}
|
||||
|
||||
internal int ComparePriority(GenericHeapElementWithTimestamp<T> other) {
|
||||
var cmp = base.priority.CompareTo(other.priority);
|
||||
|
||||
// Consider a more recent sequence to have a lower priority value (== higher priority)
|
||||
// so reverse the direction of comparison. Note: Timestamp only applies in the case
|
||||
// of tied priorities, so if it wraps, we'll have suboptimal processing and likely a different
|
||||
// path in the event of ties, but will not fail.
|
||||
return (cmp != 0) ? cmp : other.Timestamp.CompareTo(this.Timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 91406a9d3ae7e79408f53eaac222784e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core/DataStructures/RBTree.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core/DataStructures/RBTree.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2db8c0017da4d1e42a8df84b52235c5b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
internal class ComparerOnDelegate<T> : IComparer<T> {
|
||||
readonly Func<T, T, int> comparer;
|
||||
|
||||
public ComparerOnDelegate(Func<T, T, int> compare) {
|
||||
comparer= compare;
|
||||
}
|
||||
|
||||
public int Compare(T x, T y) {
|
||||
return comparer(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 808dfa443622ca94d9f1a9e8cd9c13be
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
internal class DefaultComperer<T>: IComparer<T> {
|
||||
public int Compare(T x, T y) {
|
||||
return ((IComparable<T>) x).CompareTo(y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9bcd9db072a6903479507b3a95b5d657
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
internal enum RBColor {
|
||||
Red,
|
||||
Black
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ca5c296797071684880042932e6df5ee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
|
||||
#if TEST_MSAGL
|
||||
[Serializable]
|
||||
#endif
|
||||
internal class RBNode<T> {
|
||||
|
||||
internal RBColor color;
|
||||
internal T Item;
|
||||
internal RBNode<T> parent, left, right;
|
||||
internal RBNode(RBColor color) { this.color = color; }
|
||||
internal RBNode(RBColor color, T item, RBNode<T> p, RBNode<T> left, RBNode<T> right) {
|
||||
this.color = color;
|
||||
this.parent = p;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.Item = item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
return Item.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eb455e0993b23bc45814a25cd54d4a50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
483
Assets/Scripts/NIH/MSAGL/Core/DataStructures/RBTree/RBTree.cs
Normal file
483
Assets/Scripts/NIH/MSAGL/Core/DataStructures/RBTree/RBTree.cs
Normal file
|
|
@ -0,0 +1,483 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
|
||||
//public class TestRB :IComparer<int>{
|
||||
// public static void Test() {
|
||||
// var tree = new RBTree<int>(new TestRB());
|
||||
// tree.insert(1);
|
||||
// tree.insert(6);
|
||||
// tree.insert(8);
|
||||
// tree.insert(11);
|
||||
// tree.insert(13);
|
||||
// tree.insert(17);
|
||||
// tree.insert(15);
|
||||
// tree.insert(25);
|
||||
// tree.insert(22);
|
||||
// tree.insert(27);
|
||||
// tree.insert(16);
|
||||
|
||||
// var t = tree.findLast(delegate(int i) { return i <= 15.5; });
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// #region IComparer<int> Members
|
||||
|
||||
// public int Compare(int x, int y) {
|
||||
// return x - y;
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
//}
|
||||
|
||||
#if TEST_MSAGL
|
||||
[Serializable]
|
||||
#endif
|
||||
internal class RbTree<T> : IEnumerable<T> {
|
||||
|
||||
/// <summary>
|
||||
/// find the first, minimal, node in the tree such that predicate holds
|
||||
/// </summary>
|
||||
/// <param name="predicate">Has to be monotone in the sense that if it holds for t then it holds for any t' greater or equal than t
|
||||
/// so the predicate values have a form (false, false, ..., false, true, true, ..., true)
|
||||
/// </param>
|
||||
/// <returns>the first node where predicate holds or null</returns>
|
||||
internal RBNode<T> FindFirst(Func<T, bool> predicate) {
|
||||
return FindFirst(root, predicate);
|
||||
}
|
||||
|
||||
internal RbTree() {
|
||||
comparer = new DefaultComperer<T>();
|
||||
root = nil = new RBNode<T>(RBColor.Black);
|
||||
}
|
||||
|
||||
RBNode<T> FindFirst(RBNode<T> n, Func<T, bool> p) {
|
||||
if (n == nil)
|
||||
return null;
|
||||
RBNode<T> good = null;
|
||||
while (n != nil)
|
||||
n = p(n.Item) ? (good = n).left : n.right;
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// find the last, maximal, node in the tree such that predicate holds
|
||||
/// </summary>
|
||||
/// <param name="predicate">Has to be monotone in the sense that if it holds for t then it holds for any t' less or equal than t
|
||||
/// so the predicate values on the tree have a form (true, true, ..., true, false, false, ..., false)
|
||||
/// </param>
|
||||
/// <returns>the last node where predicate holds or null</returns>
|
||||
internal RBNode<T> FindLast(Func<T,bool> predicate) {
|
||||
return FindLast(root, predicate);
|
||||
}
|
||||
|
||||
RBNode<T> FindLast(RBNode<T> n, Func<T,bool> p) {
|
||||
if (n == nil)
|
||||
return null;
|
||||
RBNode<T> good = null;
|
||||
while (n != nil)
|
||||
n = p(n.Item) ? (good = n).right : n.left;
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
|
||||
readonly IComparer<T> comparer;
|
||||
|
||||
IComparer<T> Comparer {
|
||||
get { return comparer; }
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator() { return new RBTreeEnumerator<T>(this); }
|
||||
|
||||
RBNode<T> nil;
|
||||
|
||||
internal RBNode<T> Nil { get { return nil; } }
|
||||
|
||||
RBNode<T> root;
|
||||
internal RBNode<T> Root { get { return root; } }
|
||||
|
||||
internal RBNode<T> Next(RBNode<T> x) {
|
||||
if (x.right != nil)
|
||||
return TreeMinimum(x.right);
|
||||
RBNode<T> y = x.parent;
|
||||
while (y != nil && x == y.right) {
|
||||
x = y;
|
||||
y = y.parent;
|
||||
}
|
||||
return ToNull(y);
|
||||
}
|
||||
|
||||
RBNode<T> ToNull(RBNode<T> y) {
|
||||
return y != nil ? y : null;
|
||||
}
|
||||
|
||||
internal RBNode<T> Previous(RBNode<T> x) {
|
||||
if (x.left != nil)
|
||||
return TreeMaximum(x.left);
|
||||
RBNode<T> y = x.parent;
|
||||
while (y != nil && x == y.left) {
|
||||
x = y;
|
||||
y = y.parent;
|
||||
}
|
||||
return ToNull(y);
|
||||
}
|
||||
|
||||
RBNode<T> TreeMinimum(RBNode<T> x) {
|
||||
while (x.left != nil)
|
||||
x = x.left;
|
||||
return ToNull(x);
|
||||
}
|
||||
|
||||
internal RBNode<T> TreeMinimum() {
|
||||
return TreeMinimum(root);
|
||||
}
|
||||
|
||||
|
||||
RBNode<T> TreeMaximum(RBNode<T> x) {
|
||||
while (x.right != nil)
|
||||
x = x.right;
|
||||
return ToNull(x);
|
||||
}
|
||||
|
||||
internal RBNode<T> TreeMaximum() {
|
||||
return TreeMaximum(root);
|
||||
}
|
||||
|
||||
|
||||
//RBTree<T> Clone() {
|
||||
// RBTree<T> clone = new RBTree<T>(this.Comparer);
|
||||
// foreach (T n in this) {
|
||||
// clone.insert(n);
|
||||
// }
|
||||
// return clone;
|
||||
//}
|
||||
|
||||
|
||||
public override string ToString() {
|
||||
string ret = "{";
|
||||
int i = 0;
|
||||
foreach (T p in this) {
|
||||
ret += p.ToString();
|
||||
if (i != count - 1) {
|
||||
ret += ",";
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return ret + "}";
|
||||
}
|
||||
|
||||
|
||||
internal RBNode<T> DeleteSubtree(RBNode<T> z) {
|
||||
System.Diagnostics.Debug.Assert(z != nil);
|
||||
|
||||
RBNode<T> y;
|
||||
if (z.left == nil || z.right == nil) {
|
||||
/* y has a nil node as a child */
|
||||
y = z;
|
||||
} else {
|
||||
/* find tree successor with a nil node as a child */
|
||||
y = z.right;
|
||||
while (y.left != nil) y = y.left;
|
||||
}
|
||||
|
||||
/* x is y's only child */
|
||||
RBNode<T> x = y.left != nil ? y.left : y.right;
|
||||
|
||||
x.parent = y.parent;
|
||||
if (y.parent == nil)
|
||||
root = x;
|
||||
else {
|
||||
if (y == y.parent.left)
|
||||
y.parent.left = x;
|
||||
else
|
||||
y.parent.right = x;
|
||||
}
|
||||
if (y != z)
|
||||
z.Item = y.Item;
|
||||
if (y.color == RBColor.Black)
|
||||
DeleteFixup(x);
|
||||
|
||||
// checkTheTree();
|
||||
|
||||
return ToNull(z);
|
||||
|
||||
}
|
||||
|
||||
int count;
|
||||
public int Count { get { return count; } }
|
||||
|
||||
internal RBNode<T> Remove(T i) {
|
||||
RBNode<T> n = Find(i);
|
||||
if (n != null) {
|
||||
count--;
|
||||
return DeleteSubtree(n);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void DeleteNodeInternal(RBNode<T> x) {
|
||||
count--;
|
||||
DeleteSubtree(x);
|
||||
}
|
||||
|
||||
RBNode<T> Find(RBNode<T> x, T i) {
|
||||
int compareResult;
|
||||
while (x != nil && (compareResult = Comparer.Compare(i, x.Item)) != 0)
|
||||
x = compareResult < 0 ? x.left : x.right;
|
||||
|
||||
return ToNull(x);
|
||||
}
|
||||
|
||||
internal RBNode<T> Find(T i) {
|
||||
return Find(root, i);
|
||||
}
|
||||
|
||||
void DeleteFixup(RBNode<T> x) {
|
||||
while (x != root && x.color == RBColor.Black) {
|
||||
if (x == x.parent.left) {
|
||||
RBNode<T> w = x.parent.right;
|
||||
if (w.color == RBColor.Red) {
|
||||
w.color = RBColor.Black;
|
||||
x.parent.color = RBColor.Red;
|
||||
LeftRotate(x.parent);
|
||||
w = x.parent.right;
|
||||
}
|
||||
if (w.left.color == RBColor.Black && w.right.color == RBColor.Black) {
|
||||
w.color = RBColor.Red;
|
||||
x = x.parent;
|
||||
} else {
|
||||
if (w.right.color == RBColor.Black) {
|
||||
w.left.color = RBColor.Black;
|
||||
w.color = RBColor.Red;
|
||||
RightRotate(w);
|
||||
w = x.parent.right;
|
||||
}
|
||||
w.color = x.parent.color;
|
||||
x.parent.color = RBColor.Black;
|
||||
w.right.color = RBColor.Black;
|
||||
LeftRotate(x.parent);
|
||||
x = root;
|
||||
}
|
||||
} else {
|
||||
RBNode<T> w = x.parent.left;
|
||||
if (w.color == RBColor.Red) {
|
||||
w.color = RBColor.Black;
|
||||
x.parent.color = RBColor.Red;
|
||||
RightRotate(x.parent);
|
||||
w = x.parent.left;
|
||||
}
|
||||
if (w.right.color == RBColor.Black && w.left.color == RBColor.Black) {
|
||||
w.color = RBColor.Red;
|
||||
x = x.parent;
|
||||
} else {
|
||||
if (w.left.color == RBColor.Black) {
|
||||
w.right.color = RBColor.Black;
|
||||
w.color = RBColor.Red;
|
||||
LeftRotate(w);
|
||||
w = x.parent.left;
|
||||
}
|
||||
w.color = x.parent.color;
|
||||
x.parent.color = RBColor.Black;
|
||||
w.left.color = RBColor.Black;
|
||||
RightRotate(x.parent);
|
||||
x = root;
|
||||
}
|
||||
}
|
||||
}
|
||||
x.color = RBColor.Black;
|
||||
}
|
||||
|
||||
internal bool IsEmpty() { return root == nil; }
|
||||
|
||||
RBNode<T> TreeInsert(T z) {
|
||||
var y = nil;
|
||||
var x = root;
|
||||
var compareRes = 0;
|
||||
while (x != nil) {
|
||||
y = x;
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=368
|
||||
compareRes = Comparer.Compare(z, x.Item);
|
||||
x = compareRes < 0 ? x.left : x.right;
|
||||
#else
|
||||
x = (compareRes = Comparer.Compare(z, x.Item)) < 0 ? x.left : x.right;
|
||||
#endif
|
||||
}
|
||||
|
||||
var nz = new RBNode<T>(RBColor.Black, z, y, nil, nil);
|
||||
|
||||
if (y == nil)
|
||||
root = nz;
|
||||
else if (compareRes < 0)
|
||||
y.left = nz;
|
||||
else
|
||||
y.right = nz;
|
||||
|
||||
return ToNull(nz);
|
||||
}
|
||||
|
||||
void InsertPrivate(RBNode<T> x) {
|
||||
count++;
|
||||
x.color = RBColor.Red;
|
||||
while (x != root && x.parent.color == RBColor.Red) {
|
||||
if (x.parent == x.parent.parent.left) {
|
||||
RBNode<T> y = x.parent.parent.right;
|
||||
if (y.color == RBColor.Red) {
|
||||
x.parent.color = RBColor.Black;
|
||||
y.color = RBColor.Black;
|
||||
x.parent.parent.color = RBColor.Red;
|
||||
x = x.parent.parent;
|
||||
} else {
|
||||
if (x == x.parent.right) {
|
||||
x = x.parent;
|
||||
LeftRotate(x);
|
||||
}
|
||||
x.parent.color = RBColor.Black;
|
||||
x.parent.parent.color = RBColor.Red;
|
||||
RightRotate(x.parent.parent);
|
||||
}
|
||||
} else {
|
||||
RBNode<T> y = x.parent.parent.left;
|
||||
if (y.color == RBColor.Red) {
|
||||
x.parent.color = RBColor.Black;
|
||||
y.color = RBColor.Black;
|
||||
x.parent.parent.color = RBColor.Red;
|
||||
x = x.parent.parent;
|
||||
} else {
|
||||
if (x == x.parent.left) {
|
||||
x = x.parent;
|
||||
RightRotate(x);
|
||||
}
|
||||
x.parent.color = RBColor.Black;
|
||||
x.parent.parent.color = RBColor.Red;
|
||||
LeftRotate(x.parent.parent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
root.color = RBColor.Black;
|
||||
|
||||
//checkTheTree();
|
||||
}
|
||||
|
||||
internal RBNode<T> Insert(T v) {
|
||||
RBNode<T> x = TreeInsert(v);
|
||||
InsertPrivate(x);
|
||||
return ToNull(x);
|
||||
}
|
||||
|
||||
void LeftRotate(RBNode<T> x) {
|
||||
RBNode<T> y = x.right;
|
||||
x.right = y.left;
|
||||
if (y.left != nil)
|
||||
y.left.parent = x;
|
||||
y.parent = x.parent;
|
||||
if (x.parent == nil)
|
||||
root = y;
|
||||
else if (x == x.parent.left)
|
||||
x.parent.left = y;
|
||||
else
|
||||
x.parent.right = y;
|
||||
|
||||
y.left = x;
|
||||
x.parent = y;
|
||||
}
|
||||
|
||||
void RightRotate(RBNode<T> x) {
|
||||
RBNode<T> y = x.left;
|
||||
x.left = y.right;
|
||||
if (y.right != nil)
|
||||
y.right.parent = x;
|
||||
y.parent = x.parent;
|
||||
if (x.parent == nil)
|
||||
root = y;
|
||||
else if (x == x.parent.right)
|
||||
x.parent.right = y;
|
||||
else
|
||||
x.parent.left = y;
|
||||
|
||||
y.right = x;
|
||||
x.parent = y;
|
||||
|
||||
}
|
||||
|
||||
internal RbTree(Func<T, T, int> func) : this(new ComparerOnDelegate<T>(func)) {}
|
||||
|
||||
|
||||
internal RbTree(IComparer<T> comparer) {
|
||||
Clear();
|
||||
this.comparer = comparer;
|
||||
}
|
||||
|
||||
internal void Clear() {
|
||||
root = nil = new RBNode<T>(RBColor.Black);
|
||||
}
|
||||
|
||||
//void checkTheTree() {
|
||||
// int blacks = -1;
|
||||
// checkBlacks(root, 0, ref blacks);
|
||||
// checkColors(root);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//void checkBlacks(RBNode<T> node, int nnow, ref int blacks) {
|
||||
// if (node != nil) {
|
||||
// RBNode<T> l = node.left, r = node.right;
|
||||
|
||||
// if (l != nil)
|
||||
// if (Comparer.Compare(l.item,node.item) >= 0)
|
||||
// throw new Exception("order");
|
||||
|
||||
// if (r != nil)
|
||||
// if (Comparer.Compare(r.item,node.item) <= 0)
|
||||
// throw new Exception("order");
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// if (node == nil) {
|
||||
// if (blacks != nnow + 1 && blacks != -1)
|
||||
// throw new Exception("blacks");
|
||||
|
||||
// blacks = nnow + 1;
|
||||
|
||||
// } else if (node.color == RBColor.Black) {
|
||||
// checkBlacks(node.left, nnow + 1, ref blacks);
|
||||
// checkBlacks(node.right, nnow + 1, ref blacks);
|
||||
// } else {
|
||||
// checkBlacks(node.left, nnow, ref blacks);
|
||||
// checkBlacks(node.right, nnow, ref blacks);
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//void checkColors(RBNode<T> x) {
|
||||
// if (x == nil)
|
||||
// return;
|
||||
// //property 3
|
||||
// if (x.color == RBColor.Red)
|
||||
// if (x.left.color == RBColor.Red || x.right.color == RBColor.Red)
|
||||
// throw new Exception("colors");
|
||||
|
||||
// checkColors(x.left);
|
||||
// checkColors(x.right);
|
||||
//}
|
||||
|
||||
#region IEnumerable Members
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
||||
return new RBTreeEnumerator<T>(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a151171447e096b488f0330e292d99bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
internal class RBTreeEnumerator<T> : IEnumerator<T> {
|
||||
bool initialState;
|
||||
RbTree<T> tree;
|
||||
RBNode<T> c;
|
||||
public T Current {
|
||||
get { return c.Item; }
|
||||
}
|
||||
public void Reset() {
|
||||
initialState = true;
|
||||
}
|
||||
|
||||
public bool MoveNext() {
|
||||
if (tree.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (initialState == true) {
|
||||
initialState = false;
|
||||
c = tree.TreeMinimum();
|
||||
} else {
|
||||
c = tree.Next(c);
|
||||
}
|
||||
return c != null;
|
||||
}
|
||||
|
||||
internal RBTreeEnumerator(RbTree<T> tree) {
|
||||
this.tree = tree;
|
||||
Reset();
|
||||
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose() {
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerator Members
|
||||
|
||||
object System.Collections.IEnumerator.Current {
|
||||
get { return c.Item; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 395191aa1bdd41c49a6404fa3ab9b293
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// this class behaves like one dimensional bounding box
|
||||
/// </summary>
|
||||
public class RealNumberSpan{
|
||||
internal RealNumberSpan(){
|
||||
IsEmpty = true;
|
||||
}
|
||||
|
||||
internal bool IsEmpty { get; set; }
|
||||
|
||||
internal void AddValue(double x){
|
||||
if(IsEmpty){
|
||||
Min = Max = x;
|
||||
IsEmpty = false;
|
||||
} else if(x < Min)
|
||||
Min = x;
|
||||
else if(x > Max)
|
||||
Max = x;
|
||||
}
|
||||
|
||||
internal double Min { get; set; }
|
||||
internal double Max { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Length{
|
||||
get { return Max-Min; }
|
||||
}
|
||||
#if TEST_MSAGL
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object)")]
|
||||
public override string ToString() {
|
||||
return IsEmpty ? "empty" : String.Format("{0},{1}", Min, Max);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 02eb261364f08ad44855f1343b1c9b8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
300
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Set.cs
Normal file
300
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Set.cs
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// Implementation of Set.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set")]
|
||||
public class Set<T> : MarshalByRefObject, ICollection<T> {
|
||||
HashSet<T> hashSet = new HashSet<T>();
|
||||
/// <summary>
|
||||
/// inserts an element into the set
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public void Insert(T element) {
|
||||
hashSet.Add(element);
|
||||
#if SHARPKIT
|
||||
UpdateHashKey();
|
||||
#endif
|
||||
}
|
||||
void System.Collections.Generic.ICollection<T>.Add(T t) { Insert(t); }
|
||||
/// <summary>
|
||||
/// returns true when the set contains the element
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool Contains(T item) { return hashSet.Contains(item); }
|
||||
/// <summary>
|
||||
/// deletes the element from the set
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void Delete(T item) {
|
||||
hashSet.Remove(item);
|
||||
#if SHARPKIT
|
||||
UpdateHashKey();
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// deletes the element from the set
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool Remove(T item) {
|
||||
var ret = hashSet.Remove(item);
|
||||
#if SHARPKIT
|
||||
UpdateHashKey();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// returns the number elements in the set
|
||||
/// </summary>
|
||||
public int Count { get { return hashSet.Count; } }
|
||||
/// <summary>
|
||||
/// returns the set entities enumerator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerator<T> GetEnumerator() { return hashSet.GetEnumerator(); }
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
||||
return hashSet.GetEnumerator();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the read only flag
|
||||
/// </summary>
|
||||
public bool IsReadOnly { get { return false; } }
|
||||
|
||||
// public bool IsSynchronized {get {return table.IsSynchronized; }}
|
||||
|
||||
//public T SyncRoot {get {return table.SyncRoot;}}
|
||||
|
||||
/// <summary>
|
||||
/// copies to an array
|
||||
/// </summary>
|
||||
/// <param name="array"></param>
|
||||
/// <param name="arrayIndex"></param>
|
||||
public void CopyTo(T[] array, int arrayIndex) {
|
||||
hashSet.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToString
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
string r = "{";
|
||||
int i = 0;
|
||||
foreach (T o in this) {
|
||||
r += o.ToString();
|
||||
i++;
|
||||
if (i < Count)
|
||||
r += ",";
|
||||
}
|
||||
r += "}";
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// cleans the set
|
||||
/// </summary>
|
||||
public void Clear() {
|
||||
this.hashSet.Clear();
|
||||
#if SHARPKIT
|
||||
UpdateHashKey();
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// clones the set
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Set<T> Clone() {
|
||||
Set<T> ret = new Set<T>();
|
||||
foreach (T i in this) {
|
||||
ret.Insert(i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="enumerableCollection"></param>
|
||||
public Set(IEnumerable<T> enumerableCollection) {
|
||||
ValidateArg.IsNotNull(enumerableCollection, "enumerableCollection");
|
||||
foreach (T j in enumerableCollection)
|
||||
this.Insert(j);
|
||||
#if SHARPKIT
|
||||
UpdateHashKey();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// an empty constructor
|
||||
/// </summary>
|
||||
public Set() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// creates an array from the set elements
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public System.Array ToArray(System.Type type) {
|
||||
System.Array ret = System.Array.CreateInstance(type, this.Count);
|
||||
int i = 0;
|
||||
foreach (T o in this) {
|
||||
ret.SetValue(o, i++);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// overloading plus operator
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
static public Set<T> operator +(Set<T> set0, Set<T> set1) {
|
||||
ValidateArg.IsNotNull(set1, "set1");
|
||||
Set<T> ret = new Set<T>(set0);
|
||||
foreach (T t in set1)
|
||||
ret.Insert(t);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// overloading plus operator
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")]
|
||||
static public Set<T> operator -(Set<T> set0, Set<T> set1) {
|
||||
ValidateArg.IsNotNull(set1, "set1");
|
||||
Set<T> ret = new Set<T>(set0);
|
||||
foreach (T t in set1)
|
||||
ret.Remove(t);
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// overloading the == operator
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
|
||||
static public bool operator ==(Set<T> set0, Set<T> set1) {
|
||||
if ((object)set0 == null && (object)set1 == null)
|
||||
return true;
|
||||
if ((object)set0 == null && (object)set1 != null)
|
||||
return false;
|
||||
|
||||
if ((object)set1 == null && (object)set0 != null)
|
||||
return false;
|
||||
|
||||
foreach (T t in set0)
|
||||
if (!set1.Contains(t))
|
||||
return false;
|
||||
|
||||
foreach (T t in set1)
|
||||
if (!set0.Contains(t))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// overloading the == operator
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
static public bool operator !=(Set<T> set0, Set<T> set1) {
|
||||
return !(set0 == set1);
|
||||
}
|
||||
/// <summary>
|
||||
/// intersection
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")]
|
||||
static public Set<T> operator *(Set<T> set0, Set<T> set1) {
|
||||
ValidateArg.IsNotNull(set0, "set0");
|
||||
ValidateArg.IsNotNull(set1, "set1");
|
||||
return
|
||||
new Set<T>(set0.Count < set1.Count
|
||||
? set0.Where(a => set1.Contains(a))
|
||||
: set1.Where(a => set0.Contains(a)));
|
||||
}
|
||||
/// <summary>
|
||||
/// the equality
|
||||
/// </summary>
|
||||
/// <param name="obj">the object to compare to</param>
|
||||
/// <returns></returns>
|
||||
public override bool Equals(object obj) {
|
||||
Set<T> set = obj as Set<T>;
|
||||
if (set == null)
|
||||
return false;
|
||||
return set == this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// hash code
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int GetHashCode() {
|
||||
int ret = 0;
|
||||
foreach (T t in this)
|
||||
ret |= t.GetHashCode();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a friendly add, union, operator
|
||||
/// </summary>
|
||||
/// <param name="set0"></param>
|
||||
/// <param name="set1"></param>
|
||||
/// <returns></returns>
|
||||
public Set<T> Add(Set<T> set0, Set<T> set1) {
|
||||
return set0 + set1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inserts a range of elements into the set
|
||||
/// </summary>
|
||||
/// <param name="elements">elements to insert</param>
|
||||
public void InsertRange(IEnumerable<T> elements )
|
||||
{
|
||||
ValidateArg.IsNotNull(elements,"elements");
|
||||
foreach (var element in elements)
|
||||
Insert(element);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// checks the set is contained in the "otherSet"
|
||||
///</summary>
|
||||
///<param name="otherSet"></param>
|
||||
///<returns></returns>
|
||||
public bool IsContained(Set<T> otherSet) { return this.All(p => otherSet.Contains(p)); }
|
||||
|
||||
///<summary>
|
||||
/// checks that this set conains the "otherSet"
|
||||
///</summary>
|
||||
///<param name="otherSet"></param>
|
||||
///<returns></returns>
|
||||
public bool Contains(Set<T> otherSet) { return otherSet.All(p => Contains(p)); }
|
||||
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=289
|
||||
private SharpKit.JavaScript.JsString _hashKey;
|
||||
private void UpdateHashKey()
|
||||
{
|
||||
_hashKey = GetHashCode().ToString();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Set.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Set.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23411223e702a51449131ae3cb7deeb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
72
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Size.cs
Normal file
72
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Size.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
namespace Microsoft.Msagl.Core.DataStructures
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Size structure
|
||||
/// </summary>
|
||||
public struct Size
|
||||
{
|
||||
double width;
|
||||
/// <summary>
|
||||
/// width
|
||||
/// </summary>
|
||||
public double Width
|
||||
{
|
||||
get { return width; }
|
||||
set { width = value; }
|
||||
}
|
||||
double height;
|
||||
/// <summary>
|
||||
/// Height
|
||||
/// </summary>
|
||||
public double Height
|
||||
{
|
||||
get { return height; }
|
||||
set { height = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public Size(double width, double height)
|
||||
{
|
||||
this.width = width;
|
||||
|
||||
|
||||
this.height = height;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <param name="d"></param>
|
||||
/// <returns></returns>
|
||||
public static Size operator /(Size s, double d) { return new Size(s.Width / d, s.Height / d); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <param name="d"></param>
|
||||
/// <returns></returns>
|
||||
public static Size operator *(Size s, double d) { return new Size(s.Width * d, s.Height * d); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// padding the size ( from both sides!)
|
||||
/// </summary>
|
||||
/// <param name="padding"></param>
|
||||
public void Pad(double padding) {
|
||||
width += 2*padding;
|
||||
height += 2*padding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Size.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/DataStructures/Size.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10ae915a97e51564585fa058c476f9cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.DataStructures {
|
||||
/// <summary>
|
||||
/// a tuple such that (a,b)==(b,a) for any a and b
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class SymmetricTuple<T> {
|
||||
bool Equals(SymmetricTuple<T> other) {
|
||||
return (A.Equals(other.A) && B.Equals(other.B)) ||
|
||||
(A.Equals(other.B) && B.Equals(other.A));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves as a hash function for a particular type.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A hash code for the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
public override int GetHashCode() {
|
||||
|
||||
#if !SHARPKIT
|
||||
unchecked {
|
||||
#endif
|
||||
return A.GetHashCode() ^ B.GetHashCode(); // we need a symmetric hash code
|
||||
#if !SHARPKIT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public T A { get; private set; }
|
||||
public T B { get; private set; }
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
public SymmetricTuple(T a, T b) {
|
||||
A = a;
|
||||
B = b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
|
||||
/// </returns>
|
||||
/// <param name="obj">The object to compare with the current object. </param><filterpriority>2</filterpriority>
|
||||
public override bool Equals(object obj) {
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != GetType()) return false;
|
||||
return Equals((SymmetricTuple<T>)obj);
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return String.Format("({0},{1})", A, B);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4a850709a43d60748b3dd2674e1d902a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core/Geometry.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core/Geometry.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 90b057800aaf56a4c9d635fac7c02c89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
198
Assets/Scripts/NIH/MSAGL/Core/Geometry/ApproximateComparer.cs
Normal file
198
Assets/Scripts/NIH/MSAGL/Core/Geometry/ApproximateComparer.cs
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
/// <summary>
|
||||
/// Class that provides methods for doing approximate comparisons.
|
||||
/// </summary>
|
||||
public static class ApproximateComparer {
|
||||
/// <summary>
|
||||
/// return true if the points are close enough
|
||||
/// </summary>
|
||||
public static bool Close(Point pointA, Point pointB, double tolerance) {
|
||||
return (pointA - pointB).Length <= tolerance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return true if the points are close enough
|
||||
/// </summary>
|
||||
public static bool Close(Point pointA, Point pointB) {
|
||||
return Close(pointA, pointB, DistanceEpsilon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return true if the numbers are close enough
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "a"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "b")]
|
||||
public static bool Close(double a, double b) {
|
||||
return Math.Abs(a - b) <= DistanceEpsilon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return true if the two rects are nearly identical (ignoring precision errors smaller than DistanceEpsilon)
|
||||
/// </summary>
|
||||
public static bool Close(Rectangle rect1, Rectangle rect2, double tolerance) {
|
||||
return Close(rect1.LeftBottom, rect2.LeftBottom, tolerance) && Close(rect1.RightTop, rect2.RightTop, tolerance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return true if the two rects are nearly identical (ignoring precision errors smaller than DistanceEpsilon)
|
||||
/// </summary>
|
||||
/// <param name="rect1">first Rectangle</param>
|
||||
/// <param name="rect2">second Rectangle</param>
|
||||
/// <returns></returns>
|
||||
public static bool Close(Rectangle rect1, Rectangle rect2) {
|
||||
return Close(rect1, rect2, DistanceEpsilon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The usual Compare operation, but within Curve.DistanceEpsilon.
|
||||
/// </summary>
|
||||
/// <param name="numberA"></param>
|
||||
/// <param name="numberB"></param>
|
||||
/// <returns></returns>
|
||||
public static int Compare(double numberA, double numberB) {
|
||||
double c = numberA - numberB;
|
||||
// The <= and >= here complement the < and > in Close(double, double).
|
||||
if (c <= -DistanceEpsilon)
|
||||
return -1;
|
||||
if (c >= DistanceEpsilon)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The usual > operation, but within Curve.DistanceEpsilon.
|
||||
/// </summary>
|
||||
/// <param name="numberA"></param>
|
||||
/// <param name="numberB"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Greater(double numberA, double numberB) {
|
||||
return Compare(numberA, numberB) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The usual >= operation, but within Curve.DistanceEpsilon.
|
||||
/// </summary>
|
||||
/// <param name="numberA"></param>
|
||||
/// <param name="numberB"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GreaterOrEqual(double numberA, double numberB) {
|
||||
return Compare(numberA, numberB) >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The usual less operation, but within Curve.DistanceEpsilon.
|
||||
/// </summary>
|
||||
/// <param name="numberA"></param>
|
||||
/// <param name="numberB"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Less(double numberA, double numberB) {
|
||||
return Compare(numberA, numberB) < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The usual less operation, but within Curve.DistanceEpsilon.
|
||||
/// </summary>
|
||||
/// <param name="numberA"></param>
|
||||
/// <param name="numberB"></param>
|
||||
/// <returns></returns>
|
||||
public static bool LessOrEqual(double numberA, double numberB) {
|
||||
return Compare(numberA, numberB) <= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if two intersections points are close enough
|
||||
/// </summary>
|
||||
/// <param name="intersectionPoint0"></param>
|
||||
/// <param name="intersectionPoint1"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CloseIntersections(Point intersectionPoint0, Point intersectionPoint1) {
|
||||
Point c = intersectionPoint0 - intersectionPoint1;
|
||||
return c * c < IntersectionEpsilon * IntersectionEpsilon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 0 iff value is close to zero;
|
||||
/// 1 iff value is strictly greater than zero;
|
||||
/// -1 iff value is strictly lower than zero;
|
||||
/// </summary>
|
||||
public static int Sign(double value) {
|
||||
if (value > DistanceEpsilon) return 1;
|
||||
if (value < -DistanceEpsilon) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static readonly double squareOfDistanceEpsilon = Math.Pow(10.0, -DistanceEpsilonPrecision * 2);
|
||||
|
||||
/// <summary>
|
||||
/// The distance for two points considered to be the same
|
||||
/// </summary>
|
||||
internal static double DistanceEpsilon = Math.Pow(10.0, -DistanceEpsilonPrecision);
|
||||
|
||||
/// <summary>
|
||||
/// The square of the distance epsilon for two points considered to be the same
|
||||
/// </summary>
|
||||
internal static double SquareOfDistanceEpsilon {
|
||||
get { return squareOfDistanceEpsilon; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The digits of precision for the distance for two points considered to be the same
|
||||
/// </summary>
|
||||
internal static int DistanceEpsilonPrecision {
|
||||
get { return 6; }
|
||||
}
|
||||
|
||||
static double distXEps = 0.0001;
|
||||
|
||||
/// <summary>
|
||||
/// The distance for two intersection points considered to be the same
|
||||
/// </summary>
|
||||
public static double IntersectionEpsilon {
|
||||
get { return distXEps; }
|
||||
set { distXEps = value; }
|
||||
}
|
||||
|
||||
static double tolerance = 1.0E-8;
|
||||
|
||||
/// <summary>
|
||||
/// The distance where to real numbers are considered the same
|
||||
/// </summary>
|
||||
public static double Tolerance {
|
||||
get { return tolerance; }
|
||||
set { tolerance = value; }
|
||||
}
|
||||
|
||||
static double userDefinedTolerance = tolerance;
|
||||
|
||||
/// <summary>
|
||||
/// A tolerance that is settable by users of MSAGL to adjust performance.
|
||||
/// </summary>
|
||||
public static double UserDefinedTolerance {
|
||||
get { return userDefinedTolerance; }
|
||||
set { userDefinedTolerance = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// point coordinates will be rounded to NumberOfDigitsToRound for comparison
|
||||
/// </summary>
|
||||
static internal int NumberOfDigitsToRound {
|
||||
get { return DistanceEpsilonPrecision; }
|
||||
}
|
||||
|
||||
static internal Point Round(Point point) {
|
||||
return new Point(Round(point.X), Round(point.Y));
|
||||
}
|
||||
|
||||
static internal Point Round(Point point, int numberDigitsToRound)
|
||||
{
|
||||
return new Point(Math.Round(point.X, numberDigitsToRound), Math.Round(point.Y, numberDigitsToRound));
|
||||
}
|
||||
|
||||
static internal double Round(double value) {
|
||||
return Math.Round(value, NumberOfDigitsToRound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 380260d63cdb0a0418bb345f925c6291
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
254
Assets/Scripts/NIH/MSAGL/Core/Geometry/CompassVector.cs
Normal file
254
Assets/Scripts/NIH/MSAGL/Core/Geometry/CompassVector.cs
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
internal struct CompassVector {
|
||||
|
||||
/// <summary>
|
||||
/// Override op==
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator ==(CompassVector a, CompassVector b) {
|
||||
return a.Dir == b.Dir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the hash code.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int GetHashCode() {
|
||||
return (int)Dir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override op!=
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator !=(CompassVector a, CompassVector b) {
|
||||
return a.Dir != b.Dir;
|
||||
}
|
||||
|
||||
internal CompassVector(Directions direction)
|
||||
: this() {
|
||||
Dir = direction;
|
||||
}
|
||||
|
||||
// Warning: do not use for VisibilityGraph generation. See VectorDirection(a) comments.
|
||||
internal CompassVector(Point a)
|
||||
: this() {
|
||||
Dir = VectorDirection(a);
|
||||
}
|
||||
|
||||
internal CompassVector(Point a, Point b)
|
||||
: this() {
|
||||
Dir = VectorDirection(a, b);
|
||||
}
|
||||
|
||||
|
||||
internal Directions Dir { get; set; }
|
||||
internal CompassVector Right {
|
||||
get { return new CompassVector(RotateRight(Dir)); }
|
||||
}
|
||||
|
||||
internal static Directions RotateRight(Directions direction) {
|
||||
switch (direction) {
|
||||
case Directions.North:
|
||||
return Directions.East;
|
||||
case Directions.East:
|
||||
return Directions.South;
|
||||
case Directions.South:
|
||||
return Directions.West;
|
||||
case Directions.West:
|
||||
return Directions.North;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
internal static Directions RotateLeft(Directions direction) {
|
||||
switch (direction) {
|
||||
case Directions.North:
|
||||
return Directions.West;
|
||||
case Directions.West:
|
||||
return Directions.South;
|
||||
case Directions.South:
|
||||
return Directions.East;
|
||||
case Directions.East:
|
||||
return Directions.North;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
internal static int ToIndex(Directions direction) {
|
||||
switch (direction) {
|
||||
case Directions.North:
|
||||
return 0;
|
||||
case Directions.East:
|
||||
return 1;
|
||||
case Directions.South:
|
||||
return 2;
|
||||
case Directions.West:
|
||||
return 3;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
internal static Directions VectorDirection(Point d){
|
||||
Directions r = Directions.None;
|
||||
if(d.X > ApproximateComparer.DistanceEpsilon)
|
||||
r = Directions.East;
|
||||
else if(d.X < -ApproximateComparer.DistanceEpsilon)
|
||||
r = Directions.West;
|
||||
if(d.Y > ApproximateComparer.DistanceEpsilon)
|
||||
r |= Directions.North;
|
||||
else if(d.Y < -ApproximateComparer.DistanceEpsilon)
|
||||
r |= Directions.South;
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static Directions VectorDirection(Point a, Point b) {
|
||||
Directions r = Directions.None;
|
||||
|
||||
// This method is called a lot as part of rectilinear layout.
|
||||
// Try to keep it quick.
|
||||
double horizontalDiff = b.X - a.X;
|
||||
double verticalDiff = b.Y - a.Y;
|
||||
double halfEpsilon = ApproximateComparer.DistanceEpsilon / 2;
|
||||
|
||||
if (horizontalDiff > halfEpsilon)
|
||||
r = Directions.East;
|
||||
else if (-horizontalDiff > halfEpsilon)
|
||||
r = Directions.West;
|
||||
if (verticalDiff > halfEpsilon)
|
||||
r |= Directions.North;
|
||||
else if (-verticalDiff > halfEpsilon)
|
||||
r |= Directions.South;
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static Directions DirectionsFromPointToPoint(Point a, Point b) {
|
||||
return VectorDirection(a, b);
|
||||
}
|
||||
|
||||
internal static Directions PureDirectionFromPointToPoint(Point a, Point b) {
|
||||
Directions dir = VectorDirection(a, b);
|
||||
Debug.Assert(IsPureDirection(dir), "Impure direction found");
|
||||
return dir;
|
||||
}
|
||||
|
||||
internal static Directions OppositeDir(Directions direction) {
|
||||
switch (direction) {
|
||||
case Directions.North:
|
||||
return Directions.South;
|
||||
case Directions.West:
|
||||
return Directions.East;
|
||||
case Directions.South:
|
||||
return Directions.North;
|
||||
case Directions.East:
|
||||
return Directions.West;
|
||||
default:
|
||||
return Directions.None;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsPureDirection(Directions direction) {
|
||||
switch (direction) {
|
||||
case Directions.North:
|
||||
return true;
|
||||
case Directions.East:
|
||||
return true;
|
||||
case Directions.South:
|
||||
return true;
|
||||
case Directions.West:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsPureDirection(Point a, Point b) {
|
||||
return IsPureDirection(DirectionsFromPointToPoint(a, b));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="other"></param>
|
||||
/// <returns></returns>
|
||||
public bool Equals(CompassVector other) {
|
||||
return Equals(other.Dir, Dir);
|
||||
}
|
||||
|
||||
|
||||
internal static bool DirectionsAreParallel(Directions a, Directions b){
|
||||
return a == b || a == OppositeDir(b);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public override bool Equals(object obj) {
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (obj.GetType() != typeof(CompassVector)) return false;
|
||||
return Equals((CompassVector)obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representing the direction.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
return Dir.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translates the CompassVector's direction into a new Point.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Point ToPoint() {
|
||||
var p = new Point();
|
||||
if ((Dir & Directions.East) == Directions.East)
|
||||
p.X += 1;
|
||||
if ((Dir & Directions.North) == Directions.North)
|
||||
p.Y += 1;
|
||||
if ((Dir & Directions.West) == Directions.West)
|
||||
p.X -= 1;
|
||||
if ((Dir & Directions.South) == Directions.South)
|
||||
p.Y -= 1;
|
||||
return p;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translates a direction into a Point.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Point ToPoint(Directions dir) {
|
||||
return (new CompassVector(dir)).ToPoint();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the negation operator
|
||||
/// </summary>
|
||||
/// <param name="directionVector"></param>
|
||||
/// <returns></returns>
|
||||
public static CompassVector operator -(CompassVector directionVector) {
|
||||
return new CompassVector(OppositeDir(directionVector.Dir));
|
||||
}
|
||||
/// <summary>
|
||||
/// the negation operator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public CompassVector Negate() {
|
||||
return -this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/CompassVector.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/CompassVector.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f1d55eb0ba264f45943033b4518baf5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core/Geometry/ConvexHull.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core/Geometry/ConvexHull.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6c814fa42e9363c49ac9b234daeea29b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
196
Assets/Scripts/NIH/MSAGL/Core/Geometry/ConvexHull/ConvexHull.cs
Normal file
196
Assets/Scripts/NIH/MSAGL/Core/Geometry/ConvexHull/ConvexHull.cs
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Msagl.Core.Geometry.Curves;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
using Microsoft.Msagl.DebugHelpers;
|
||||
using Microsoft.Msagl.Routing;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
/// <summary>
|
||||
/// Creates the convex hull of a set of points following "Computational Geometry, second edition" of O'Rourke
|
||||
/// </summary>
|
||||
public sealed class ConvexHull {
|
||||
HullPoint[] hullPoints;
|
||||
Point pivot;
|
||||
HullStack stack;
|
||||
HullPointComparer comparer;
|
||||
|
||||
ConvexHull(IEnumerable<Point> bodyPoints) {
|
||||
SetPivotAndAllocateHullPointsArray(bodyPoints);
|
||||
}
|
||||
|
||||
void SetPivotAndAllocateHullPointsArray(IEnumerable<Point> bodyPoints) {
|
||||
pivot = new Point(0, Double.MaxValue); //set Y to a very big value
|
||||
int pivotIndex = -1;
|
||||
int n = 0;
|
||||
foreach (Point point in bodyPoints) {
|
||||
if (point.Y < pivot.Y) {
|
||||
pivot = point;
|
||||
pivotIndex = n;
|
||||
}
|
||||
else if (point.Y == pivot.Y)
|
||||
if (point.X > pivot.X) {
|
||||
pivot = point;
|
||||
pivotIndex = n;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
if (n >= 1) {
|
||||
hullPoints = new HullPoint[n - 1]; //we will not copy the pivot into the hull points
|
||||
n = 0;
|
||||
foreach (Point point in bodyPoints)
|
||||
if (n != pivotIndex)
|
||||
hullPoints[n++] = new HullPoint(point);
|
||||
else
|
||||
pivotIndex = -1; //forget where the pivot was
|
||||
}
|
||||
}
|
||||
|
||||
Point StackTopPoint {
|
||||
get { return stack.Point; }
|
||||
}
|
||||
|
||||
Point StackSecondPoint {
|
||||
get { return stack.Next.Point; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// calculates the convex hull of the given set of points
|
||||
/// </summary>
|
||||
/// <param name="pointsOfTheBody">Point of the convex hull.</param>
|
||||
/// <returns>The list of extreme points of the hull boundaries in the clockwise order</returns>
|
||||
public static IEnumerable<Point> CalculateConvexHull(IEnumerable<Point> pointsOfTheBody) {
|
||||
var convexHull = new ConvexHull(pointsOfTheBody);
|
||||
return convexHull.Calculate();
|
||||
}
|
||||
|
||||
IEnumerable<Point> Calculate() {
|
||||
if (pivot.Y == Double.MaxValue)
|
||||
return new Point[0];
|
||||
if (hullPoints.Length == 0)
|
||||
return new[] {pivot};
|
||||
SortAllPointsWithoutPivot();
|
||||
Scan();
|
||||
return EnumerateStack();
|
||||
}
|
||||
|
||||
IEnumerable<Point> EnumerateStack() {
|
||||
HullStack stackCell = stack;
|
||||
while (stackCell != null) {
|
||||
yield return stackCell.Point;
|
||||
stackCell = stackCell.Next;
|
||||
}
|
||||
}
|
||||
|
||||
void Scan() {
|
||||
int i = 0;
|
||||
while (hullPoints[i].Deleted)
|
||||
i++;
|
||||
|
||||
stack = new HullStack(pivot);
|
||||
Push(i++);
|
||||
if (i < hullPoints.Length) {
|
||||
if (!hullPoints[i].Deleted)
|
||||
Push(i++);
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
while (i < hullPoints.Length) {
|
||||
if (!hullPoints[i].Deleted) {
|
||||
if (LeftTurn(i))
|
||||
Push(i++);
|
||||
else
|
||||
Pop();
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
//cleanup the end
|
||||
while (StackHasMoreThanTwoPoints() && !LeftTurnToPivot())
|
||||
Pop();
|
||||
}
|
||||
|
||||
bool LeftTurnToPivot() {
|
||||
return Point.GetTriangleOrientation(StackSecondPoint, StackTopPoint, pivot) ==
|
||||
TriangleOrientation.Counterclockwise;
|
||||
}
|
||||
|
||||
bool StackHasMoreThanTwoPoints() {
|
||||
return stack.Next != null && stack.Next.Next != null;
|
||||
}
|
||||
|
||||
void Pop() {
|
||||
stack = stack.Next;
|
||||
}
|
||||
|
||||
|
||||
bool LeftTurn(int i) {
|
||||
if (stack.Next == null)
|
||||
return true; //there is only one point in the stack
|
||||
var orientation = Point.GetTriangleOrientationWithIntersectionEpsilon(StackSecondPoint, StackTopPoint, hullPoints[i].Point);
|
||||
if (orientation == TriangleOrientation.Counterclockwise)
|
||||
return true;
|
||||
if (orientation == TriangleOrientation.Clockwise)
|
||||
return false;
|
||||
return BackSwitchOverPivot(hullPoints[i].Point);
|
||||
}
|
||||
bool BackSwitchOverPivot(Point point) {
|
||||
//we know here that there at least two points in the stack but it has to be exaclty two
|
||||
if (stack.Next.Next != null)
|
||||
return false;
|
||||
Debug.Assert(StackSecondPoint == pivot);
|
||||
return StackTopPoint.X > pivot.X + ApproximateComparer.DistanceEpsilon &&
|
||||
point.X < pivot.X - ApproximateComparer.DistanceEpsilon;
|
||||
}
|
||||
|
||||
void Push(int p) {
|
||||
var t = new HullStack(hullPoints[p].Point) {Next = stack};
|
||||
stack = t;
|
||||
}
|
||||
|
||||
void SortAllPointsWithoutPivot() {
|
||||
comparer = new HullPointComparer(pivot);
|
||||
Array.Sort(hullPoints, comparer);
|
||||
// if (true) {
|
||||
// var list = new List<DebugCurve>();
|
||||
// var d = 3.0;
|
||||
// list.Add(new DebugCurve(100, 0.001, "magenta", El(ref d, pivot)));
|
||||
// foreach (var hullPoint in hullPoints) {
|
||||
// list.Add(new DebugCurve(100,0.001, hullPoint.Deleted ? "blue" : "green", El(ref d, hullPoint.Point)));
|
||||
// }
|
||||
// LayoutAlgorithmSettings.ShowDebugCurvesEnumeration(list);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Ellipse El(ref double d, Point p) {
|
||||
var ret= new Ellipse(d, d, p);
|
||||
d -= 0.01;
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object)")]
|
||||
internal static Polyline CreateConvexHullAsClosedPolyline(IEnumerable<Point> points) {
|
||||
var convexHull = new Polyline(CalculateConvexHull(points)) { Closed = true };
|
||||
#if TEST_MSAGL
|
||||
foreach (var point in points) {
|
||||
if (Curve.PointRelativeToCurveLocation(point, convexHull) == PointLocation.Outside) {
|
||||
var hullPoint = convexHull[convexHull.ClosestParameter(point)];
|
||||
|
||||
// This can be too restrictive if very close points are put into the hull. It is probably
|
||||
// better to clean up in the caller before doing this, but this assert can also be relaxed.
|
||||
Debug.Assert(ApproximateComparer.Close(point, hullPoint, ApproximateComparer.IntersectionEpsilon * 20), String.Format("not CloseIntersections: initial point {0}, hull point {1}", point, hullPoint));
|
||||
|
||||
}
|
||||
}
|
||||
#endif // TEST_MSAGL
|
||||
return convexHull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 848192ed3ea85614cb33c20793d74157
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
internal class HullPoint {
|
||||
Point point;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Point Point {
|
||||
get { return point; }
|
||||
set { point = value; }
|
||||
}
|
||||
bool deleted;
|
||||
|
||||
internal bool Deleted {
|
||||
get { return deleted; }
|
||||
set { deleted = value; }
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal HullPoint(Point point) {
|
||||
this.Point = point;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return point + (Deleted ? "X" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a24e6188dd050ce46850d17ef181852b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
internal class HullPointComparer:IComparer<HullPoint> {
|
||||
Point pivot;
|
||||
|
||||
/// <summary>
|
||||
/// note that this function can change "deleted" member for collinear points
|
||||
/// </summary>
|
||||
/// <param name="i"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
#if SHARPKIT //http://code.google.com/p/sharpkit/issues/detail?id=203
|
||||
//SharpKit/Colin - https://code.google.com/p/sharpkit/issues/detail?id=332
|
||||
public int Compare(HullPoint i, HullPoint j) {
|
||||
#else
|
||||
int IComparer<HullPoint>.Compare(HullPoint i, HullPoint j) {
|
||||
#endif
|
||||
if (i == j)
|
||||
return 0;
|
||||
if (i == null)
|
||||
return -1;
|
||||
if (j == null)
|
||||
return 1;
|
||||
|
||||
switch (Point.GetTriangleOrientationWithIntersectionEpsilon(pivot, i.Point, j.Point)) {
|
||||
case TriangleOrientation.Counterclockwise:
|
||||
return -1;
|
||||
case TriangleOrientation.Clockwise:
|
||||
return 1;
|
||||
case TriangleOrientation.Collinear: {
|
||||
//because of the double point error pi and pj can be on different sizes of the pivot on the horizontal line passing through the pivot, or rather just above it
|
||||
var piDelX = i.Point.X - pivot.X;
|
||||
var pjDelX = j.Point.X - pivot.X;
|
||||
if (piDelX > ApproximateComparer.DistanceEpsilon && pjDelX < -ApproximateComparer.DistanceEpsilon) {
|
||||
return -1;
|
||||
}
|
||||
if (piDelX < -ApproximateComparer.DistanceEpsilon && pjDelX > ApproximateComparer.DistanceEpsilon) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//here i and j cannot be on the different sides of the pivot because of the choice of the pivot
|
||||
//delete the one that is closer to the pivot.
|
||||
var pi = i.Point - pivot;
|
||||
var pj = j.Point - pivot;
|
||||
var iMinJ = pi.L1 - pj.L1;
|
||||
if (iMinJ < 0) {
|
||||
i.Deleted = true;
|
||||
return -1;
|
||||
}
|
||||
if (iMinJ > 0) {
|
||||
j.Deleted = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//points are the same, leave the one with the greatest hash code
|
||||
if (i.GetHashCode() < j.GetHashCode())
|
||||
i.Deleted = true;
|
||||
else
|
||||
j.Deleted = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal HullPointComparer(Point pivotPoint) {
|
||||
this.pivot = pivotPoint;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5544c1d609815f24db41713b5cee93c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
namespace Microsoft.Msagl.Core.Geometry {
|
||||
internal class HullStack {
|
||||
Point hullPoint;
|
||||
|
||||
internal Point Point {
|
||||
get { return hullPoint; }
|
||||
set { hullPoint = value; }
|
||||
}
|
||||
HullStack next;
|
||||
|
||||
internal HullStack Next {
|
||||
get { return next; }
|
||||
set { next = value; }
|
||||
}
|
||||
|
||||
internal HullStack(Point hullPoint) {
|
||||
this.Point = hullPoint;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return hullPoint.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5d2bc29fc3a11c408e92a50c141d04c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves.meta
Normal file
8
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f26b9b4baf6941a4d8b4c04ce6bfc6fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
internal class ClosestPointOnCurve {
|
||||
ClosestPointOnCurve() { }
|
||||
///// <summary>
|
||||
///// Gets the closest point on the curve to the point
|
||||
///// </summary>
|
||||
///// <param name="curve"></param>
|
||||
///// <param name="coeff"></param>
|
||||
///// <param name="hint">will return Double.MaxVal if Newton iterations fail</param>
|
||||
///// <param name="closestPointParam"></param>
|
||||
internal static double ClosestPoint(ICurve curve, Point a, double hint, double low, double high) {
|
||||
/*
|
||||
* Let F=(c(t)-a)^2. We try to bring to zero the first derivative of F, Ft. Denote it by f(t).
|
||||
* Applying the Newton method we see that dt=-f(t)/der(f(t)
|
||||
* The first derivative of F, f, has the form (c-a)*ct. We discarded a multiplier here.
|
||||
* The second derivative has the form ct*ct+(c-a)*ctt
|
||||
* The new t becomes t-dt
|
||||
*/
|
||||
const int numberOfIterationsMax = 5;
|
||||
const int numberOfOverShootsMax = 5;
|
||||
double t = hint;
|
||||
|
||||
int numberOfIteration = 0;
|
||||
int numberOfOvershoots = 0;
|
||||
double dt;
|
||||
bool abort = false;
|
||||
do {
|
||||
Point c = curve[t];
|
||||
Point ct = curve.Derivative(t);
|
||||
Point ctt = curve.SecondDerivative(t);
|
||||
|
||||
double secondDerivative = ct * ct + (c - a) * ctt;
|
||||
|
||||
if (Math.Abs(secondDerivative) < ApproximateComparer.Tolerance)
|
||||
return t;
|
||||
|
||||
dt = (c - a) * ct / secondDerivative;
|
||||
|
||||
t -= dt;
|
||||
|
||||
if (t > high + ApproximateComparer.Tolerance) {
|
||||
t = high;
|
||||
numberOfOvershoots++;
|
||||
} else if (t < low - ApproximateComparer.Tolerance) {
|
||||
t = low;
|
||||
numberOfOvershoots++;
|
||||
}
|
||||
numberOfIteration++;
|
||||
} while (Math.Abs(dt) > ApproximateComparer.Tolerance &&!
|
||||
(abort = (numberOfIteration >= numberOfIterationsMax || numberOfOvershoots >= numberOfOverShootsMax)));
|
||||
|
||||
//may be the initial value was just fine
|
||||
if (abort && (curve[hint] - a).Length < ApproximateComparer.DistanceEpsilon)
|
||||
t = hint;
|
||||
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c70b0860b9cf2454a852dff5c58a0ba7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,630 @@
|
|||
// #region Using directives
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.Msagl.Core.DataStructures;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
using Microsoft.Msagl.DebugHelpers;
|
||||
//#endregion
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// Cubic Bezier Segment
|
||||
/// </summary>
|
||||
#if TEST_MSAGL
|
||||
[Serializable]
|
||||
#endif
|
||||
public class CubicBezierSegment : ICurve {
|
||||
|
||||
/// <summary>
|
||||
/// left derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point LeftDerivative(double t) {
|
||||
return Derivative(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// right derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point RightDerivative(double t) {
|
||||
return Derivative(t);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// control points
|
||||
/// </summary>
|
||||
Point[] b = new Point[4];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// coefficients
|
||||
/// </summary>
|
||||
Point l, e, c;
|
||||
|
||||
/// <summary>
|
||||
/// get a control point
|
||||
/// </summary>
|
||||
/// <param name="controlPointIndex"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "B")]
|
||||
public Point B(int controlPointIndex) {
|
||||
return b[controlPointIndex];
|
||||
}
|
||||
/// <summary>
|
||||
/// ToString
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
override public string ToString() {
|
||||
return String.Format(CultureInfo.InvariantCulture, "(Bezie{0},{1},{2},{3})", b[0], b[1], b[2], b[3]);
|
||||
}
|
||||
ParallelogramNodeOverICurve pBoxNode;
|
||||
/// <summary>
|
||||
/// A tree of ParallelogramNodes covering the curve.
|
||||
/// This tree is used in curve intersections routines.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public ParallelogramNodeOverICurve ParallelogramNodeOverICurve {
|
||||
get {
|
||||
#if PPC
|
||||
lock(this){
|
||||
#endif
|
||||
if (pBoxNode != null)
|
||||
return pBoxNode;
|
||||
return pBoxNode = ParallelogramNodeOverICurve.CreateParallelogramNodeForCurveSegment(this);
|
||||
#if PPC
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the point on the curve corresponding to parameter t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point this[double t] {
|
||||
get {
|
||||
double t2 = t * t;
|
||||
double t3 = t2 * t;
|
||||
return l * t3 + e * t2 + c * t + b[0];
|
||||
}
|
||||
}
|
||||
|
||||
static void AdjustParamTo01(ref double u) {
|
||||
if (u > 1)
|
||||
u = 1;
|
||||
else if (u < 0)
|
||||
u = 0;
|
||||
}
|
||||
//throw away the segments [0,u] and [v,1] of the segment
|
||||
|
||||
/// <summary>
|
||||
/// Returns the trimmed curve
|
||||
/// </summary>
|
||||
/// <param name="u"></param>
|
||||
/// <param name="v"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve Trim(double u, double v) {
|
||||
|
||||
AdjustParamTo01(ref u);
|
||||
AdjustParamTo01(ref v);
|
||||
|
||||
if (u > v)
|
||||
return Trim(v, u);
|
||||
|
||||
if (u > 1.0 - ApproximateComparer.Tolerance)
|
||||
return new CubicBezierSegment(b[3], b[3], b[3], b[3]);
|
||||
|
||||
Point[] b1 = new Point[3];
|
||||
Point[] b2 = new Point[2];
|
||||
Point pv = Casteljau(u, b1, b2);
|
||||
|
||||
//this will be the trim to [v,1]
|
||||
CubicBezierSegment trimByU = new CubicBezierSegment(pv, b2[1], b1[2], b[3]);
|
||||
|
||||
|
||||
//1-v is not zero here because we have handled already the case v=1
|
||||
Point pu = trimByU.Casteljau((v - u) / (1.0 - u), b1, b2);
|
||||
|
||||
return new CubicBezierSegment(trimByU.b[0], b1[0], b2[0], pu);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not Implemented: Returns the trimmed curve, wrapping around the end if start is greater than end.
|
||||
/// </summary>
|
||||
/// <param name="start">The starting parameter</param>
|
||||
/// <param name="end">The ending parameter</param>
|
||||
/// <returns>The trimmed curve</returns>
|
||||
public ICurve TrimWithWrap(double start, double end) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//array for Casteljau method
|
||||
internal Point Casteljau(double t, Point[] b1, Point[] b2) {
|
||||
|
||||
double f = 1.0 - t;
|
||||
for (int i = 0; i < 3; i++)
|
||||
b1[i] = b[i] * f + b[i + 1] * t;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
b2[i] = b1[i] * f + b1[i + 1] * t;
|
||||
|
||||
return b2[0] * f + b2[1] * t;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// first derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point Derivative(double t) {
|
||||
return 3 * l * t * t + 2 * e * t + c;
|
||||
}
|
||||
/// <summary>
|
||||
/// second derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point SecondDerivative(double t) { return 6 * l * t + 2 * e; }
|
||||
|
||||
/// <summary>
|
||||
/// third derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point ThirdDerivative(double t) { return 6 * l; }
|
||||
/// <summary>
|
||||
/// the constructor
|
||||
/// </summary>
|
||||
/// <param name="b0"></param>
|
||||
/// <param name="b1"></param>
|
||||
/// <param name="b2"></param>
|
||||
/// <param name="b3"></param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1025:ReplaceRepetitiveArgumentsWithParamsArray"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "b")]
|
||||
public CubicBezierSegment(Point b0, Point b1, Point b2, Point b3) {
|
||||
|
||||
this.b[0] = b0;
|
||||
this.b[1] = b1;
|
||||
this.b[2] = b2;
|
||||
this.b[3] = b3;
|
||||
c = 3 * (b[1] - b[0]);
|
||||
e = 3 * (b[2] - b[1]) - c;
|
||||
l = b[3] - b[0] - c - e;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this[ParStart]
|
||||
/// </summary>
|
||||
public Point Start {
|
||||
get { return b[0]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this[ParEnd]
|
||||
/// </summary>
|
||||
public Point End {
|
||||
get { return b[3]; }
|
||||
}
|
||||
|
||||
|
||||
double parStart;
|
||||
|
||||
/// <summary>
|
||||
/// the start of the parameter domain
|
||||
/// </summary>
|
||||
public double ParStart {
|
||||
get { return parStart; }
|
||||
set { parStart = value; }
|
||||
}
|
||||
|
||||
double parEnd = 1;
|
||||
|
||||
/// <summary>
|
||||
/// the end of the parameter domain
|
||||
/// </summary>
|
||||
public double ParEnd {
|
||||
get { return parEnd; }
|
||||
set { parEnd = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this[Reverse[t]]=this[ParEnd+ParStart-t]
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICurve Reverse() {
|
||||
return new CubicBezierSegment(b[3], b[2], b[1], b[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved moved by delta
|
||||
/// </summary>
|
||||
public void Translate(Point delta) {
|
||||
this.b[0] += delta;
|
||||
this.b[1] += delta;
|
||||
this.b[2] += delta;
|
||||
this.b[3] += delta;
|
||||
c = 3 * (b[1] - b[0]);
|
||||
e = 3 * (b[2] - b[1]) - c;
|
||||
l = b[3] - b[0] - c - e;
|
||||
|
||||
pBoxNode = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved scaled by x and y
|
||||
/// </summary>
|
||||
/// <param name="xScale"></param>
|
||||
/// <param name="yScale"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve ScaleFromOrigin(double xScale, double yScale)
|
||||
{
|
||||
return new CubicBezierSegment(Point.Scale(xScale, yScale, b[0]), Point.Scale(xScale, yScale, b[1]), Point.Scale(xScale, yScale, b[2]), Point.Scale(xScale, yScale, b[3]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Offsets the curve in the direction of dir
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="dir"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve OffsetCurve(double offset, Point dir) { return null; }
|
||||
|
||||
/// <summary>
|
||||
/// return length of the curve segment [start,end]
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public double LengthPartial(double start, double end) {
|
||||
return Trim(start, end).Length;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the length of the curve
|
||||
/// </summary>
|
||||
public double Length {
|
||||
get { return LengthOnControlPolygon(b[0],b[1],b[2],b[3]); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="b0"></param>
|
||||
/// <param name="b1"></param>
|
||||
/// <param name="b2"></param>
|
||||
/// <param name="b3"></param>
|
||||
/// <returns></returns>
|
||||
static double LengthOnControlPolygon(Point b0, Point b1, Point b2, Point b3) {
|
||||
var innerCordLength = (b3- b0).Length;
|
||||
var controlPointPolygonLength = (b1 - b0).Length + (b2 - b1).Length + (b3 - b2).Length;
|
||||
if (controlPointPolygonLength - innerCordLength > Curve.LineSegmentThreshold) {
|
||||
var mb0 = (b0 + b1)/2;
|
||||
var mb1 = (b1 + b2)/2;
|
||||
var mb2=(b2 + b3)/2;
|
||||
var mmb0 = (mb0 + mb1)/2;
|
||||
var mmb1 = (mb2 + mb1)/2;
|
||||
var mmmb0 = (mmb0 + mmb1)/2;
|
||||
// LayoutAlgorithmSettings.ShowDebugCurves(new DebugCurve(100, 2, "blue", new CubicBezierSegment(b0, b1, b2, b3)), new DebugCurve(100, 1, "red", new CubicBezierSegment(b0, mb0, mmb0, mmmb0)), new DebugCurve(100, 1, "green", new CubicBezierSegment(mmmb0, mmb1, mb2, b3)));
|
||||
return LengthOnControlPolygon(b0, mb0, mmb0, mmmb0) + LengthOnControlPolygon(mmmb0, mmb1, mb2, b3);
|
||||
}
|
||||
|
||||
return (controlPointPolygonLength + innerCordLength) / 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the segment bounding box
|
||||
/// </summary>
|
||||
public Rectangle BoundingBox {
|
||||
get {
|
||||
var ret = new Rectangle(this.b[0], this.b[1]);
|
||||
ret.Add(b[2]);
|
||||
ret.Add(b[3]);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return the transformed curve
|
||||
/// </summary>
|
||||
/// <param name="transformation"></param>
|
||||
/// <returns>the transformed curve</returns>
|
||||
public ICurve Transform(PlaneTransformation transformation) {
|
||||
return new CubicBezierSegment(transformation * b[0], transformation * b[1], transformation * b[2], transformation * b[3]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and targetPoint is minimal
|
||||
/// and t belongs to the closed segment [low,high]
|
||||
/// </summary>
|
||||
/// <param name="targetPoint">the point to find the closest point</param>
|
||||
/// <param name="high">the upper bound of the parameter</param>
|
||||
/// <param name="low">the low bound of the parameter</param>
|
||||
/// <returns></returns>
|
||||
public double ClosestParameterWithinBounds(Point targetPoint, double low, double high) {
|
||||
System.Diagnostics.Debug.Assert(high <= 1 && low >= 0);
|
||||
System.Diagnostics.Debug.Assert(low <= high);
|
||||
double t = (high-low) / 8;
|
||||
double closest = 0;
|
||||
double minDist = Double.MaxValue;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Point p = targetPoint - this[i * t + low];
|
||||
double d = p * p;
|
||||
if (d < minDist) {
|
||||
minDist = d;
|
||||
closest = i * t + low;
|
||||
}
|
||||
}
|
||||
return ClosestPointOnCurve.ClosestPoint(this, targetPoint, closest, low, high);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// clones the curve.
|
||||
/// </summary>
|
||||
/// <returns>the cloned curve</returns>
|
||||
public ICurve Clone() {
|
||||
return new CubicBezierSegment(this.b[0], this.b[1], this.b[2], this.b[3]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the signed curvature of the segment at t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double Curvature(double t) {
|
||||
System.Diagnostics.Debug.Assert(t >= ParStart && t <= ParEnd);
|
||||
|
||||
double den = G(t);
|
||||
|
||||
System.Diagnostics.Debug.Assert(Math.Abs(den) > 0.00001);
|
||||
|
||||
return F(t) / den;
|
||||
}
|
||||
|
||||
|
||||
double F(double t) {
|
||||
return Xp(t) * Ypp(t) - Yp(t) * Xpp(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// G(t) is the denomenator of the curvature
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
double G(double t) {
|
||||
double xp = Xp(t);
|
||||
double yp = Yp(t);
|
||||
double den = (xp * xp + yp * yp);
|
||||
return Math.Sqrt(den * den * den);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the first derivative of x-coord
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
double Xp(double t) {
|
||||
return 3 * l.X * t * t + 2 * e.X * t + c.X;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the second derivativ of y-coordinate
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
double Ypp(double t) {
|
||||
return 6 * l.Y * t + 2 * e.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the first derivative of y-coord
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
double Yp(double t) {
|
||||
return 3 * l.Y * t * t + 2 * e.Y * t + c.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the seconde derivative of x coord
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
double Xpp(double t) {
|
||||
return 6 * l.X * t + 2 * e.X;
|
||||
}
|
||||
/// <summary>
|
||||
/// the third derivative of x coordinate
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "t")]
|
||||
double Xppp(double t) {
|
||||
return 6 * l.X;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the third derivative of y coordinate
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "t")]
|
||||
double Yppp(double t) {
|
||||
return 6 * l.Y;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the derivative of the curvature at t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureDerivative(double t) {
|
||||
// we need to calculate the derivative of f/g where f=xp* ypp-yp*xpp and g=(xp*xp+yp*yp)^(3/2)
|
||||
double h = G(t);
|
||||
return (Fp(t) * h - Gp(t) * F(t)) / (h * h);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
double Fp(double t) {
|
||||
return Xp(t) * Yppp(t) - Yp(t) * Xppp(t);
|
||||
}
|
||||
|
||||
double Fpp(double t) {
|
||||
return Xpp(t) * Yppp(t) // + Xp(t) * Ypppp(t)=0
|
||||
- Ypp(t) * Xppp(t);//- Yp(t) * Xpppp(t)=0
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and a is minimal
|
||||
/// </summary>
|
||||
/// <param name="targetPoint"></param>
|
||||
/// <returns></returns>
|
||||
public double ClosestParameter(Point targetPoint) {
|
||||
double t = 1.0 / 8;
|
||||
double closest = 0;
|
||||
double minDist = Double.MaxValue;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Point p = targetPoint - this[i * t];
|
||||
double d = p * p;
|
||||
if (d < minDist) {
|
||||
minDist = d;
|
||||
closest = i * t;
|
||||
}
|
||||
}
|
||||
return ClosestPointOnCurve.ClosestPoint(this, targetPoint, closest, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
|
||||
public IEnumerable<Tuple<double, double>> MaximalCurvaturePoints {
|
||||
get {
|
||||
|
||||
List<Tuple<double, double>> maxCurveCandidates = new List<Tuple<double, double>>();
|
||||
|
||||
|
||||
int n = 8;
|
||||
double d = 1.0 / n;
|
||||
double prev = -1;//out of the domain
|
||||
for (int i = 0; i < n; i++) {
|
||||
double start = i * d;
|
||||
double end = start + d;
|
||||
double x;
|
||||
if (RootFinder.TryToFindRoot(new CurvatureDerivative(this, start, end), start, end, (start + end) / 2, out x)) {
|
||||
if (x != prev) {
|
||||
prev = x;
|
||||
maxCurveCandidates.Add(new Tuple<double, double>(x, Curvature(x)));
|
||||
}
|
||||
}
|
||||
}
|
||||
maxCurveCandidates.Add(new Tuple<double, double>(ParStart, Curvature(ParStart)));
|
||||
maxCurveCandidates.Add(new Tuple<double, double>(ParEnd, Curvature(ParEnd)));
|
||||
|
||||
var maxCur = maxCurveCandidates.Max(l => Math.Abs(l.Item2));
|
||||
|
||||
return from v in maxCurveCandidates where Math.Abs(v.Item2) == maxCur select v;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region ICurve Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureSecondDerivative(double t) {
|
||||
double g = G(t);
|
||||
return (Qp(t) * g - 2 * Q(t) * Gp(t)) / (g * g * g);
|
||||
}
|
||||
|
||||
double Q(double t) {
|
||||
return Fp(t) * G(t) - Gp(t) * F(t);
|
||||
}
|
||||
|
||||
double Qp(double t) {
|
||||
return Fpp(t) * G(t) - Gpp(t) * F(t);
|
||||
}
|
||||
|
||||
double Gpp(double t) {
|
||||
var xp = Xp(t);
|
||||
var yp = Yp(t);
|
||||
var xpp = Xpp(t);
|
||||
var ypp = Ypp(t);
|
||||
var xppp = Xppp(t);
|
||||
var yppp = Yppp(t);
|
||||
var u = Math.Sqrt(xp * xp + yp * yp);
|
||||
var v = xp * xpp + yp * ypp;
|
||||
return 3 * ((v * v) / u + u * (xpp * xpp + xp * xppp + ypp * ypp + yp * yppp));
|
||||
|
||||
}
|
||||
|
||||
double Gp(double t) {
|
||||
var xp = Xp(t);
|
||||
var yp = Yp(t);
|
||||
var xpp = Xpp(t);
|
||||
var ypp = Ypp(t);
|
||||
return 3 * Math.Sqrt(xp * xp + yp * yp) * (xp * xpp + yp * ypp);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public double GetParameterAtLength(double length) {
|
||||
double low = 0;
|
||||
double upper = 1;
|
||||
while (upper - low > ApproximateComparer.Tolerance) {
|
||||
var middle = (upper + low)/2;
|
||||
int err = EvaluateError(length, middle);
|
||||
if (err > 0)
|
||||
upper = middle;
|
||||
else if (err < 0)
|
||||
low = middle;
|
||||
else
|
||||
return middle;
|
||||
}
|
||||
|
||||
return (low + upper)/2;
|
||||
}
|
||||
|
||||
int EvaluateError(double length, double t) {
|
||||
//todo: this is a slow version!
|
||||
var f = 1 - t;
|
||||
var mb0 = f*b[0] + t*b[1];
|
||||
var mb1 = f*b[1] + t*b[2];
|
||||
var mb2 = f*b[2] + t*b[3];
|
||||
var mmb0 = f * mb0 + t * mb1;
|
||||
var mmb1 = f * mb1 + t * mb2;
|
||||
var mmmb0 = f * mmb0 + t * mmb1;
|
||||
|
||||
var lengthAtT = LengthOnControlPolygon(b[0], mb0, mmb0, mmmb0);
|
||||
|
||||
if (lengthAtT > length + ApproximateComparer.DistanceEpsilon)
|
||||
return 1;
|
||||
|
||||
if (lengthAtT < length - ApproximateComparer.DistanceEpsilon)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0bcfc220e0631264ba44cc8179e030cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CurvatureDerivative : IFunction {
|
||||
ICurve curve;
|
||||
double start;
|
||||
double end;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
public CurvatureDerivative(ICurve curve, double start, double end) {
|
||||
this.curve = curve;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double this[double t] {
|
||||
get { return curve.CurvatureDerivative(t); }
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double Derivative(double t) {
|
||||
return curve.CurvatureSecondDerivative(t);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double SecondDerivative(double t) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double ThirdDerivative(double t) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double ParStart {
|
||||
get {return start; }
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double ParEnd {
|
||||
get { return end; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bb98496b3d0bc244bb7bd7746d7136d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2109
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Curve.cs
Normal file
2109
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Curve.cs
Normal file
File diff suppressed because it is too large
Load diff
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Curve.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Curve.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 57f594541b890cb47891b3a90e1b5045
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
397
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/CurveFactory.cs
Normal file
397
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/CurveFactory.cs
Normal file
|
|
@ -0,0 +1,397 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// the helper class to create curves
|
||||
/// </summary>
|
||||
public sealed class CurveFactory {
|
||||
CurveFactory() { }
|
||||
/// <summary>
|
||||
/// Creates an ellipse by the length of axes and the center
|
||||
/// </summary>
|
||||
/// <param name="radiusInXDirection"></param>
|
||||
/// <param name="radiusInYDirection"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateEllipse(double radiusInXDirection, double radiusInYDirection, Point center) {
|
||||
return new Ellipse(radiusInXDirection, radiusInYDirection, center);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an ellipse by the length of axes and the center
|
||||
/// </summary>
|
||||
/// <param name="radius"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateCircle(double radius, Point center) {
|
||||
return new Ellipse(radius, radius, center);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a rectangle with smoothed corners
|
||||
/// </summary>
|
||||
/// <param name="width">the rectangle width</param>
|
||||
/// <param name="height">the rectangle height</param>
|
||||
/// <param name="radiusInXDirection">the length of the x axis of the corner smoothing ellipse</param>
|
||||
/// <param name="radiusInYDirection">the length of the y axis of the corner smoothing ellipse</param>
|
||||
/// <param name="center">the rectangle center</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateRectangleWithRoundedCorners(double width, double height, double radiusInXDirection, double radiusInYDirection, Point center) {
|
||||
var box = new Rectangle(center.X - width / 2, center.Y - height / 2, center.X + width / 2, center.Y + height / 2);
|
||||
return new RoundedRect(box, radiusInXDirection, radiusInYDirection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create in the specified curve, a rectangle with smoothed corners
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="width">the rectangle width</param>
|
||||
/// <param name="height">the rectangle height</param>
|
||||
/// <param name="radiusInXDirection">the length of the x axis of the corner smoothing ellipse</param>
|
||||
/// <param name="radiusInYDirection">the length of the y axis of the corner smoothing ellipse</param>
|
||||
/// <param name="center">the rectangle center</param>
|
||||
/// <returns></returns>
|
||||
static internal void CreateRectangleWithRoundedCorners(Curve c, double width, double height, double radiusInXDirection, double radiusInYDirection, Point center) {
|
||||
if (radiusInXDirection == 0 || radiusInYDirection == 0) {
|
||||
CreateRectangle(c, width, height, center);
|
||||
return;
|
||||
}
|
||||
double w = width / 2;
|
||||
if (radiusInXDirection > w / 2)
|
||||
radiusInXDirection = w / 2;
|
||||
double h = height / 2;
|
||||
if (radiusInYDirection > h / 2)
|
||||
radiusInYDirection = h / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
double ox = w - radiusInXDirection;
|
||||
double oy = h - radiusInYDirection;
|
||||
double top = y + h;
|
||||
double bottom = y - h;
|
||||
double left = x - w;
|
||||
double right = x + w;
|
||||
//ellipse's axises
|
||||
Point a = new Point(radiusInXDirection, 0);
|
||||
Point b = new Point(0, radiusInYDirection);
|
||||
|
||||
c.IncreaseSegmentCapacity(8);
|
||||
|
||||
if (ox > 0)
|
||||
c.AddSegment(new LineSegment(new Point(x - ox, bottom), new Point(x + ox, bottom)));
|
||||
c.AddSegment(new Ellipse(1.5 * Math.PI, 2 * Math.PI, a, b, x + ox, y - oy));
|
||||
if (oy > 0)
|
||||
c.AddSegment(new LineSegment(new Point(right, y - oy), new Point(right, y + oy)));
|
||||
c.AddSegment(new Ellipse(0, 0.5 * Math.PI, a, b, x + ox, y + oy));
|
||||
if (ox > 0)
|
||||
c.AddSegment(new LineSegment(new Point(x + ox, top), new Point(x - ox, top)));
|
||||
c.AddSegment(new Ellipse(0.5 * Math.PI, Math.PI, a, b, x - ox, y + oy));
|
||||
if (oy > 0)
|
||||
c.AddSegment(new LineSegment(new Point(left, y + oy), new Point(left, y - oy)));
|
||||
c.AddSegment(new Ellipse(Math.PI, 1.5 * Math.PI, a, b, x - ox, y - oy));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a box of the given width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateRectangle(double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Curve c = new Curve();
|
||||
Point[] p = new Point[] { new Point(x - w, y - h), new Point(x + w, y - h), new Point(x + w, y + h), new Point(x - w, y + h) };
|
||||
c.AddSegs(new LineSegment(p[0], p[1]), new LineSegment(p[1], p[2]), new LineSegment(p[2], p[3]), new LineSegment(p[3], p[0]));
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a box of the given width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <returns></returns>
|
||||
static internal void CreateRectangle(Curve c, double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Point[] p = new Point[] { new Point(x - w, y - h), new Point(x + w, y - h), new Point(x + w, y + h), new Point(x - w, y + h) };
|
||||
c.AddSegs(new LineSegment(p[0], p[1]), new LineSegment(p[1], p[2]), new LineSegment(p[2], p[3]), new LineSegment(p[3], p[0]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a polyline curve for the given rectangle
|
||||
/// </summary>
|
||||
/// <param name="rectangle"></param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateRectangle(Rectangle rectangle) {
|
||||
return CreateRectangle(rectangle.Width, rectangle.Height, rectangle.Center);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve resembling a house large enough to inscribe within it a rectangle of the
|
||||
/// given width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="width">the house width - the rectangle width</param>
|
||||
/// <param name="height">the height of the inscribed rectangle; the house will be half-again higher</param>
|
||||
/// <param name="center">the center of the inscribed rectangle</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateHouse(double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Curve c = new Curve(4);
|
||||
Curve.AddLineSegment(c, x - w, y - h, x + w, y - h);
|
||||
Curve.ContinueWithLineSegment(c, x + w, y + h);
|
||||
Curve.ContinueWithLineSegment(c, x, y + 2 * h);
|
||||
Curve.ContinueWithLineSegment(c, x - w, y + h);
|
||||
Curve.CloseCurve(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates curve resembling a house within the rectangle formed by width and height at center
|
||||
/// (if the rectangle is a square, the house has the shape of home plate in baseball).
|
||||
/// </summary>
|
||||
/// <param name="width">the bounding rectangle width</param>
|
||||
/// <param name="height">the bounding rectangle height</param>
|
||||
/// <param name="center">the bounding rectangle center</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateInteriorHouse(double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Curve c = new Curve(4);
|
||||
Curve.AddLineSegment(c, x - w, y - h, x + w, y - h);
|
||||
Curve.ContinueWithLineSegment(c, x + w, y);
|
||||
Curve.ContinueWithLineSegment(c, x, y + h);
|
||||
Curve.ContinueWithLineSegment(c, x - w, y);
|
||||
Curve.CloseCurve(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve resembling an inverted house
|
||||
/// </summary>
|
||||
/// <param name="width">the house width</param>
|
||||
/// <param name="height">the house heigth</param>
|
||||
/// <param name="center">the house center</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateInvertedHouse(double width, double height, Point center) {
|
||||
ICurve shape = CreateHouse(width, height, center);
|
||||
return RotateCurveAroundCenterByDegree(shape, center, 180.0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve resembling a diamond large enough to inscribe within it a rectangle of the
|
||||
/// given width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="width">the width of the inscribed rectangle</param>
|
||||
/// <param name="height">the height of the inscribed rectangle</param>
|
||||
/// <param name="center">the diamond center</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateDiamond(double width, double height, Point center) {
|
||||
double w = width;
|
||||
double h = height;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Curve c = new Curve();
|
||||
Point[] p = new Point[] { new Point(x, y - h), new Point(x + w, y), new Point(x, y + h), new Point(x - w, y) };
|
||||
c.AddSegs(new LineSegment(p[0], p[1]), new LineSegment(p[1], p[2]), new LineSegment(p[2], p[3]), new LineSegment(p[3], p[0]));
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve resembling a diamond within the rectangle formed by width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="width">the bounding rectangle width</param>
|
||||
/// <param name="height">the bounding rectangle height</param>
|
||||
/// <param name="center">the bounding rectangle center</param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateInteriorDiamond(double width, double height, Point center) {
|
||||
return CreateDiamond(width / 2, height / 2, center);
|
||||
}
|
||||
|
||||
// This adds the padding to the edges around the inscribed rectangle of an octagon.
|
||||
static double octagonPad = 1.0 / 4;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve of the form of an octagon large enough to inscribe a rectangle
|
||||
/// of width and height around center.
|
||||
/// </summary>
|
||||
/// <param name="width">the inscribed rectangle width</param>
|
||||
/// <param name="height">the inscribed rectangle height</param>
|
||||
/// <param name="center">the inscribed rectangle (and octagon) center</param>
|
||||
/// <returns></returns>
|
||||
public static Polyline CreateOctagon(double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
Point[] ps = new Point[8];
|
||||
|
||||
// Pad out horizontally
|
||||
ps[0] = new Point(w + (octagonPad * w), h - (h * octagonPad));
|
||||
ps[3] = new Point(-ps[0].X, ps[0].Y);
|
||||
ps[4] = new Point(ps[3].X, -ps[3].Y);
|
||||
ps[7] = new Point(ps[0].X, -ps[0].Y);
|
||||
|
||||
// Pad out vertically
|
||||
ps[1] = new Point(w - (w * octagonPad), h + (h * octagonPad));
|
||||
ps[2] = new Point(-ps[1].X, ps[1].Y);
|
||||
ps[6] = new Point(ps[1].X, -ps[1].Y);
|
||||
ps[5] = new Point(ps[2].X, -ps[2].Y);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ps[i] += center;
|
||||
}
|
||||
|
||||
Polyline polyline = new Polyline(ps) { Closed = true };
|
||||
return polyline;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve of the form of an hexagon large enough to inscribe a rectangle
|
||||
/// of width and height around center.
|
||||
/// </summary>
|
||||
/// <param name="width">the inscribed rectangle width</param>
|
||||
/// <param name="height">the inscribed rectangle height</param>
|
||||
/// <param name="center">the inscribed rectangle (and hexagon) center</param>
|
||||
/// <returns></returns>
|
||||
public static ICurve CreateHexagon(double width, double height, Point center) {
|
||||
var h = height / 2;
|
||||
var w = width / 2;
|
||||
var x = center.X;
|
||||
var y = center.Y;
|
||||
return new Polyline(new[]{
|
||||
new Point(-w + x, - h + y),
|
||||
new Point( w + x, - h + y),
|
||||
new Point( w + h + x, 0 + y),
|
||||
new Point( w + x, h + y),
|
||||
new Point(-w + x, h + y),
|
||||
new Point(-w - h + x, 0 + y),
|
||||
}) { Closed = true };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a curve in the form of an octagon within the rectangle formed by width and height at center.
|
||||
/// </summary>
|
||||
/// <param name="width">the bounding rectangle width</param>
|
||||
/// <param name="height">the bounding rectangle height</param>
|
||||
/// <param name="center">the bounding rectangle center</param>
|
||||
/// <returns></returns>
|
||||
public static ICurve CreateInteriorOctagon(double width, double height, Point center) {
|
||||
return CreateOctagon(width / (1.0 + octagonPad), height / (1.0 + octagonPad), center);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// testing, don't use
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <returns></returns>
|
||||
public static ICurve CreateTestShape(double width, double height) {
|
||||
int mult = 1;
|
||||
double w = width * 3;
|
||||
double h = height * 3;
|
||||
Curve curve = new Curve(9);
|
||||
Curve.AddLineSegment(curve, -w, -h, 0, -h / 2);
|
||||
Curve.ContinueWithLineSegment(curve, w / 2, -0.75 * h);
|
||||
Curve.ContinueWithLineSegment(curve, w, -h);
|
||||
Curve.ContinueWithLineSegment(curve, 0.75 * w, -h / 2);
|
||||
Curve.ContinueWithLineSegment(curve, w / 2, 0);
|
||||
Curve.ContinueWithLineSegment(curve, w, h);
|
||||
|
||||
Curve.ContinueWithLineSegment(curve, 0, h / 2);
|
||||
Curve.ContinueWithLineSegment(curve, -w, mult * h);
|
||||
Curve.ContinueWithLineSegment(curve, -w / 3, 0);
|
||||
Curve.CloseCurve(curve);
|
||||
return curve;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a triangle inside the box formed by width and height.
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <returns></returns>
|
||||
static public ICurve CreateInteriorTriangle(double width, double height, Point center) {
|
||||
double w = width / 2;
|
||||
double h = height / 2;
|
||||
double x = center.X;
|
||||
double y = center.Y;
|
||||
Curve c = new Curve(3);
|
||||
Point[] p = new Point[] { new Point(x - w, y - h), new Point(x + w, y - h), new Point(x, y + h) };
|
||||
c.AddSegment(new LineSegment(p[0], p[1]));
|
||||
c.AddSegment(new LineSegment(p[1], p[2]));
|
||||
c.AddSegment(new LineSegment(p[2], p[0]));
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rotate a curve around a given point using radians
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <param name="angle"></param>
|
||||
/// <returns></returns>
|
||||
public static ICurve RotateCurveAroundCenterByRadian(ICurve curve, Point center, double angle) {
|
||||
ValidateArg.IsNotNull(curve, "curve");
|
||||
var c = Math.Cos(angle);
|
||||
var s = Math.Sin(angle);
|
||||
var transform = new PlaneTransformation(1, 0, center.X, 0, 1, center.Y) * new PlaneTransformation(c, -s, 0, s, c, 0) * new PlaneTransformation(1, 0, -center.X, 0, 1, -center.Y);
|
||||
return curve.Transform(transform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rotate a curve around a given point using degrees
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <param name="degree"></param>
|
||||
/// <returns></returns>
|
||||
public static ICurve RotateCurveAroundCenterByDegree(ICurve curve, Point center, double degree) {
|
||||
return RotateCurveAroundCenterByRadian(curve, center, degree * (Math.PI / 180.0));
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
///<param name="width"></param>
|
||||
///<param name="center"></param>
|
||||
///<returns></returns>
|
||||
public static ICurve CreateStar(double width, Point center) {
|
||||
const double a = Math.PI * 2 / 5;
|
||||
var r2 = width / (2 * Math.Sin(a));
|
||||
var r = r2 / 2;
|
||||
return new Polyline(StarPoints(r, r2, center, a)) { Closed = true };
|
||||
|
||||
}
|
||||
|
||||
static IEnumerable<Point> StarPoints(double r, double r2, Point center, double a) {
|
||||
var ang = Math.PI / 2;
|
||||
var anghalf = a / 2;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
yield return center + r2 * new Point(Math.Cos(ang), Math.Sin(ang));
|
||||
yield return center + r * new Point(Math.Cos(ang + anghalf), Math.Sin(ang + anghalf));
|
||||
ang += a;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Polyline CreateRegularPolygon(int n, Point center, double rad) {
|
||||
var pt = new Point[n];
|
||||
double a = 2 * Math.PI / n;
|
||||
for (int i = 0; i < n; i++)
|
||||
pt[i] = rad * (new Point(Math.Cos(i * a), Math.Sin(i * a))) + center;
|
||||
return new Polyline(pt) { Closed = true };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0683753b5ef800a419a9cff7fda0aa34
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
public partial class Curve {
|
||||
|
||||
double parStart;
|
||||
|
||||
/// <summary>
|
||||
/// the start of the parameter domain
|
||||
/// </summary>
|
||||
public double ParStart {
|
||||
get { return parStart; }
|
||||
set { parStart = value; }
|
||||
}
|
||||
|
||||
double parEnd;
|
||||
|
||||
/// <summary>
|
||||
/// the end of the parameter domain
|
||||
/// </summary>
|
||||
public double ParEnd {
|
||||
get { return parEnd; }
|
||||
set { parEnd = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved moved by delta
|
||||
/// </summary>
|
||||
public void Translate(Point delta)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
foreach (ICurve s in segs)
|
||||
s.Translate(delta);
|
||||
|
||||
pBNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved scaled by x and y
|
||||
/// </summary>
|
||||
/// <param name="xScale"></param>
|
||||
/// <param name="yScale"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve ScaleFromOrigin(double xScale, double yScale)
|
||||
{
|
||||
Curve c = new Curve(segs.Count);
|
||||
foreach (ICurve s in segs)
|
||||
c.AddSegment(s.ScaleFromOrigin(xScale, yScale));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the transformed curve
|
||||
/// </summary>
|
||||
/// <param name="transformation"></param>
|
||||
/// <returns>the transformed curve</returns>
|
||||
public ICurve Transform(PlaneTransformation transformation) {
|
||||
Curve c = new Curve(segs.Count);
|
||||
foreach (ICurve s in segs)
|
||||
c.AddSegment(s.Transform(transformation));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return length of the curve segment [start,end]
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public double LengthPartial(double start, double end) {
|
||||
double s, e;
|
||||
int i, j;
|
||||
|
||||
AdjustStartEndEndParametersToDomain(ref start, ref end);
|
||||
this.GetSegmentAndParameter(start, out s, out i);
|
||||
this.GetSegmentAndParameter(end, out e, out j);
|
||||
|
||||
ICurve seg = this.segs[i];
|
||||
double ret = seg.LengthPartial(s, seg.ParEnd);
|
||||
for (int k = i + 1; k < j; k++)
|
||||
ret += segs[k].Length;
|
||||
|
||||
seg = segs[j];
|
||||
return ret + seg.LengthPartial(seg.ParStart, e);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An approximate length of the curve calculated using the interpolation
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <returns></returns>
|
||||
static public double LengthWithInterpolation(ICurve curve) {
|
||||
double ret = 0;
|
||||
foreach (LineSegment ls in Interpolate(curve, lineSegThreshold))
|
||||
ret += ls.Length;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An approximate length of the curve calculated using the interpolation
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <param name="threshold"></param>
|
||||
/// <returns></returns>
|
||||
static public double LengthWithInterpolationAndThreshold(ICurve curve, double threshold)
|
||||
{
|
||||
double ret = 0;
|
||||
foreach (LineSegment ls in Interpolate(curve, threshold))
|
||||
ret += ls.Length;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the length of the curve
|
||||
/// </summary>
|
||||
public double Length {
|
||||
get {
|
||||
double ret = 0;
|
||||
foreach (ICurve ic in segs)
|
||||
ret += ic.Length;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a9cdecaa81a099a428117c0723547bda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// used to calculate the around curve
|
||||
/// </summary>
|
||||
internal class CurveTangent {
|
||||
internal Point touchPoint;
|
||||
|
||||
internal Point direction;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="touch"></param>
|
||||
/// <param name="direction"></param>
|
||||
internal CurveTangent(Point touch, Point direction) {
|
||||
this.touchPoint = touch;
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8165017438605044f82f595067f26f18
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
621
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Ellipse.cs
Normal file
621
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Ellipse.cs
Normal file
|
|
@ -0,0 +1,621 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves{
|
||||
/// <summary>
|
||||
/// A class representing an ellipse.
|
||||
/// </summary>
|
||||
#if TEST_MSAGL
|
||||
[Serializable]
|
||||
#endif
|
||||
public class Ellipse : ICurve{
|
||||
#if TEST_MSAGL
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])")]
|
||||
public override string ToString() {
|
||||
return String.Format("{0} {1} from {2} to {3} a0={4} a1={5}", Start, End, ParStart, ParEnd, AxisA, AxisB);
|
||||
}
|
||||
#endif
|
||||
Rectangle box;
|
||||
|
||||
ParallelogramNodeOverICurve parallelogramNodeOverICurve;
|
||||
|
||||
/// <summary>
|
||||
/// offsets the curve in the given direction
|
||||
/// </summary>
|
||||
/// <param name="offset">the width of the offset</param>
|
||||
/// <param name="dir">the direction of the offset</param>
|
||||
/// <returns></returns>
|
||||
public ICurve OffsetCurve(double offset, Point dir){
|
||||
//is dir inside or outside
|
||||
Point d = dir - center;
|
||||
double angle = Point.Angle(aAxis, d);
|
||||
Point s = aAxis*Math.Cos(angle) + bAxis*Math.Sin(angle);
|
||||
if(s.Length < d.Length){
|
||||
double al = aAxis.Length;
|
||||
double bl = bAxis.Length;
|
||||
return new Ellipse((al + offset)*aAxis.Normalize(), (bl + offset)*bAxis.Normalize(), center);
|
||||
}
|
||||
{
|
||||
double al = aAxis.Length;
|
||||
double bl = bAxis.Length;
|
||||
#if DEBUGCURVES
|
||||
if (al < offset || bl < offset)
|
||||
throw new Exception("wrong parameter for ellipse offset");
|
||||
#endif
|
||||
return new Ellipse((al - offset)*aAxis.Normalize(), (bl - offset)*bAxis.Normalize(), center);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reverse the ellipe: not implemented.
|
||||
/// </summary>
|
||||
/// <returns>returns the reversed curve</returns>
|
||||
public ICurve Reverse(){
|
||||
return null; // throw new Exception("not implemented");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the start point of the curve
|
||||
/// </summary>
|
||||
public Point Start{
|
||||
get { return this[ParStart]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the end point of the curve
|
||||
/// </summary>
|
||||
public Point End{
|
||||
get { return this[ParEnd]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trims the curve
|
||||
/// </summary>
|
||||
/// <param name="start">the trim start parameter</param>
|
||||
/// <param name="end">the trim end parameter</param>
|
||||
/// <returns></returns>
|
||||
public ICurve Trim(double start, double end){
|
||||
Debug.Assert(start<=end);
|
||||
Debug.Assert(start>=ParStart-ApproximateComparer.Tolerance);
|
||||
Debug.Assert(end<=ParEnd+ApproximateComparer.Tolerance);
|
||||
|
||||
return new Ellipse(Math.Max(start, ParStart), Math.Min(end,ParEnd), AxisA, AxisB, center);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not Implemented: Returns the trimmed curve, wrapping around the end if start is greater than end.
|
||||
/// </summary>
|
||||
/// <param name="start">The starting parameter</param>
|
||||
/// <param name="end">The ending parameter</param>
|
||||
/// <returns>The trimmed curve</returns>
|
||||
public ICurve TrimWithWrap(double start, double end)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//half x axes
|
||||
Point aAxis;
|
||||
|
||||
/// <summary>
|
||||
/// the X axis of the ellipse
|
||||
/// </summary>
|
||||
public Point AxisA{
|
||||
get { return aAxis; }
|
||||
set { aAxis = value; }
|
||||
}
|
||||
|
||||
Point bAxis;
|
||||
|
||||
/// <summary>
|
||||
/// the Y axis of the ellipse
|
||||
/// </summary>
|
||||
public Point AxisB{
|
||||
get { return bAxis; }
|
||||
set { bAxis = value; }
|
||||
}
|
||||
|
||||
Point center;
|
||||
|
||||
/// <summary>
|
||||
/// the center of the ellipse
|
||||
/// </summary>
|
||||
public Point Center{
|
||||
get { return center; }
|
||||
set { center = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The bounding box of the ellipse
|
||||
/// </summary>
|
||||
public Rectangle BoundingBox{
|
||||
get { return box; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the point on the curve corresponding to parameter t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter of the derivative</param>
|
||||
/// <returns></returns>
|
||||
public Point this[double t]{
|
||||
get { return center + Math.Cos(t)*aAxis + Math.Sin(t)*bAxis; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// first derivative
|
||||
/// </summary>
|
||||
/// <param name="t">the p</param>
|
||||
/// <returns></returns>
|
||||
public Point Derivative(double t){
|
||||
return -Math.Sin(t)*aAxis + Math.Cos(t)*bAxis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// second derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point SecondDerivative(double t){
|
||||
return -Math.Cos(t)*aAxis - Math.Sin(t)*bAxis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// third derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point ThirdDerivative(double t){
|
||||
return Math.Sin(t)*aAxis - Math.Cos(t)*bAxis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a tree of ParallelogramNodes covering the edge
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public ParallelogramNodeOverICurve ParallelogramNodeOverICurve{
|
||||
get{
|
||||
#if PPC
|
||||
lock(this){
|
||||
#endif
|
||||
if(parallelogramNodeOverICurve != null)
|
||||
|
||||
return parallelogramNodeOverICurve;
|
||||
return parallelogramNodeOverICurve = CreateParallelogramNodeForCurveSeg(this);
|
||||
#if PPC
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ParallelogramNodeOverICurve CreateNodeWithSegmentSplit(double start, double end, Ellipse seg, double eps){
|
||||
var pBNode = new ParallelogramInternalTreeNode(seg, eps);
|
||||
pBNode.AddChild(CreateParallelogramNodeForCurveSeg(start, 0.5*(start + end), seg, eps));
|
||||
pBNode.AddChild(CreateParallelogramNodeForCurveSeg(0.5*(start + end), end, seg, eps));
|
||||
var boxes = new List<Parallelogram>();
|
||||
boxes.Add(pBNode.Children[0].Parallelogram);
|
||||
boxes.Add(pBNode.Children[1].Parallelogram);
|
||||
pBNode.Parallelogram = Parallelogram.GetParallelogramOfAGroup(boxes);
|
||||
return pBNode;
|
||||
}
|
||||
|
||||
internal static ParallelogramNodeOverICurve CreateParallelogramNodeForCurveSeg(double start, double end,
|
||||
Ellipse seg, double eps){
|
||||
bool closedSeg = (start == seg.ParStart && end == seg.ParEnd && ApproximateComparer.Close(seg.Start, seg.End));
|
||||
if(closedSeg)
|
||||
return CreateNodeWithSegmentSplit(start, end, seg, eps);
|
||||
|
||||
Point s = seg[start];
|
||||
Point e = seg[end];
|
||||
Point w = e - s;
|
||||
Point middle = seg[(start + end) / 2];
|
||||
|
||||
if (ParallelogramNodeOverICurve.DistToSegm(middle, s, e) <= ApproximateComparer.IntersectionEpsilon &&
|
||||
w * w < Curve.LineSegmentThreshold * Curve.LineSegmentThreshold && end - start < Curve.LineSegmentThreshold) {
|
||||
var ls = new LineSegment(s, e);
|
||||
var leaf = ls.ParallelogramNodeOverICurve as ParallelogramLeaf;
|
||||
leaf.Low = start;
|
||||
leaf.High = end;
|
||||
leaf.Seg = seg;
|
||||
leaf.Chord = ls;
|
||||
return leaf;
|
||||
}
|
||||
|
||||
bool we = WithinEpsilon(seg, start, end, eps);
|
||||
var box = new Parallelogram();
|
||||
|
||||
if(we && CreateParallelogramOnSubSeg(start, end, seg, ref box)){
|
||||
return new ParallelogramLeaf(start, end, box, seg, eps);
|
||||
} else{
|
||||
return CreateNodeWithSegmentSplit(start, end, seg, eps);
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool CreateParallelogramOnSubSeg(double start, double end, Ellipse seg, ref Parallelogram box){
|
||||
Point tan1 = seg.Derivative(start);
|
||||
|
||||
Point tan2 = seg.Derivative(end);
|
||||
Point tan2Perp = Point.P(-tan2.Y, tan2.X);
|
||||
|
||||
Point corner = seg[start];
|
||||
|
||||
Point e = seg[end];
|
||||
|
||||
Point p = e - corner;
|
||||
|
||||
double numerator = p*tan2Perp;
|
||||
double denumerator = (tan1*tan2Perp);
|
||||
double x; // = (p * tan2Perp) / (tan1 * tan2Perp);
|
||||
if(Math.Abs(numerator) < ApproximateComparer.DistanceEpsilon)
|
||||
x = 0;
|
||||
else if(Math.Abs(denumerator) < ApproximateComparer.DistanceEpsilon){
|
||||
//it is degenerated; adjacent sides are parallel, but
|
||||
//since p * tan2Perp is big it does not contain e
|
||||
return false;
|
||||
} else x = numerator/denumerator;
|
||||
|
||||
tan1 *= x;
|
||||
|
||||
box = new Parallelogram(corner, tan1, e - corner - tan1);
|
||||
#if DEBUGCURVES
|
||||
if (!box.Contains(seg[end]))
|
||||
{
|
||||
|
||||
throw new InvalidOperationException();//"the box does not contain the end of the segment");
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WithinEpsilon(Ellipse seg, double start, double end, double eps){
|
||||
int n = 3; //hack !!!! but maybe can be proven for Bezier curves and other regular curves
|
||||
double d = (end - start)/n;
|
||||
Point s = seg[start];
|
||||
Point e = seg[end];
|
||||
|
||||
double d0 = ParallelogramNodeOverICurve.DistToSegm(seg[start + d], s, e);
|
||||
if(d0 > eps)
|
||||
return false;
|
||||
|
||||
double d1 = ParallelogramNodeOverICurve.DistToSegm(seg[start + d*(n - 1)], s, e);
|
||||
//double d1d1 = seg.d1(start) * seg.d1(end);
|
||||
|
||||
return d1 <= eps; // && d1d1 > 0;
|
||||
}
|
||||
|
||||
static ParallelogramNodeOverICurve CreateParallelogramNodeForCurveSeg(Ellipse seg) {
|
||||
return CreateParallelogramNodeForCurveSeg(seg.ParStart, seg.ParEnd, seg,
|
||||
ParallelogramNodeOverICurve.DefaultLeafBoxesOffset);
|
||||
}
|
||||
|
||||
double parStart;
|
||||
|
||||
/// <summary>
|
||||
/// the start of the parameter domain
|
||||
/// </summary>
|
||||
public double ParStart{
|
||||
get { return parStart; }
|
||||
set { parStart = value; }
|
||||
}
|
||||
|
||||
double parEnd;
|
||||
|
||||
/// <summary>
|
||||
/// the end of the parameter domain
|
||||
/// </summary>
|
||||
public double ParEnd{
|
||||
get { return parEnd; }
|
||||
set { parEnd = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The point on the ellipse corresponding to the parameter t is calculated by
|
||||
/// the formula center + cos(t)*axis0 + sin(t) * axis1.
|
||||
/// To get an ellipse rotating clockwise use, for example,
|
||||
/// axis0=(-1,0) and axis1=(0,1)
|
||||
/// <param name="parStart">start angle in radians</param>
|
||||
/// <param name="parEnd">end angle in radians</param>
|
||||
/// <param name="axis0">x radius</param>
|
||||
/// <param name="axis1">y radius</param>
|
||||
/// <param name="center">the ellipse center</param>
|
||||
/// </summary>
|
||||
public Ellipse(double parStart, double parEnd, Point axis0, Point axis1, Point center){
|
||||
Debug.Assert(parStart<=parEnd);
|
||||
ParStart = parStart;
|
||||
ParEnd = parEnd;
|
||||
AxisA = axis0;
|
||||
AxisB = axis1;
|
||||
this.center = center;
|
||||
SetBoundingBox();
|
||||
}
|
||||
|
||||
void SetBoundingBox() {
|
||||
if (ApproximateComparer.Close(ParStart, 0) && ApproximateComparer.Close(ParEnd, Math.PI * 2))
|
||||
box = FullBox();
|
||||
else {
|
||||
//the idea is that the box of an arc staying in one quadrant is just the box of the start and the end point of the arc
|
||||
box = new Rectangle(Start, End);
|
||||
//now Start and End are in the box, we need just add all k*P/2 that are in between
|
||||
double t;
|
||||
for (int i = (int)Math.Ceiling(ParStart / (Math.PI / 2)); (t = i * Math.PI / 2) < ParEnd; i++)
|
||||
if (t > parStart)
|
||||
box.Add(this[t]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The point on the ellipse corresponding to the parameter t is calculated by
|
||||
/// the formula center + cos(t)*axis0 + sin(t) * axis1.
|
||||
/// To get an ellipse rotating clockwise use, for example,
|
||||
/// axis0=(-1,0) and axis1=(0,1)
|
||||
/// </summary>
|
||||
/// <param name="parStart">start angle in radians</param>
|
||||
/// <param name="parEnd">end angle in radians</param>
|
||||
/// <param name="axis0">the x axis</param>
|
||||
/// <param name="axis1">the y axis</param>
|
||||
/// <param name="centerX">x coordinate of the center</param>
|
||||
/// <param name="centerY">y coordinate of the center</param>
|
||||
public Ellipse(double parStart, double parEnd, Point axis0, Point axis1, double centerX, double centerY)
|
||||
: this(parStart, parEnd, axis0, axis1, new Point(centerX, centerY)){
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a full ellipse by two axes
|
||||
/// </summary>
|
||||
/// <param name="axis0">an axis</param>
|
||||
/// <param name="axis1">an axis</param>
|
||||
/// <param name="center"></param>
|
||||
public Ellipse(Point axis0, Point axis1, Point center)
|
||||
: this(0, Math.PI*2, axis0, axis1, center){
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a full ellipse with axes aligned to X and Y directions
|
||||
/// </summary>
|
||||
/// <param name="axisA">the length of the X axis</param>
|
||||
/// <param name="axisB">the length of the Y axis</param>
|
||||
/// <param name="center"></param>
|
||||
public Ellipse(double axisA, double axisB, Point center)
|
||||
: this(0, Math.PI*2, new Point(axisA, 0), new Point(0, axisB), center){
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the ellipse to the delta vector
|
||||
/// </summary>
|
||||
public void Translate(Point delta)
|
||||
{
|
||||
this.center += delta;
|
||||
this.box = new Rectangle(center + bAxis + aAxis, center - bAxis - aAxis);
|
||||
parallelogramNodeOverICurve = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the ellipse by x and by y
|
||||
/// </summary>
|
||||
/// <param name="xScale"></param>
|
||||
/// <param name="yScale"></param>
|
||||
/// <returns>the moved ellipse</returns>
|
||||
public ICurve ScaleFromOrigin(double xScale, double yScale)
|
||||
{
|
||||
return new Ellipse(parStart, parEnd, aAxis * xScale, bAxis * yScale, Point.Scale(xScale, yScale, center));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public double GetParameterAtLength(double length) {
|
||||
//todo: slow version!
|
||||
const double eps = 0.001;
|
||||
|
||||
var l = ParStart;
|
||||
var u = ParEnd;
|
||||
var lenplus = length + eps;
|
||||
var lenminsu = length - eps;
|
||||
while (u - l > ApproximateComparer.DistanceEpsilon) {
|
||||
var m = 0.5*(u + l);
|
||||
var len = LengthPartial(ParStart, m);
|
||||
if(len>lenplus)
|
||||
u=m;
|
||||
else if (len < lenminsu)
|
||||
l = m;
|
||||
else return m;
|
||||
}
|
||||
return (u + l)/2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms the ellipse
|
||||
/// </summary>
|
||||
/// <param name="transformation"></param>
|
||||
/// <returns>the transformed ellipse</returns>
|
||||
public ICurve Transform(PlaneTransformation transformation){
|
||||
if(transformation != null){
|
||||
Point ap = transformation*aAxis - transformation.Offset;
|
||||
Point bp = transformation*bAxis - transformation.Offset;
|
||||
return new Ellipse(parStart, parEnd, ap, bp, transformation*center);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and targetPoint is minimal
|
||||
/// and t belongs to the closed segment [low,high]
|
||||
/// </summary>
|
||||
/// <param name="targetPoint">the point to find the closest point</param>
|
||||
/// <param name="high">the upper bound of the parameter</param>
|
||||
/// <param name="low">the low bound of the parameter</param>
|
||||
/// <returns></returns>
|
||||
public double ClosestParameterWithinBounds(Point targetPoint, double low, double high) {
|
||||
const int numberOfTestPoints = 8;
|
||||
double t = (high - low) / (numberOfTestPoints + 1);
|
||||
double closest = low;
|
||||
double minDist = Double.MaxValue;
|
||||
for (int i = 0; i <= numberOfTestPoints; i++) {
|
||||
double par = low + i * t;
|
||||
Point p = targetPoint - this[par];
|
||||
double d = p * p;
|
||||
if (d < minDist) {
|
||||
minDist = d;
|
||||
closest = par;
|
||||
}
|
||||
}
|
||||
if (closest == 0 && high == Math.PI*2)
|
||||
low = -Math.PI;
|
||||
double ret = ClosestPointOnCurve.ClosestPoint(this, targetPoint, closest, low, high);
|
||||
if (ret < 0)
|
||||
ret += 2 * Math.PI;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return length of the curve segment [start,end] : not implemented
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public double LengthPartial(double start, double end) {
|
||||
return Curve.LengthWithInterpolationAndThreshold(Trim(start, end), Curve.LineSegmentThreshold/100);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the length of the ellipse curve: not implemented
|
||||
/// </summary>
|
||||
public double Length{
|
||||
get {
|
||||
return Curve.LengthWithInterpolation(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// clones the curve.
|
||||
/// </summary>
|
||||
/// <returns>the cloned curve</returns>
|
||||
public ICurve Clone(){
|
||||
return new Ellipse(parStart, parEnd, aAxis, bAxis, center);
|
||||
}
|
||||
|
||||
#region ICurve Members
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and a is minimal
|
||||
/// </summary>
|
||||
/// <param name="targetPoint"></param>
|
||||
/// <returns>the parameter of the closest point</returns>
|
||||
public double ClosestParameter(Point targetPoint){
|
||||
double savedParStart = 0;
|
||||
const int numberOfTestPoints = 8;
|
||||
double t = (ParEnd - ParStart)/(numberOfTestPoints + 1);
|
||||
double closest = ParStart;
|
||||
double minDist = Double.MaxValue;
|
||||
for (int i = 0; i <= numberOfTestPoints; i++){
|
||||
double par = ParStart + i*t;
|
||||
Point p = targetPoint - this[par];
|
||||
double d = p*p;
|
||||
if(d < minDist){
|
||||
minDist = d;
|
||||
closest = par;
|
||||
}
|
||||
}
|
||||
bool parStartWasChanged = false;
|
||||
if(closest == 0 && ParEnd == Math.PI*2){
|
||||
parStartWasChanged = true;
|
||||
savedParStart = ParStart;
|
||||
ParStart = -Math.PI;
|
||||
}
|
||||
double ret = ClosestPointOnCurve.ClosestPoint(this, targetPoint, closest, ParStart, ParEnd);
|
||||
if(ret<0)
|
||||
ret += 2*Math.PI;
|
||||
if (parStartWasChanged)
|
||||
ParStart = savedParStart;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// left derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point LeftDerivative(double t){
|
||||
return Derivative(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// right derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point RightDerivative(double t){
|
||||
return Derivative(t);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ICurve Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double Curvature(double t){
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureDerivative(double t){
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureSecondDerivative(double t){
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// returns true if the ellipse goes counterclockwise
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool OrientedCounterclockwise(){
|
||||
return AxisA.X*AxisB.Y - AxisB.X*AxisA.Y > 0;
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///returns the box of the ellipse that this ellipse is a part of
|
||||
///</summary>
|
||||
///<returns></returns>
|
||||
public Rectangle FullBox() {
|
||||
var del=AxisA + AxisB;
|
||||
return new Rectangle(center + del, center - del);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///is it a proper circle?
|
||||
///</summary>
|
||||
public bool IsArc() {
|
||||
return AxisA.X == AxisB.Y && AxisA.Y == -AxisB.X;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c5c6926f69ff27d44ac54fa374927c6f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
217
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/ICurve.cs
Normal file
217
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/ICurve.cs
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// The interface for curves: instances of ICurve inside of GLEE
|
||||
/// are BSpline,Curve,LineSeg, Ellipse,CubicBezierSeg and ArrowTipCurve.
|
||||
/// </summary>
|
||||
public interface ICurve {
|
||||
/// <summary>
|
||||
/// Returns the point on the curve corresponding to parameter t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point this[double t] { get; }
|
||||
/// <summary>
|
||||
/// first derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point Derivative(double t);
|
||||
/// <summary>
|
||||
/// second derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point SecondDerivative(double t);
|
||||
/// <summary>
|
||||
/// third derivative
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter of the derivative</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point ThirdDerivative(double t);
|
||||
|
||||
/// <summary>
|
||||
/// A tree of ParallelogramNodes covering the curve.
|
||||
/// This tree is used in curve intersections routines.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
ParallelogramNodeOverICurve ParallelogramNodeOverICurve { get; }
|
||||
|
||||
/// <summary>
|
||||
/// XY bounding box of the curve
|
||||
/// </summary>
|
||||
Rectangle BoundingBox { get;}
|
||||
|
||||
/// <summary>
|
||||
/// the start of the parameter domain
|
||||
/// </summary>
|
||||
double ParStart { get;}
|
||||
|
||||
/// <summary>
|
||||
/// the end of the parameter domain
|
||||
/// </summary>
|
||||
double ParEnd { get;}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the trim curve between start and end, without wrap
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "End")]
|
||||
ICurve Trim(double start, double end);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the trim curve between start and end, with wrap, if supported by the implementing class.
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "End")]
|
||||
ICurve TrimWithWrap(double start, double end);
|
||||
|
||||
/// <summary>
|
||||
/// Moves the curve by the delta.
|
||||
/// </summary>
|
||||
void Translate(Point delta);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved with all points scaled from the original by x and y
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ICurve ScaleFromOrigin(double xScale, double yScale);
|
||||
|
||||
/// <summary>
|
||||
/// this[ParStart]
|
||||
/// </summary>
|
||||
Point Start { get;}
|
||||
|
||||
/// <summary>
|
||||
/// this[ParEnd]
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "End")]
|
||||
Point End { get; }
|
||||
|
||||
/// <summary>
|
||||
/// this[Reverse[t]]=this[ParEnd+ParStart-t]
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ICurve Reverse();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Offsets the curve in the direction of dir
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="dir"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
|
||||
|
||||
ICurve OffsetCurve(double offset, Point dir);
|
||||
|
||||
/// <summary>
|
||||
/// return length of the curve segment [start,end]
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "End")]
|
||||
double LengthPartial(double start, double end);
|
||||
|
||||
/// <summary>
|
||||
/// Get the length of the curve
|
||||
/// </summary>
|
||||
double Length { get;}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// gets the parameter at a specific length from the start along the curve
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming",
|
||||
"CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double GetParameterAtLength(double length);
|
||||
|
||||
/// <summary>
|
||||
/// Return the transformed curve
|
||||
/// </summary>
|
||||
/// <param name="transformation"></param>
|
||||
/// <returns>the transformed curve</returns>
|
||||
ICurve Transform(PlaneTransformation transformation);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and targetPoint is minimal
|
||||
/// and t belongs to the closed segment [low,high]
|
||||
/// </summary>
|
||||
/// <param name="targetPoint">the point to find the closest point</param>
|
||||
/// <param name="high">the upper bound of the parameter</param>
|
||||
/// <param name="low">the low bound of the parameter</param>
|
||||
/// <returns></returns>
|
||||
double ClosestParameterWithinBounds(Point targetPoint, double low, double high);
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and a is minimal
|
||||
/// </summary>
|
||||
/// <param name="targetPoint"></param>
|
||||
/// <returns></returns>
|
||||
double ClosestParameter(Point targetPoint);
|
||||
/// <summary>
|
||||
/// clones the curve.
|
||||
/// </summary>
|
||||
/// <returns>the cloned curve</returns>
|
||||
ICurve Clone();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The left derivative at t.
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point LeftDerivative(double t);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the right derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
Point RightDerivative(double t);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the signed curvature of the segment at t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double Curvature(double t);
|
||||
/// <summary>
|
||||
/// the derivative of the curvature at t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double CurvatureDerivative(double t);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the derivative of CurvatureDerivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double CurvatureSecondDerivative(double t);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/ICurve.cs.meta
Normal file
11
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/ICurve.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 87007c1367b6da648814f9b9bd5f761c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/IFunction.cs
Normal file
46
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/IFunction.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IFunction {
|
||||
/// <summary>
|
||||
/// Returns the falue on the curve corresponding to parameter t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double this[double t] { get; }
|
||||
/// <summary>
|
||||
/// first derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double Derivative(double t);
|
||||
/// <summary>
|
||||
/// second derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double SecondDerivative(double t);
|
||||
/// <summary>
|
||||
/// third derivative
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter of the derivative</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "t")]
|
||||
double ThirdDerivative(double t);
|
||||
|
||||
/// <summary>
|
||||
/// the domain of the function is the [ParStart, ParEnd] segment
|
||||
/// </summary>
|
||||
double ParStart { get; }
|
||||
/// <summary>
|
||||
/// the domain of the function is the [ParStart, ParEnd] segment
|
||||
/// </summary>
|
||||
double ParEnd { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 65427237fd9e6174988919a03f663052
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// Contains the result of the intersection of two ICurves.
|
||||
/// </summary>
|
||||
public class IntersectionInfo {
|
||||
|
||||
|
||||
/* The following conditions should hold:
|
||||
* X=seg0[par0]=seg1[par1]
|
||||
*/
|
||||
|
||||
double par0, par1;
|
||||
Point x;
|
||||
|
||||
ICurve seg0, seg1;
|
||||
/// <summary>
|
||||
/// the parameter on the first curve
|
||||
/// </summary>
|
||||
public double Par0 {
|
||||
get { return par0; }
|
||||
set { par0 = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// the parameter on the second curve
|
||||
/// </summary>
|
||||
public double Par1 {
|
||||
get { return par1; }
|
||||
set { par1 = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the intersection point
|
||||
/// </summary>
|
||||
public Point IntersectionPoint {
|
||||
get { return x; }
|
||||
set { x = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the segment of the first curve where the intersection point belongs
|
||||
/// </summary>
|
||||
public ICurve Segment0 {
|
||||
get { return seg0; }
|
||||
set { seg0=value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the segment of the second curve where the intersection point belongs
|
||||
/// </summary>
|
||||
public ICurve Segment1 {
|
||||
get { return seg1; }
|
||||
set { seg1 = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the constructor
|
||||
/// </summary>
|
||||
/// <param name="pr0"></param>
|
||||
/// <param name="pr1"></param>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="s0"></param>
|
||||
/// <param name="s1"></param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")]
|
||||
internal IntersectionInfo(double pr0, double pr1, Point x, ICurve s0, ICurve s1) {
|
||||
par0 = pr0;
|
||||
par1 = pr1;
|
||||
this.x = x;
|
||||
seg0 = s0;
|
||||
seg1 = s1;
|
||||
#if DETAILED_DEBUG
|
||||
System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s0[pr0], ApproximateComparer.IntersectionEpsilon*10),
|
||||
string.Format("intersection not at curve[param]; x = {0}, s0[pr0] = {1}, diff = {2}", x, s0[pr0], x - s0[pr0]));
|
||||
System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s1[pr1], ApproximateComparer.IntersectionEpsilon*10),
|
||||
string.Format("intersection not at curve[param]; x = {0}, s1[pr1] = {1}, diff = {2}", x, s1[pr1], x - s1[pr1]));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
return String.Format(CultureInfo.InvariantCulture, "XX({0} {1} {2})", par0, par1, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ab381fde1cfb1ba44abc25ef2f5d0888
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
518
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/LineSegment.cs
Normal file
518
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/LineSegment.cs
Normal file
|
|
@ -0,0 +1,518 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// Line segment
|
||||
/// </summary>
|
||||
#if TEST_MSAGL
|
||||
[Serializable]
|
||||
#endif
|
||||
[DebuggerDisplay("[({a.X} {a.Y}),({b.X} {b.Y})]")]
|
||||
public class LineSegment : ICurve {
|
||||
|
||||
Point a;//the line goes from a to side1
|
||||
|
||||
/// <summary>
|
||||
/// Offsets the curve in the direction of dir
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="dir"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve OffsetCurve(double offset, Point dir) { return null; }
|
||||
/// <summary>
|
||||
/// the line start point
|
||||
/// </summary>
|
||||
public Point Start {
|
||||
get { return a; }
|
||||
set { a = value; }
|
||||
}
|
||||
Point b;
|
||||
/// <summary>
|
||||
/// the line end point
|
||||
/// </summary>
|
||||
public Point End {
|
||||
get { return b; }
|
||||
set { b = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the start parameter
|
||||
/// </summary>
|
||||
public double ParStart {
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the end parameter
|
||||
/// </summary>
|
||||
public double ParEnd {
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the trim curve
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public ICurve Trim(double start, double end) {
|
||||
|
||||
if (start > end)
|
||||
throw new InvalidOperationException();//"wrong params in trimming");
|
||||
|
||||
Point p1 = start <= ParStart ? Start : (1 - start) * a + start * b;
|
||||
Point p2 = end >= ParEnd ? End : (1 - end) * a + end * b;
|
||||
if (ApproximateComparer.Close(start, end)) {
|
||||
return null;
|
||||
}
|
||||
return new LineSegment(p1, p2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not Implemented: Returns the trimmed curve, wrapping around the end if start is greater than end.
|
||||
/// </summary>
|
||||
/// <param name="start">The starting parameter</param>
|
||||
/// <param name="end">The ending parameter</param>
|
||||
/// <returns>The trimmed curve</returns>
|
||||
public ICurve TrimWithWrap(double start, double end) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A tree of ParallelogramNodes covering the curve.
|
||||
/// This tree is used in curve intersections routines.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public ParallelogramNodeOverICurve ParallelogramNodeOverICurve {
|
||||
get {
|
||||
Point side = 0.5 * (b - a);
|
||||
|
||||
return new ParallelogramLeaf(0, 1, new Parallelogram(a, side, side), this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
internal Point Normal {
|
||||
get {
|
||||
Point t = a - b;
|
||||
t /= t.Length;
|
||||
return new Point(-t.Y, t.X);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// construct a line segment
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
public LineSegment(Point start, Point end) {
|
||||
#if SHARPKIT
|
||||
a = start.Clone();
|
||||
b = end.Clone();
|
||||
#else
|
||||
a = start;
|
||||
b = end;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructs a line segment
|
||||
/// </summary>
|
||||
/// <param name="a">the first point</param>
|
||||
/// <param name="x">x-coordinate of the second point</param>
|
||||
/// <param name="y">y-coordinate of the second point</param>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "a"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y")]
|
||||
public LineSegment(Point a, double x, double y) : this(a, new Point(x, y)) { }
|
||||
|
||||
/// <summary>
|
||||
/// constructs a line segment
|
||||
/// </summary>
|
||||
/// <param name="x0">x-coordinate of the first point</param>
|
||||
/// <param name="y0">y-coordinate of the first point</param>
|
||||
/// <param name="x1">x-coordinate of the second point</param>
|
||||
/// <param name="y1">y-coordinate of the second point</param>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x")]
|
||||
public LineSegment(double x0, double y0, double x1, double y1) : this(new Point(x0, y0), new Point(x1, y1)) { }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the point on the curve corresponding to parameter t
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point this[double t] {
|
||||
get { return a + (b - a) * t; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// first derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point Derivative(double t) {
|
||||
return b - a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// second derivative
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public Point SecondDerivative(double t) {
|
||||
return new Point(0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// third derivative
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter of the derivative</param>
|
||||
/// <returns></returns>
|
||||
public Point ThirdDerivative(double t) {
|
||||
return new Point(0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the rounded form; DebuggerDisplay shows the unrounded form.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString() {
|
||||
return "{" + a + "," + b + "}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this[Reverse[t]]=this[ParEnd+ParStart-t]
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public ICurve Reverse() {
|
||||
return new LineSegment(b, a);
|
||||
}
|
||||
|
||||
/*
|
||||
static internal IntersectionInfo Cross(LineSeg coeff, LineSeg side1){
|
||||
IntersectionInfo xx=CrossTwoLines(coeff.Start, coeff.End-coeff.Start,side1.Start, side1.End-side1.Start);
|
||||
if (xx == null)
|
||||
{
|
||||
//parallel segs
|
||||
Point adir=coeff.d1(0);
|
||||
Point bdir=side1.d1(0);
|
||||
|
||||
if (adir.Length > bdir.Length)
|
||||
{
|
||||
if (adir.Length > Curve.DistEps)
|
||||
{
|
||||
adir = adir.Normalize();
|
||||
if(Math.Abs((coeff-side1)*adir<Curve.DistEps)){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if(xx.Par0>1){
|
||||
if (ApproximateComparer.Close(coeff.End, xx.X))
|
||||
{
|
||||
xx.X = coeff.End;
|
||||
xx.Par0 = 1;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else if(xx.Par0<0){
|
||||
if(ApproximateComparer.Close(coeff.Start,xx.X)){
|
||||
xx.X=coeff.Start;
|
||||
xx.Par0=1;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
if (xx.Par1 > 1)
|
||||
{
|
||||
if (ApproximateComparer.Close(side1.End, xx.X))
|
||||
{
|
||||
xx.X = coeff.End;
|
||||
xx.Par1 = 1;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else if (xx.Par1 < 0)
|
||||
{
|
||||
if (ApproximateComparer.Close(side1.Start, xx.X))
|
||||
{
|
||||
xx.X = coeff.Start;
|
||||
xx.Par1 = 1;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
return xx;
|
||||
}
|
||||
* */
|
||||
|
||||
/// <summary>
|
||||
/// Returns the curved moved by delta
|
||||
/// </summary>
|
||||
public void Translate(Point delta)
|
||||
{
|
||||
a += delta;
|
||||
b += delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scale (multiply) from zero by x and y
|
||||
/// </summary>
|
||||
/// <param name="xScale"></param>
|
||||
/// <param name="yScale"></param>
|
||||
/// <returns>scaled copy</returns>
|
||||
public ICurve ScaleFromOrigin(double xScale, double yScale)
|
||||
{
|
||||
return new LineSegment(Point.Scale(xScale, yScale, a), Point.Scale(xScale, yScale, b));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets the parameter at a specific length from the start along the curve
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public double GetParameterAtLength(double length) {
|
||||
var len = (b - a).Length;
|
||||
if (len < ApproximateComparer.Tolerance)
|
||||
return 0;
|
||||
var t = length/len;
|
||||
return t > 1 ? 1 : (t < 0 ? 0 : t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the transformed curve
|
||||
/// </summary>
|
||||
/// <param name="transformation"></param>
|
||||
/// <returns>the transformed curve</returns>
|
||||
public ICurve Transform(PlaneTransformation transformation) {
|
||||
return new LineSegment(transformation * a, transformation * b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and targetPoint is minimal
|
||||
/// and t belongs to the closed segment [low,high]
|
||||
/// </summary>
|
||||
/// <param name="targetPoint">the point to find the closest point</param>
|
||||
/// <param name="high">the upper bound of the parameter</param>
|
||||
/// <param name="low">the low bound of the parameter</param>
|
||||
/// <returns></returns>
|
||||
public double ClosestParameterWithinBounds(Point targetPoint, double low, double high) {
|
||||
var t = ClosestParameter(targetPoint);
|
||||
if (t < low)
|
||||
t = low;
|
||||
if(t>high)
|
||||
t=high;
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return length of the curve segment [start,end]
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public double LengthPartial(double start, double end) {
|
||||
return (this[end] - this[start]).Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the length of the curve
|
||||
/// </summary>
|
||||
public double Length {
|
||||
get {
|
||||
return (a - b).Length;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The bounding box of the line
|
||||
/// </summary>
|
||||
public Rectangle BoundingBox {
|
||||
get {
|
||||
return new Rectangle(Start, End);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// clones the curve.
|
||||
/// </summary>
|
||||
/// <returns>the cloned curve</returns>
|
||||
|
||||
public ICurve Clone() {
|
||||
return new LineSegment(this.a, this.b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a parameter t such that the distance between curve[t] and a is minimal
|
||||
/// </summary>
|
||||
/// <param name="targetPoint"></param>
|
||||
/// <returns></returns>
|
||||
public double ClosestParameter(Point targetPoint) {
|
||||
return Point.ClosestParameterOnLineSegment(targetPoint, Start, End);
|
||||
}
|
||||
/// <summary>
|
||||
/// left derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point LeftDerivative(double t) {
|
||||
return Derivative(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// right derivative at t
|
||||
/// </summary>
|
||||
/// <param name="t">the parameter where the derivative is calculated</param>
|
||||
/// <returns></returns>
|
||||
public Point RightDerivative(double t) {
|
||||
return Derivative(t);
|
||||
}
|
||||
/// <summary>
|
||||
/// returns true if segments are not parallel and are intesecting
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="d"></param>
|
||||
/// <param name="x"></param>
|
||||
/// <returns></returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "d"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "c"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "b"), SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "a"), SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "4#")]
|
||||
public static bool Intersect(Point a, Point b, Point c, Point d, out Point x) {
|
||||
if (!Point.LineLineIntersection(a, b, c, d, out x))
|
||||
return false;
|
||||
return XIsBetweenPoints(ref a, ref b, ref x) && XIsBetweenPoints(ref c, ref d, ref x);
|
||||
}
|
||||
|
||||
static bool XIsBetweenPoints(ref Point a, ref Point b, ref Point x) {
|
||||
return (a - x) * (b - x) <= ApproximateComparer.DistanceEpsilon;
|
||||
}
|
||||
|
||||
#region ICurve Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double Curvature(double t) {
|
||||
return 0;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureDerivative(double t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public double CurvatureSecondDerivative(double t) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// [a,b] and [c,d] are the segments. u and v are the corresponding closest point params
|
||||
/// see http://www.geometrictools.com/Documentation/DistanceLine3Line3.pdf
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="d"></param>
|
||||
/// <param name="parab"></param>
|
||||
/// <param name="parcd"></param>
|
||||
internal static double MinDistBetweenLineSegments(Point a, Point b, Point c, Point d, out double parab, out double parcd) {
|
||||
Point u = b - a;
|
||||
Point v = d - c;
|
||||
Point w = a - c;
|
||||
|
||||
double D = Point.CrossProduct(u, v);
|
||||
|
||||
double uu = u * u; // always >= 0
|
||||
double uv = u * v;
|
||||
double vv = v * v; // always >= 0
|
||||
double uw = u * w;
|
||||
double vw = v * w;
|
||||
double sN, tN;
|
||||
double absD = Math.Abs(D);
|
||||
double sD = absD, tD = absD;
|
||||
|
||||
// compute the line parameters of the two closest points
|
||||
if (absD < ApproximateComparer.Tolerance) { // the lines are almost parallel
|
||||
sN = 0.0; // force using point a on segment [a..b]
|
||||
sD = 1.0; // to prevent possible division by 0.0 later
|
||||
tN = vw;
|
||||
tD = vv;
|
||||
}
|
||||
else { // get the closest points on the infinite lines
|
||||
sN = Point.CrossProduct(v, w);
|
||||
tN = Point.CrossProduct(u, w);
|
||||
if (D < 0) {
|
||||
sN = -sN;
|
||||
tN = -tN;
|
||||
}
|
||||
|
||||
if (sN < 0.0) { // parab < 0 => the s=0 edge is visible
|
||||
sN = 0.0;
|
||||
tN = vw;
|
||||
tD = vv;
|
||||
}
|
||||
else if (sN > sD) { // parab > 1 => the s=1 edge is visible
|
||||
sN = sD = 1;
|
||||
tN = vw + uv;
|
||||
tD = vv;
|
||||
}
|
||||
}
|
||||
|
||||
if (tN < 0.0) { // tc < 0 => the t=0 edge is visible
|
||||
tN = 0.0;
|
||||
// recompute parab for this edge
|
||||
if (-uw < 0.0)
|
||||
sN = 0.0;
|
||||
else if (-uw > uu)
|
||||
sN = sD;
|
||||
else {
|
||||
sN = -uw;
|
||||
sD = uu;
|
||||
}
|
||||
}
|
||||
else if (tN > tD) { // tc > 1 => the t=1 edge is visible
|
||||
tN = tD = 1;
|
||||
// recompute parab for this edge
|
||||
if ((-uw + uv) < 0.0)
|
||||
sN = 0;
|
||||
else if ((-uw + uv) > uu)
|
||||
sN = sD;
|
||||
else {
|
||||
sN = (-uw + uv);
|
||||
sD = uu;
|
||||
}
|
||||
}
|
||||
|
||||
// finally do the division to get parameters
|
||||
parab = (Math.Abs(sN) < ApproximateComparer.Tolerance ? 0.0 : sN / sD);
|
||||
parcd = (Math.Abs(tN) < ApproximateComparer.Tolerance ? 0.0 : tN / tD);
|
||||
|
||||
// get the difference of the two closest points
|
||||
Point dP = w + (parab * u) - (parcd * v);
|
||||
|
||||
return dP.Length; // return the closest distance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 58ccf7a3701aeea4d9dbc54d63e11731
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// solves a linear system of two equations with to unknown variables
|
||||
/// </summary>
|
||||
internal class LinearSystem2 {
|
||||
LinearSystem2() { }
|
||||
static double eps = 1.0E-8;
|
||||
|
||||
internal static double Eps {
|
||||
get { return LinearSystem2.eps; }
|
||||
// set { LinearSystem2.eps = value; }
|
||||
}
|
||||
|
||||
internal static bool Solve(double a00, double a01, double b0, double a10, double a11, double b1, out double x, out double y) {
|
||||
double d = a00 * a11 - a10 * a01;
|
||||
|
||||
if (Math.Abs(d) < Eps) {
|
||||
x = y = 0; //to avoid the compiler bug
|
||||
return false;
|
||||
}
|
||||
|
||||
x = (b0 * a11 - b1 * a01) / d;
|
||||
y = (a00 * b1 - a10 * b0) / d;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b5c55970eec189a468d9c4b82fdc5a50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
//For curves A(s) and B(t) with some guess for the parameters (s0, t0) we
|
||||
//are trying to bring to (0,0) the vector(Fs,Ft).
|
||||
//where F(s,t) = (A(s) - B(t))^2. To minimize F^2,
|
||||
//you get the system of equations to solve for ds and dt:
|
||||
//Fs + Fss*ds + Fst*dt = 0
|
||||
//Ft + Fst*ds + Ftt*dt = 0
|
||||
//
|
||||
//Where F = F(si,ti), Fs and Ft are the first partials at si, ti, Fxx are the second partials,
|
||||
// and s(i+1) = si+ds, t(i+1) = ti+dt.
|
||||
//Of course you have to make sure that ds and dt do not take you out of your domain.
|
||||
//This will converge if the curves have 2nd order continuity
|
||||
//and we are starting parameters are reasonable.
|
||||
//It is not a good method for situations that are not well behaved, but it is really simple.
|
||||
/// <summary>
|
||||
/// Implements the minimal distance between curves functionality
|
||||
/// </summary>
|
||||
#if TEST_MSAGL
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Dist")]
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class MinDistCurveCurve {
|
||||
|
||||
ICurve curveA;
|
||||
ICurve curveB;
|
||||
double aMin;
|
||||
double aMax;
|
||||
double bMin; double bMax;
|
||||
double aGuess; double bGuess;
|
||||
double aSolution;
|
||||
internal double ASolution {
|
||||
get { return aSolution; }
|
||||
}
|
||||
double bSolution;
|
||||
internal double BSolution {
|
||||
get { return bSolution; }
|
||||
}
|
||||
|
||||
Point aPoint;
|
||||
internal Point APoint { get { return aPoint; } }
|
||||
|
||||
Point bPoint;
|
||||
internal Point BPoint { get { return bPoint; } }
|
||||
bool status;
|
||||
internal bool Status { get { return status; } }
|
||||
double si;
|
||||
double ti;
|
||||
|
||||
Point a, b, a_b, ad, bd, add, bdd;
|
||||
|
||||
void InitValues() {
|
||||
a = curveA[si];
|
||||
b = curveB[ti];
|
||||
a_b = a - b;
|
||||
ad = curveA.Derivative(si);
|
||||
add = curveA.SecondDerivative(si);
|
||||
bd = curveB.Derivative(ti);
|
||||
bdd = curveB.SecondDerivative(ti);
|
||||
}
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="curveAPar">first curve</param>
|
||||
/// <param name="curveBPar">second curve</param>
|
||||
/// <param name="lowBound0">the first curve minimal parameter</param>
|
||||
/// <param name="upperBound0">the first curve maximal parameter</param>
|
||||
/// <param name="lowBound1">the second curve minimal parameter</param>
|
||||
/// <param name="upperBound1">the first curve maximal parameter</param>
|
||||
/// <param name="guess0"></param>
|
||||
/// <param name="guess1"></param>
|
||||
public MinDistCurveCurve(ICurve curveAPar,
|
||||
ICurve curveBPar,
|
||||
double lowBound0,
|
||||
double upperBound0,
|
||||
double lowBound1,
|
||||
double upperBound1,
|
||||
double guess0,
|
||||
double guess1) {
|
||||
this.curveA = curveAPar;
|
||||
this.curveB = curveBPar;
|
||||
this.aMin = lowBound0;
|
||||
this.bMin = lowBound1;
|
||||
this.aMax = upperBound0;
|
||||
this.bMax = upperBound1;
|
||||
this.aGuess = guess0;
|
||||
this.bGuess = guess1;
|
||||
this.si = guess0;
|
||||
this.ti = guess1;
|
||||
}
|
||||
|
||||
|
||||
//we ignore the mulitplier 2 here fore efficiency reasons
|
||||
double Fs {
|
||||
get {
|
||||
return /*2**/a_b * ad;
|
||||
}
|
||||
}
|
||||
|
||||
double Fss {
|
||||
get {
|
||||
return /*2**/(a_b * add + ad * ad);
|
||||
}
|
||||
}
|
||||
|
||||
double Fst //equals to Fts
|
||||
{
|
||||
get {
|
||||
return - /*2**/bd * ad;
|
||||
}
|
||||
}
|
||||
|
||||
double Ftt {
|
||||
get {
|
||||
return /*2**/(-a_b * bdd + bd * bd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double Ft {
|
||||
get {
|
||||
return -/*2**/a_b * bd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// xy - the first row
|
||||
/// uw - the second row
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="u"></param>
|
||||
/// <param name="w"></param>
|
||||
internal static double Delta(double x, double y, double u, double w) {
|
||||
return x * w - u * y;
|
||||
}
|
||||
//Fs + Fss*ds + Fst*dt = 0
|
||||
//Ft + Fst*ds + Ftt*dt = 0
|
||||
internal void Solve() {
|
||||
|
||||
int numberOfBoundaryCrossings = 0;
|
||||
const int maxNumberOfBoundaryCrossings = 10;
|
||||
int numberOfTotalReps = 0;
|
||||
const int maxNumberOfTotalReps = 100;
|
||||
|
||||
bool abort = false;
|
||||
|
||||
InitValues();
|
||||
|
||||
if (curveA is LineSegment && curveB is LineSegment ) {
|
||||
Point bd1 = curveB.Derivative(0);
|
||||
bd1 /= bd1.Length;
|
||||
Point an = (curveA as LineSegment).Normal;
|
||||
|
||||
double del = Math.Abs(an * bd1);
|
||||
|
||||
|
||||
if (Math.Abs(del) < ApproximateComparer.DistanceEpsilon || Delta(Fss, Fst, Fst, Ftt) < ApproximateComparer.Tolerance) {
|
||||
status = true;
|
||||
ParallelLineSegLineSegMinDist();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
double ds, dt;
|
||||
do {
|
||||
|
||||
//hopefully it will be inlined by the compiler
|
||||
double delta = Delta(Fss, Fst, Fst, Ftt);
|
||||
if (Math.Abs(delta) < ApproximateComparer.Tolerance) {
|
||||
status = false;
|
||||
abort = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ds = Delta(-Fs, Fst, -Ft, Ftt) / delta;
|
||||
dt = Delta(Fss, -Fs, Fst, -Ft) / delta;
|
||||
|
||||
|
||||
double nsi = si + ds;
|
||||
double nti = ti + dt;
|
||||
|
||||
bool bc;
|
||||
|
||||
if (nsi > aMax + ApproximateComparer.DistanceEpsilon || nsi < aMin - ApproximateComparer.DistanceEpsilon || nti > bMax + ApproximateComparer.DistanceEpsilon || nti < bMin - ApproximateComparer.DistanceEpsilon) {
|
||||
numberOfBoundaryCrossings++;
|
||||
ChopDsDt(ref ds, ref dt);
|
||||
si += ds;
|
||||
ti += dt;
|
||||
bc = true;
|
||||
} else {
|
||||
bc = false;
|
||||
si = nsi;
|
||||
ti = nti;
|
||||
if (si > aMax)
|
||||
si = aMax;
|
||||
else if (si < aMin)
|
||||
si = aMin;
|
||||
|
||||
if (ti > bMax)
|
||||
ti = bMax;
|
||||
else if (ti < bMin)
|
||||
ti = bMin;
|
||||
}
|
||||
|
||||
InitValues();
|
||||
|
||||
numberOfTotalReps++;
|
||||
|
||||
abort = numberOfBoundaryCrossings >= maxNumberOfBoundaryCrossings ||
|
||||
numberOfTotalReps >= maxNumberOfTotalReps || (ds == 0 && dt == 0 && bc);
|
||||
|
||||
} while ((Math.Abs(ds) >= ApproximateComparer.Tolerance || Math.Abs(dt) >= ApproximateComparer.Tolerance) && !abort);
|
||||
|
||||
if (abort) {
|
||||
//may be the initial values were just OK
|
||||
Point t = curveA[aGuess] - curveB[bGuess];
|
||||
if (t * t < ApproximateComparer.DistanceEpsilon * ApproximateComparer.DistanceEpsilon) {
|
||||
aSolution = aGuess;
|
||||
bSolution = bGuess;
|
||||
aPoint = curveA[aGuess];
|
||||
bPoint = curveB[bGuess];
|
||||
status = true;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
aSolution = si;
|
||||
bSolution = ti;
|
||||
aPoint = a;
|
||||
bPoint = b;
|
||||
status = !abort;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ChopDsDt(ref double ds, ref double dt) {
|
||||
if (ds != 0 && dt != 0) {
|
||||
double k1 = 1; //we are looking for a chopped vector of the form k(ds,dt)
|
||||
|
||||
if (si + ds > aMax) //we have si+k*ds=aMax
|
||||
k1 = (aMax - si) / ds;
|
||||
else if (si + ds < aMin)
|
||||
k1 = (aMin - si) / ds;
|
||||
|
||||
double k2 = 1;
|
||||
|
||||
if (ti + dt > bMax) //we need to have ti+k*dt=bMax or ti+k*dt=bMin
|
||||
k2 = (bMax - ti) / dt;
|
||||
else if (ti + dt < bMin)
|
||||
k2 = (bMin - ti) / dt;
|
||||
|
||||
double k = Math.Min(k1, k2);
|
||||
ds *= k;
|
||||
dt *= k;
|
||||
|
||||
} else if (ds == 0) {
|
||||
if (ti + dt > bMax)
|
||||
dt = bMax - ti;
|
||||
else if (ti + dt < bMin)
|
||||
dt = bMin - ti;
|
||||
} else { //dt==0)
|
||||
if (si + ds > aMax)
|
||||
ds = aMax - si;
|
||||
else if (si + ds < aMin)
|
||||
ds = aMin - si;
|
||||
}
|
||||
}
|
||||
|
||||
void ParallelLineSegLineSegMinDist() {
|
||||
LineSegment l0 = curveA as LineSegment;
|
||||
LineSegment l1 = curveB as LineSegment;
|
||||
|
||||
Point v0 = l0.Start;
|
||||
Point v1 = l0.End;
|
||||
Point v2 = l1.Start;
|
||||
Point v3 = l1.End;
|
||||
|
||||
Point d0 = v1 - v0;
|
||||
|
||||
double nd0 = d0.Length;
|
||||
|
||||
double r0 = 0, r1, r2, r3;
|
||||
|
||||
if (nd0 > ApproximateComparer.DistanceEpsilon) {
|
||||
//v0 becomes the zero point
|
||||
d0 /= nd0;
|
||||
r1 = d0 * (v1 - v0);
|
||||
r2 = d0 * (v2 - v0);
|
||||
r3 = d0 * (v3 - v0);
|
||||
|
||||
bool swapped = false;
|
||||
if (r2 > r3) {
|
||||
swapped = true;
|
||||
double t = r2;
|
||||
r2 = r3;
|
||||
r3 = t;
|
||||
}
|
||||
|
||||
if (r3 < r0) {
|
||||
aSolution = 0;
|
||||
bSolution = swapped ? 0 : 1;
|
||||
} else if (r2 > r1) {
|
||||
aSolution = 1;
|
||||
bSolution = swapped ? 1 : 0;
|
||||
|
||||
} else {
|
||||
double r = Math.Min(r1, r3);
|
||||
aSolution = r / (r1 - r0);
|
||||
bSolution = (r - r2) / (r3 - r2);
|
||||
if (swapped)
|
||||
bSolution = 1 - bSolution;
|
||||
|
||||
}
|
||||
} else {
|
||||
Point d1 = v3 - v2;
|
||||
double nd1 = d1.Length;
|
||||
if (nd1 > ApproximateComparer.DistanceEpsilon) {
|
||||
//v2 becomes the zero point
|
||||
d1 /= nd1;
|
||||
r0 = 0; //v2 position
|
||||
r1 = d1 * (v3 - v2);//v3 position
|
||||
r2 = d1 * (v0 - v2);//v0 position - here v0 and v1 are indistinguishable
|
||||
|
||||
|
||||
if (r2 < r0) {
|
||||
bSolution = 0;
|
||||
aSolution = 1;
|
||||
} else if (r2 > r1) {
|
||||
bSolution = 1;
|
||||
aSolution = 0;
|
||||
|
||||
} else {
|
||||
double r = Math.Min(r1, r2);
|
||||
bSolution = r / (r1 - r0);
|
||||
aSolution = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
aSolution = 0;
|
||||
bSolution = 0;
|
||||
}
|
||||
}
|
||||
aPoint = curveA[aSolution];
|
||||
bPoint = curveB[bSolution];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 769a03cab788c094b9cd2195e07c0e8c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
461
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Parallelogram.cs
Normal file
461
Assets/Scripts/NIH/MSAGL/Core/Geometry/Curves/Parallelogram.cs
Normal file
|
|
@ -0,0 +1,461 @@
|
|||
// #region Using directives
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
//#endregion
|
||||
|
||||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
|
||||
/// <summary>
|
||||
/// Parallelogram vertex type.
|
||||
/// The clockwise order of vertices is Corner, A, OtherCorner,B
|
||||
/// </summary>
|
||||
|
||||
|
||||
public enum VertexId {
|
||||
/// <summary>
|
||||
/// the basic corner vertex
|
||||
/// </summary>
|
||||
Corner = 0,
|
||||
/// <summary>
|
||||
/// a vertex adjacent to the basic corner
|
||||
/// </summary>
|
||||
VertexA,
|
||||
/// <summary>
|
||||
/// the corner opposite to the basic corner
|
||||
/// </summary>
|
||||
OtherCorner,
|
||||
/// <summary>
|
||||
/// another vertex adjacent to the basic corner
|
||||
/// </summary>
|
||||
VertexB
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// It is a parallelogram with the vertices corner, corner+coeff,corner+coeff+side1 and corner+side1.
|
||||
/// Parallelograms are used by GLEE in curve intersections routines.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")
|
||||
#if TEST_MSAGL
|
||||
, Serializable
|
||||
#endif
|
||||
]
|
||||
//parallelograms are not stored in dictionaries
|
||||
public struct Parallelogram {
|
||||
|
||||
bool isSeg;
|
||||
|
||||
Point corner;
|
||||
Point a;//a side exiting from the corner
|
||||
Point b;//another side exiting from the corner
|
||||
Point otherCorner;
|
||||
Point aPlusCorner;
|
||||
Point bPlusCorner;
|
||||
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=371
|
||||
// SharpKit/Colin: this to support the lack of int casting to enums
|
||||
private IEnumerable<Point> AllVertices
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return corner;
|
||||
yield return aPlusCorner;
|
||||
yield return otherCorner;
|
||||
yield return bPlusCorner;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Point> OtherVertices
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return aPlusCorner;
|
||||
yield return otherCorner;
|
||||
yield return bPlusCorner;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal Point Corner {
|
||||
get { return corner; }
|
||||
}
|
||||
|
||||
internal Point OtherCorner {
|
||||
get { return otherCorner; }
|
||||
}
|
||||
|
||||
Point aRot;//a rotated on 90 degrees towards side1
|
||||
Point bRot; //side1 rotated on 90 degrees towards coeff
|
||||
|
||||
double abRot; //the scalar product coeff*bRot
|
||||
double baRot; //the scalar product side1*aRot;
|
||||
/// <summary>
|
||||
/// to string
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
override public string ToString() {
|
||||
return String.Format(CultureInfo.InvariantCulture, "({0},{1},{2},{3})", Vertex(0), Vertex(VertexId.VertexA),
|
||||
Vertex(VertexId.OtherCorner), Vertex(VertexId.VertexB));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs the parallelogram by the corner and two sides.
|
||||
/// </summary>
|
||||
/// <param name="corner">the corner</param>
|
||||
/// <param name="sideA">a side</param>
|
||||
/// <param name="sideB">another side</param>
|
||||
public Parallelogram(Point corner, Point sideA, Point sideB) {
|
||||
|
||||
this.corner = corner;
|
||||
this.a = sideA;
|
||||
this.b = sideB;
|
||||
|
||||
this.aRot = new Point(-sideA.Y, sideA.X);
|
||||
if (aRot.Length > 0.5)
|
||||
aRot = aRot.Normalize();
|
||||
|
||||
this.bRot = new Point(-sideB.Y, sideB.X);
|
||||
if (bRot.Length > 0.5)
|
||||
bRot = bRot.Normalize();
|
||||
|
||||
abRot = sideA * bRot;
|
||||
|
||||
baRot = sideB * aRot;
|
||||
|
||||
|
||||
if (abRot < 0) {
|
||||
abRot = -abRot;
|
||||
bRot = -bRot;
|
||||
}
|
||||
|
||||
if (baRot < 0) {
|
||||
baRot = -baRot;
|
||||
aRot = -aRot;
|
||||
}
|
||||
|
||||
|
||||
isSeg = (sideA - sideB).Length < ApproximateComparer.DistanceEpsilon;
|
||||
|
||||
aPlusCorner = sideA + corner;
|
||||
otherCorner = sideB +aPlusCorner;
|
||||
bPlusCorner = sideB + corner;
|
||||
}
|
||||
/// <summary>
|
||||
/// Return true if the parallelogram contains the point
|
||||
/// </summary>
|
||||
/// <param name="point"></param>
|
||||
/// <returns></returns>
|
||||
public bool Contains(Point point) {
|
||||
Point g = point - corner;
|
||||
double e = ApproximateComparer.DistanceEpsilon;
|
||||
|
||||
double gbRot = g * bRot;
|
||||
if (gbRot > abRot + e || gbRot < -e)
|
||||
return false;
|
||||
|
||||
double gaRot = g * aRot;
|
||||
return gaRot <= baRot + e && gaRot >= -e;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// return the area of the parallelogram
|
||||
/// </summary>
|
||||
public double Area { get { return Math.Abs(a.X * b.Y - a.Y * b.X); } }
|
||||
|
||||
/// <summary>
|
||||
/// Return the correspoingin vertex of the parallelogram
|
||||
/// </summary>
|
||||
/// <param name="vertexPar">vertex kind</param>
|
||||
/// <returns>vertex value</returns>
|
||||
public Point Vertex(VertexId vertexPar) {
|
||||
switch (vertexPar) {
|
||||
case VertexId.Corner: return corner;
|
||||
case VertexId.VertexA: return aPlusCorner;
|
||||
case VertexId.OtherCorner: return OtherCorner;
|
||||
case VertexId.VertexB: return bPlusCorner;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if parallelograms intersect
|
||||
/// </summary>
|
||||
/// <param name="parallelogram0"></param>
|
||||
/// <param name="parallelogram1"></param>
|
||||
/// <returns></returns>
|
||||
static public bool Intersect(Parallelogram parallelogram0, Parallelogram parallelogram1) {
|
||||
//my hunch is that p0 and p1 do not intersect if and only if
|
||||
//they can be separated with one of the parallelogram sides in case when at least one of them
|
||||
|
||||
|
||||
bool ret = !(separByA(ref parallelogram0, ref parallelogram1) || separByA(ref parallelogram1, ref parallelogram0) ||
|
||||
separByB(ref parallelogram0, ref parallelogram1) || separByB(ref parallelogram1, ref parallelogram0));
|
||||
|
||||
if (ret == false)
|
||||
return false;
|
||||
|
||||
if (!(parallelogram0.isSeg && parallelogram1.isSeg))
|
||||
return true;
|
||||
|
||||
|
||||
if (!Point.ParallelWithinEpsilon(parallelogram0.OtherCorner - parallelogram0.Corner,
|
||||
parallelogram1.OtherCorner - parallelogram1.Corner, 1.0E-5))
|
||||
return true;
|
||||
|
||||
//here we know that the segs are parallel
|
||||
return ParallelSegsIntersect(ref parallelogram1, ref parallelogram0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static bool ParallelSegsIntersect(ref Parallelogram p0, ref Parallelogram p1) {
|
||||
|
||||
Point v0 = p0.Corner;
|
||||
Point v1 = p0.OtherCorner;
|
||||
|
||||
Point v2 = p1.Corner;
|
||||
Point v3 = p1.OtherCorner;
|
||||
|
||||
|
||||
Point d = v1 - v0;
|
||||
|
||||
//let us imagine that v0 is at zero
|
||||
|
||||
double r0 = 0; // position of v0
|
||||
|
||||
//offset of v1
|
||||
double r1 = d * d;
|
||||
|
||||
//offset of v2
|
||||
double r2 = (v2 - v0) * d;
|
||||
|
||||
//offset of v3
|
||||
double r3 = (v3 - v0) * d;
|
||||
|
||||
// we need to check if [r0,r1] intersects [r2,r3]
|
||||
|
||||
if (r2 > r3) {
|
||||
double t = r2;
|
||||
r2 = r3;
|
||||
r3 = t;
|
||||
}
|
||||
|
||||
return !(r3 < r0 - ApproximateComparer.DistanceEpsilon || r2 > r1 + ApproximateComparer.DistanceEpsilon);
|
||||
|
||||
}
|
||||
|
||||
static double mult(ref Point a, ref Point b) {
|
||||
return a.X * b.X + a.Y * b.Y;
|
||||
}
|
||||
|
||||
static bool separByA(ref Parallelogram p0, ref Parallelogram p1) {
|
||||
|
||||
double eps = ApproximateComparer.DistanceEpsilon;
|
||||
Point t = new Point(p1.corner.X - p0.corner.X, p1.corner.Y - p0.corner.Y);
|
||||
double p1a = mult(ref t , ref p0.aRot);
|
||||
|
||||
if (p1a > p0.baRot + eps) {
|
||||
t.X = p1.aPlusCorner.X - p0.corner.X;
|
||||
t.Y = p1.aPlusCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) <= p0.baRot + eps)
|
||||
return false;
|
||||
|
||||
t.X = p1.bPlusCorner.X - p0.corner.X;
|
||||
t.Y = p1.bPlusCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) <= p0.baRot + eps)
|
||||
return false;
|
||||
|
||||
t.X = p1.otherCorner.X - p0.corner.X;
|
||||
t.Y = p1.otherCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) <= p0.baRot + eps)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
} else if (p1a < -eps) {
|
||||
t.X = p1.aPlusCorner.X - p0.corner.X;
|
||||
t.Y = p1.aPlusCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) >= - eps)
|
||||
return false;
|
||||
|
||||
t.X = p1.bPlusCorner.X - p0.corner.X;
|
||||
t.Y = p1.bPlusCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) >= -eps)
|
||||
return false;
|
||||
|
||||
t.X = p1.otherCorner.X - p0.corner.X;
|
||||
t.Y = p1.otherCorner.Y - p0.corner.Y;
|
||||
if (mult(ref t, ref p0.aRot) >= -eps)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;/*
|
||||
double eps = Curve.DistEps;
|
||||
|
||||
double p1a = (p1.Corner - p0.Corner) * p0.aRot;
|
||||
|
||||
if (p1a > p0.baRot + eps) {
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if ((p1.Vertex((Parallelogram.VertexId)i) - p0.corner) * p0.aRot <= p0.baRot + eps)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else if (p1a < -eps) {
|
||||
for (int i = 1; i < 4; i++) {
|
||||
|
||||
double delta = (p1.Vertex((Parallelogram.VertexId)i) - p0.corner) * p0.aRot;
|
||||
|
||||
if (delta >= -eps) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;*/
|
||||
}
|
||||
|
||||
|
||||
static bool separByB(ref Parallelogram p0, ref Parallelogram p1) {
|
||||
double eps = ApproximateComparer.DistanceEpsilon;
|
||||
double p1a = (p1.Vertex(0) - p0.corner) * p0.bRot;
|
||||
|
||||
if (p1a > p0.abRot + eps) {
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=371
|
||||
//SharpKit/Colin - can't cast ints to enum
|
||||
foreach (var i in p1.OtherVertices)
|
||||
if ((i - p0.corner)*p0.bRot <= p0.abRot + eps)
|
||||
return false;
|
||||
#else
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if ((p1.Vertex((VertexId)i) - p0.corner) * p0.bRot <= p0.abRot + eps)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
} else if (p1a < -eps) {
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=371
|
||||
//SharpKit/Colin - can't cast ints to enum
|
||||
foreach (var i in p1.OtherVertices)
|
||||
if ((i - p0.corner) * p0.bRot >= -eps)
|
||||
return false;
|
||||
#else
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if ((p1.Vertex((VertexId)i) - p0.corner) * p0.bRot >= -eps)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// create a Parallelogram over a group
|
||||
/// </summary>
|
||||
/// <param name="boxes">group of boxes</param>
|
||||
/// <returns>xy box</returns>
|
||||
internal static Parallelogram GetParallelogramOfAGroup(List<Parallelogram> boxes) {
|
||||
|
||||
double minX = 0, maxX = 0, minY = 0, maxY = 0;//have to int - getting compiler error - bug
|
||||
bool firstTime = true;
|
||||
foreach (Parallelogram b in boxes) {
|
||||
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=371
|
||||
// SharpKit/Colin: can't cast ints to enums
|
||||
foreach (Point v in b.AllVertices) {
|
||||
#else
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Point v = b.Vertex((VertexId)i);
|
||||
#endif
|
||||
double x = v.X;
|
||||
double y = v.Y;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
minX = maxX = x;
|
||||
minY = maxY = y;
|
||||
} else {
|
||||
if (x < minX) {
|
||||
minX = x;
|
||||
} else if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
if (y < minY) {
|
||||
minY = y;
|
||||
} else if (y > maxY) {
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return new Parallelogram(new Point(minX, minY), new Point(0, maxY - minY), new Point(maxX - minX, 0));
|
||||
}
|
||||
|
||||
internal Parallelogram(Parallelogram box0, Parallelogram box1) {
|
||||
Point v = box0.Corner;
|
||||
double minX, maxX, minY, maxY;
|
||||
minX = maxX = v.X;
|
||||
minY = maxY = v.Y;
|
||||
|
||||
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box0.aPlusCorner);
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box0.otherCorner);
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box0.bPlusCorner);
|
||||
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box1.corner);
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box1.aPlusCorner);
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box1.otherCorner);
|
||||
PumpMinMax(ref minX, ref maxX, ref minY, ref maxY, ref box1.bPlusCorner);
|
||||
|
||||
this.corner = new Point(minX, minY);
|
||||
this.a = new Point(0, maxY - minY);
|
||||
this.b = new Point(maxX - minX, 0);
|
||||
|
||||
aPlusCorner = a + corner;
|
||||
otherCorner = b + aPlusCorner;
|
||||
bPlusCorner = b + corner;
|
||||
|
||||
this.aRot = new Point(-this.a.Y, this.a.X);
|
||||
if (aRot.Length > 0.5)
|
||||
aRot = aRot.Normalize();
|
||||
|
||||
this.bRot = new Point(-this.b.Y, this.b.X);
|
||||
if (bRot.Length > 0.5)
|
||||
bRot = bRot.Normalize();
|
||||
|
||||
abRot = this.a * bRot;
|
||||
baRot = this.b * aRot;
|
||||
|
||||
|
||||
if (abRot < 0) {
|
||||
abRot = -abRot;
|
||||
bRot = -bRot;
|
||||
}
|
||||
|
||||
if (baRot < 0) {
|
||||
baRot = -baRot;
|
||||
aRot = -aRot;
|
||||
}
|
||||
|
||||
isSeg = (this.a - this.b).Length < ApproximateComparer.DistanceEpsilon;
|
||||
}
|
||||
|
||||
static void PumpMinMax(ref double minX, ref double maxX, ref double minY, ref double maxY,
|
||||
ref Point p) {
|
||||
if (p.X < minX) {
|
||||
minX = p.X;
|
||||
} else if (p.X > maxX) {
|
||||
maxX = p.X;
|
||||
}
|
||||
if (p.Y < minY) {
|
||||
minY = p.Y;
|
||||
} else if (p.Y > maxY) {
|
||||
maxY = p.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8f080cd400c38514bbbece3bca6c2bb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
namespace Microsoft.Msagl.Core.Geometry.Curves {
|
||||
/// <summary>
|
||||
/// Keeps left and right sons of the node. Is used in curve intersections routines.
|
||||
/// </summary>
|
||||
internal class ParallelogramBinaryTreeNode:ParallelogramNode {
|
||||
|
||||
ParallelogramNode leftSon;
|
||||
public ParallelogramNode LeftSon {
|
||||
get {
|
||||
return leftSon;
|
||||
}
|
||||
set {
|
||||
leftSon = value;
|
||||
}
|
||||
}
|
||||
ParallelogramNode rightSon;
|
||||
|
||||
public ParallelogramNode RightSon {
|
||||
get {
|
||||
return rightSon;
|
||||
}
|
||||
set {
|
||||
rightSon = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue