示例#1
0
        private AngularBisectorNetwork(IEnumerable <Point2D> points, bool closed)
        {
            queueDictionary = PriorityQueueDictionary <double, Intersection> .CreateLowFirstOut();

            // TODO: Throw an exception on duplicate points
            foreach (Point2D point in points)
            {
                skeleton.Add(new BisectorVertex(point));
            }

            // 1. Initialization
            //  a. Organize the given vertices into one double connected list of active vertices (LAV)
            //     stored in the SLAV. The vertices in LAV are all active at the moment.
            CircularLinkedList <Vertex> lav = CreateLav(closed);

            foreach (Point2D point in points)
            {
                lav.AddLast(new Vertex(point));
            }

            // b. For each vertex Vi in LAV add the pointer to to incident edges ei-1 = Vi-1 Vi
            //    band ei = Vi Vi+1 and compute the vertex angle bisector (ray) bi
            InitializeEdges(lav);
            InitalizeBisectors(lav);

            // c. For each vertex Vi compute the nearer intersection of the bisector bi with the adjacent
            //    vertex bisectors bi-1 and bi+1 starting at the neighbouring vertices Vi-1 Vi+1 and (if
            //    it exists) store it into a priority queue according to the distance to the line L(ei) which
            //    holds edge ei. For each intersection point store references to Va and Vb, the two origins of
            //    the bisectors which have created the intersection point.
            FindFirstIntersections(lav);

            // 2. While the priority queue with the intersection points is not empty process the intersection
            //    points to find futher intersections, until all intersecting bisectors have been processed.
            ProcessIntersections();

            // Add infinite rays from any unprocesseed points remaining
            // TODO: foreach lav in slav
            foreach (Vertex v in lav)
            {
                if (!v.processed)
                {
                    AddTerminalRay(v);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Create the partitioner. New diagonals will be inserted into the result mesh by calls to
        /// the provided DiagonalInserterDelegate which accepts the mesh and from and to vertices for the
        /// new edge.
        /// </summary>
        /// <param name="mesh">The mesh to be partitioned.</param>
        /// <param name="DiagonalInserterDelegate">An action for inserting edges into the mesh between the specificed vertices</param>
        public MonotoneYPartitioner(Mesh <TVertex, TEdge, TFace> mesh,
                                    Action <Mesh <TVertex, TEdge, TFace>, TVertex, TVertex> DiagonalInserterDelegate)
        {
            // TODO: We should copy the mesh here, but no copy-constructor yet!
            //this.mesh = new Mesh<TVertex, TEdge, TFace>(mesh);
            this.mesh = mesh;

            // The comparer used for ordering vertices in the queue - controlling
            // the order in which the sweep line sweeps over vertices
            HighYLowXComparer yxComparer = new HighYLowXComparer();

            meshUtilities                 = new MonotoneMeshUtilities <TVertex>(yxComparer);
            queueDictionary               = new PriorityQueueDictionary <Point2D, TVertex>(yxComparer);
            xEdgeComparer                 = new LeftToRightEdgeComparer();
            sweeplineUtilities            = new SweeplineUtilities(xEdgeComparer);
            helpers                       = new SplayDictionary <EdgeBase, TVertex>(xEdgeComparer);
            this.DiagonalInserterDelegate = DiagonalInserterDelegate;
        }
示例#3
0
 public void Improve()
 {
     // Compute a quality measure for each face and place into a priority queue
     IEnumerable <Pair <double, TFace> > pairs = mesh.Faces.Select(f => new Pair <double, TFace>(Quality(f), f));
     var queue = new PriorityQueueDictionary <double, TFace>(pairs);
 }