~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to vector/v.voronoi/sw_heap.c

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdlib.h>
 
2
#include <grass/gis.h>
2
3
#include "sw_defs.h"
3
4
 
4
5
 
15
16
            (he->ystar == next->ystar && v->coord.x > next->vertex->coord.x)))
16
17
    {
17
18
        last = next;
18
 
    };
 
19
    }
19
20
    he->PQnext = last->PQnext;
20
21
    last->PQnext = he;
21
 
    PQcount += 1;
 
22
    PQcount++;
22
23
    return 0;
23
24
}
24
25
 
31
32
        while (last->PQnext != he)
32
33
            last = last->PQnext;
33
34
        last->PQnext = he->PQnext;
34
 
        PQcount -= 1;
 
35
        PQcount--;
35
36
        deref(he->vertex);
36
37
        he->vertex = (struct Site *)NULL;
37
 
    };
 
38
    }
38
39
    return 0;
39
40
}
40
41
 
65
66
    struct Point answer;
66
67
 
67
68
    while (PQhash[PQmin].PQnext == (struct Halfedge *)NULL) {
68
 
        PQmin += 1;
69
 
    };
 
69
        PQmin++;
 
70
    }
70
71
    answer.x = PQhash[PQmin].PQnext->vertex->coord.x;
71
72
    answer.y = PQhash[PQmin].PQnext->ystar;
 
73
    answer.z = PQhash[PQmin].PQnext->vertex->coord.z;
72
74
    return (answer);
73
75
}
74
76
 
78
80
 
79
81
    curr = PQhash[PQmin].PQnext;
80
82
    PQhash[PQmin].PQnext = curr->PQnext;
81
 
    PQcount -= 1;
 
83
    PQcount--;
82
84
    return (curr);
83
85
}
84
86
 
90
92
    PQcount = 0;
91
93
    PQmin = 0;
92
94
    PQhashsize = 4 * sqrt_nsites;
93
 
    PQhash = (struct Halfedge *)myalloc(PQhashsize * sizeof *PQhash);
94
 
    for (i = 0; i < PQhashsize; i += 1)
 
95
    PQhash = (struct Halfedge *)G_malloc(PQhashsize * sizeof(struct Halfedge));
 
96
    for (i = 0; i < PQhashsize; i++)
95
97
        PQhash[i].PQnext = (struct Halfedge *)NULL;
96
98
 
97
99
    return 0;