Exemple #1
0
    private static double RightBreakpoint(RedBlackTreeNode <BeachSection> node, double directrix)
    {
        RedBlackTreeNode <BeachSection> rightNode = node.next;

        if ((node.data.site.y - directrix).ApproxEqual(0))
        {
            return(node.data.site.x);
        }

        if (rightNode == null)
        {
            return(double.PositiveInfinity);
        }

        if ((rightNode.data.site.y - directrix).ApproxEqual(0))
        {
            return(rightNode.data.site.x);
        }

        FortuneSite site      = node.data.site;
        FortuneSite rightSite = rightNode.data.site;

        return(ParabolaMath.IntersectParabola(site.x, site.y, rightSite.x, rightSite.y, directrix));
    }
Exemple #2
0
    private static double LeftBreakpoint(RedBlackTreeNode <BeachSection> node, double directrix)
    {
        RedBlackTreeNode <BeachSection> leftNode = node.previous;

        if ((node.data.site.y - directrix).ApproxEqual(0))
        {
            return(node.data.site.x);
        }

        if (leftNode == null)
        {
            return(double.NegativeInfinity);
        }

        if ((leftNode.data.site.y - directrix).ApproxEqual(0))
        {
            return(leftNode.data.site.x);
        }

        FortuneSite site     = node.data.site;
        FortuneSite leftSite = leftNode.data.site;

        return(ParabolaMath.IntersectParabola(leftSite.x, leftSite.y, site.x, site.y, directrix));
    }