示例#1
0
        /* returns true if p is to right of halfedge e */
        private bool right_of(Halfedge el, PointFortune p)
        {
            EdgeF        e;
            PointFortune topsite;
            bool         right_of_site;
            bool         above, fast;
            double       dxp, dyp, dxs, t1, t2, t3, yl;

            e       = el.ELedge;
            topsite = e.reg[1];

            if (p.X > topsite.X)
            {
                right_of_site = true;
            }
            else
            {
                right_of_site = false;
            }

            if (right_of_site && el.ELpm == LE)
            {
                return(true);
            }
            if (!right_of_site && el.ELpm == RE)
            {
                return(false);
            }

            if (e.a == 1.0)
            {
                dxp  = p.X - topsite.X;
                dyp  = p.Y - topsite.Y;
                fast = false;

                if ((!right_of_site & (e.b < 0.0)) | (right_of_site & (e.b >= 0.0)))
                {
                    above = dyp >= e.b * dxp;
                    fast  = above;
                }
                else
                {
                    above = p.X + p.Y * e.b > e.c;
                    if (e.b < 0.0)
                    {
                        above = !above;
                    }
                    if (!above)
                    {
                        fast = true;
                    }
                }
                if (!fast)
                {
                    dxs   = topsite.X - (e.reg[0]).X;
                    above = e.b * (dxp * dxp - dyp * dyp)
                            < dxs * dyp * (1.0 + 2.0 * dxp / dxs + e.b * e.b);

                    if (e.b < 0)
                    {
                        above = !above;
                    }
                }
            }
            else // e.b == 1.0
            {
                yl    = e.c - e.a * p.X;
                t1    = p.Y - yl;
                t2    = p.X - topsite.X;
                t3    = yl - topsite.Y;
                above = t1 * t1 > t2 * t2 + t3 * t3;
            }
            return(el.ELpm == LE ? above : !above);
        }
示例#2
0
 /*
  * This delete routine can't reclaim node, since pointers from hash table
  * may be present.
  */
 private void ELdelete(Halfedge he)
 {
     (he.ELleft).ELright = he.ELright;
     (he.ELright).ELleft = he.ELleft;
     he.deleted          = true;
 }
示例#3
0
 private Halfedge ELright(Halfedge he)
 {
     return(he.ELright);
 }
示例#4
0
 private Halfedge ELleft(Halfedge he)
 {
     return(he.ELleft);
 }
示例#5
0
 public Halfedge()
 {
     PQnext = null;
 }