static bool IsLocalDelaunay(Halfedge e)
    {
        if (e.IsBoundary())
        {
            return(true);
        }
        Vector3 p1 = e.vert.position;
        Vector3 p2 = e.next.vert.position;
        Vector3 p3 = e.next.next.vert.position;
        Vector3 p4 = e.opp.next.vert.position;

        return(HMeshMath.InCircle(p1, p2, p3, p4) || HMeshMath.InCircle(p2, p1, p4, p2));
    }
示例#2
0
    private void AddToQueue(Dictionary <int, HalfEdgeCounter> counter, SimplePriorityQueue <PQElement> Q, Halfedge h, EnergyFun efun, Dictionary <int, int> flipCounter, int time)
    {
        if (h.IsBoundary())
        {
            return;
        }
        // only consider one of the halfedges
        if (h.id < h.opp.id)
        {
            h = h.opp;
        }
        // if half edge already tested for queue in the current frame then skip
        HalfEdgeCounter c = null;

        if (!counter.TryGetValue(h.id, out c))
        {
            c             = new HalfEdgeCounter();
            counter[h.id] = c;
        }
        if (c.touched == time)
        {
            return;
        }
        c.isRemovedFromQueue = false;

        if (!PrecondFlipEdge(h))
        {
            return;
        }

        double energy = efun.DeltaEnergy(h);

        c.touched = time;

        const int avgValence = 6;
        int       count      = 0;

        if (!flipCounter.TryGetValue(h.vert.id, out count))
        {
            flipCounter[h.vert.id] = 0;
        }
        if ((energy < 0) && (count < avgValence))
        {
            Q.Enqueue(new PQElement(energy, h, time), (float)energy);
        }
    }
示例#3
0
    static bool IsLocalDelaunay(Halfedge e)
    {
        if (e.IsBoundary())
        {
            return(true);
        }
        var p1 = e.vert.positionD;
        var p2 = e.next.vert.positionD;
        var p3 = e.next.next.vert.positionD;
        var p4 = e.opp.next.vert.positionD;

        if (projectPlane == ProjectionPlane.XZ)
        {
            return(HMeshMath.InCircleXZ(p1, p2, p3, p4) || HMeshMath.InCircleXZ(p3, p1, p4, p2));
        }
        else
        {
            Debug.LogError("Not implemented");
            return(false);
        }
    }
    static bool IsLocalDelaunay(Halfedge e)
    {
        if (e.IsBoundary()){
            return true;
        }
        Vector3 p1 = e.vert.position;
        Vector3 p2 = e.next.vert.position;
        Vector3 p3 = e.next.next.vert.position;
        Vector3 p4 = e.opp.next.vert.position;

        return HMeshMath.InCircle(p1,p2,p3,p4) || HMeshMath.InCircle(p2,p1,p4,p2);
    }