34 #include <sys/types.h>
37 #include "quickhvolume.h"
38 #include "constants.h"
49 #warning TODO: There should be a better solution to the initUnion problem.
70 memcpy(&(dst->PS[0]), &(src->PS[0]), (src->n)*
sizeof(
point));
76 memcpy(dst, src, offsetof(
struct taskData, idx));
77 memcpy(&(dst->idx[0]), &(src->idx[0]), (src->n)*
sizeof(
int));
87 void publish(
int jid,
jobData* jd)
89 printf(
"%1.10f\n", jd->
r);
112 static void drop(
int* idx,
int* n,
int j);
116 static void drop(
int* idx,
int* n,
int j)
133 intercept(&p, &(d->o), &(jd->PS[d->idx[0]]));
134 d->r += HV(&(d->z), &p);
137 intercept(&p, &(d->o), &(jd->PS[d->idx[0]]));
138 d->r += HV(&(d->z), &p);
139 intercept(&pp, &(d->o), &(jd->PS[d->idx[1]]));
140 d->r += HV(&(d->z), &pp);
141 intercept(&p, &p, &pp);
142 d->r -= HV(&(d->z), &p);
145 d->r +=
InExClusion(&(d->z), &(d->o), d->n, d->idx, jd->PS, &(b->iex));
151 quickHVolumeR(b, d, jd);
174 intercept(&pp, &(d->o), &(jd->PS[d->idx[i]]));
185 intercept(&p, &(d->o), &(jd->PS[d->idx[j]]));
186 d->r += HV(&(d->z), &p);
187 drop(d->idx, &(d->n), j);
193 intercept(&pp, &(d->o), &(jd->PS[d->idx[i]]));
194 push(d->idx[i], classify(&p, &pp), &(b->spt));
197 di =
newDivision(&(jd->PS[0]), &(d->o), &p, &(b->spt));
206 nidx =
next(di, &j, &(d->n));
207 memcpy(d->idx, nidx, (d->n)*
sizeof(
int));
208 projectZero(&(d->z), &p, j, &(ld.z));
209 projectOne(&(d->o), &p, j, &(ld.o));
#define objective(Z, A, O)
void freeDivision(division *d)
New divisions are created in the splitter object.
int * next(division d, int *hypoct, int *n)
division newDivision(point *PS, point *o, point *p, struct spData *sd)
This returns iterators for diferent type. WARNING, these objects are singleton, so new overwrites exi...
void initUnion(int n, struct unionData *ud)
This struct is public because of splitter. Do not use direct access.
double InExClusion(point *zero, point *one, int n, int *idx, point *PS, struct iex *ax)
void initSplitter(struct spData *sd)
void push(int idx, int tp, struct spData *sd)
A splitter for storing classified points. The splitter is an array that grows dinamically, when all points are inserted they are separeted into classes by sorting. Preferably count sort or hased count sort.
Structure for uniting two sets, without repetition.
Inclusion Exclusion Algorithm better than HSO for high d and small n.
Point is an array of coordinates, in a struct for simple and fast copy.
void destroySplitter(struct spData *sd)