コード例 #1
0
ファイル: PathFinder.cs プロジェクト: ucswift/MatterSlice
        private IntPointNode AddTempWayPoint(WayPointsToRemove removePointList, IntPoint position)
        {
            var node = OutlineData.Waypoints.AddNode(position);

            removePointList.Add(node);
            return(node);
        }
コード例 #2
0
        public Path <IntPointNode> FindPath(IntPoint startPosition, IntPoint startLinkA, IntPoint startLinkB,
                                            IntPoint endPosition, IntPoint endLinkA, IntPoint endLinkB)
        {
            using (WayPointsToRemove removePointList = new WayPointsToRemove(this))
            {
                var startNode = AddNode(startPosition, startLinkA, startLinkB);
                removePointList.Add(startNode);
                var endNode = AddNode(endPosition, endLinkA, endLinkB);
                removePointList.Add(endNode);

                // if startPosition and endPosition are on the same line
                if ((startLinkA == endLinkA && startLinkB == endLinkB) ||
                    (startLinkA == endLinkB && startLinkB == endLinkA))
                {
                    // connect them
                    AddPathLink(startNode, endNode);
                }

                var path = FindPath(startNode, endNode, true);

                return(path);
            }
        }