22static void printVis(
char *lbl,
COORD * vis,
int n);
23static void printDad(
int *vis,
int n);
39 for (poly_i = 0; poly_i < n_obs; poly_i++) {
48 rv->
start = calloc((
size_t)n_obs + 1,
sizeof(
int));
49 rv->
next = calloc(n,
sizeof(
int));
50 rv->
prev = calloc(n,
sizeof(
int));
68 for (poly_i = 0; poly_i < n_obs; poly_i++) {
70 rv->
start[poly_i] = start;
71 assert(obs[poly_i]->pn <= INT_MAX);
72 end = start + (int)obs[poly_i]->pn - 1;
73 for (pt_i = 0; pt_i < (int)obs[poly_i]->pn; pt_i++) {
74 rv->
P[i] = obs[poly_i]->
ps[pt_i];
79 rv->
next[end] = start;
80 rv->
prev[start] = end;
82 rv->
start[poly_i] = i;
105 COORD *ptvis0, *ptvis1;
107 ptvis0 =
ptVis(config, poly0, p0);
108 ptvis1 =
ptVis(config, poly1, p1);
110 dad =
makePath(p0, poly0, ptvis0, p1, poly1, ptvis1, config);
113 for (i = dad[config->
N]; i != config->
N + 1; i = dad[i])
120 for (i = dad[config->
N]; i != config->
N + 1; i = dad[i])
121 ops[j--] = config->
P[i];
126 printVconfig(config);
127 printVis(
"p", ptvis0, config->
N + 1);
128 printVis(
"q", ptvis1, config->
N + 1);
129 printDad(dad, config->
N + 1);
135 output_route->
pn =
opn;
136 output_route->
ps =
ops;
153 printf(
"this next prev point\n");
154 for (i = 0; i < cp->
N; i++)
155 printf(
"%3d %3d %3d (%3g,%3g)\n", i, next[i],
prev[i],
160 for (i = 0; i < cp->
N; i++) {
161 for (j = 0; j < cp->
N; j++)
162 printf(
"%4.1f ", arr[i][j]);
167static void printVis(
char *lbl,
COORD * vis,
int n)
172 for (i = 0; i < n; i++)
173 printf(
"%4.1f ", vis[i]);
177static void printDad(
int *vis,
int n)
182 for (i = 0; i < n; i++) {
187 for (i = 0; i < n; i++) {
188 printf(
"%3d ", vis[i]);
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
vconfig_t * Pobsopen(Ppoly_t **obs, int n_obs)
void Pobsclose(vconfig_t *config)
void Pobspath(vconfig_t *config, Ppoint_t p0, int poly0, Ppoint_t p1, int poly1, Ppolyline_t *output_route)
void makePath(unsigned n, edgefn ef)
VIS_API void visibility(vconfig_t *)
VIS_API COORD * ptVis(vconfig_t *, int, Ppoint_t)