Example #1
0
        void CalculatePbNode()
        {
            pBNode = new ParallelogramInternalTreeNode(this, ParallelogramNodeOverICurve.DefaultLeafBoxesOffset);
            var           parallelograms = new List <Parallelogram>();
            PolylinePoint pp             = StartPoint;
            int           offset         = 0;

            while (pp.Next != null)
            {
                Parallelogram parallelogram = ParallelogramOfLineSeg(pp.Point, pp.Next.Point);
                parallelograms.Add(parallelogram);
                pBNode.AddChild(new ParallelogramLeaf(offset, offset + 1, parallelogram, this, 0));
                pp = pp.Next;
                offset++;
            }

            if (Closed)
            {
                Parallelogram parallelogram = ParallelogramOfLineSeg(EndPoint.Point, StartPoint.Point);
                parallelograms.Add(parallelogram);
                pBNode.AddChild(new ParallelogramLeaf(offset, offset + 1, parallelogram, this, 0));
            }

            pBNode.Parallelogram = Parallelogram.GetParallelogramOfAGroup(parallelograms);
        }
        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);
        }
 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;
 }