return;
}
-
-
static void triangle_center(real x[], real y[], real z[], real c[]){
/* find the "center" c, which is the intersection of the 3 vectors that are normal to each
of the edges respectively, and which passes through the center of the edges respectively
if (r && g && b){
printf("RGBColor[%f,%f,%f],",r[polys_groups[i]], g[polys_groups[i]], b[polys_groups[i]]);
} else {
- printf("Hue[%f],",((polys_groups[i]-min_grp)/(real) (max_grp-min_grp)));
+ printf("Hue[%f],",(polys_groups[i]-min_grp)/(real) max_grp-min_grp);
}
printf("Polygon[{");
}
A = SparseMatrix_new(n, n, 1, MATRIX_TYPE_INTEGER, FORMAT_COORD);
for (i = 0; i < ntri; i++) {
for (j = 0; j < 3; j++) {
- ((*T)[i]).vertices[j] = trilist[i * 3 + j];
+ (*T)[i].vertices[j] = trilist[i * 3 + j];
}
i0 = (*T)[i].vertices[0]; i1 = (*T)[i].vertices[1]; i2 = (*T)[i].vertices[2];
}
printf("}]");
- /*
- printf(",");
- for (i = 0; i < n; i++){
- printf("Text[%d,{",i);
- for (j = 0; j < 2; j++) {
- printf("%f",x[i*dim+j]);
- if (j == 0) printf(",");
- }
- printf("}]");
- if (i < n - 1) printf(",");
- }
- */
printf("}]");
}
for (i = 0; i < nt; i++) mask[i] = -1;
/* loop over every point in each connected component */
- elist = MALLOC(sizeof(int)*(nt)*edim);
+ elist = MALLOC(sizeof(int)*nt*edim);
tlist = MALLOC(sizeof(int)*nt*2);
*poly_lines = SparseMatrix_new(ncomps, nt, 1, MATRIX_TYPE_INTEGER, FORMAT_COORD);
- *polys_groups = MALLOC(sizeof(int)*(ncomps));
+ *polys_groups = MALLOC(sizeof(int)*ncomps);
for (i = 0; i < nt; i++) elist[i*edim + 2] = 0;
nz = ie[E->m] - ie[0];
cur = next;
}
fprintf(stderr, "%d--%d\n",edge_head(cur),edge_tail(cur));
-
-
-
-
-
-
}
static int same_edge(int ecur, int elast, int *edge_table){
- return ((edge_head(ecur) == edge_head(elast) && edge_tail(ecur) == edge_tail(elast))
- || (edge_head(ecur) == edge_tail(elast) && edge_tail(ecur) == edge_head(elast)));
+ return (edge_head(ecur) == edge_head(elast) && edge_tail(ecur) == edge_tail(elast))
+ || (edge_head(ecur) == edge_tail(elast) && edge_tail(ecur) == edge_head(elast));
}
static void get_polygon_solids(int nt, SparseMatrix E, int ncomps, int *comps_ptr, int *comps,
ie = half_edges->ia;
je = half_edges->ja;
e = (int*) half_edges->a;
- elist = MALLOC(sizeof(int)*(nt)*3);
+ elist = MALLOC(sizeof(int)*nt*3);
for (i = 0; i < nt; i++) elist[i*edim + 2] = 0;
*polys = SparseMatrix_new(ncomps, nt, 1, MATRIX_TYPE_INTEGER, FORMAT_COORD);
/* unset edge_map */
}
-
-
B = SparseMatrix_from_coordinate_format_not_compacted(*polys, SUM_REPEATED_NONE);
SparseMatrix_delete(*polys);
*polys = B;
/* connected components are such that the random points and the bounding box 4 points forms the last
remaining components */
for (i = ncomps - 1; i >= 0; i--) {
- if ((groups[comps[comps_ptr[i]]] != GRP_RANDOM) &&
- (groups[comps[comps_ptr[i]]] != GRP_BBOX)) break;
+ if (groups[comps[comps_ptr[i]]] != GRP_RANDOM &&
+ groups[comps[comps_ptr[i]]] != GRP_BBOX) break;
}
ncomps = i + 1;
if (Verbose) fprintf(stderr,"ncomps = %d\n",ncomps);
*x_poly = MALLOC(sizeof(real)*dim*nt);
for (i = 0; i < nt; i++){
for (j = 0; j < dim; j++){
- (*x_poly)[i*dim+j] = (Tp[i]).center[j];
+ (*x_poly)[i*dim+j] = Tp[i].center[j];
}
}
-
/*============================================================
polygon outlines
FREE(groups);
FREE(mask);
-
}
static int make_map_internal(int exclude_random, int include_OK_points,
xmin[j] = MIN(xmin[j], x[i*dim+j]);
}
}
- boxsize[0] = (xmax[0] - xmin[0]);
- boxsize[1] = (xmax[1] - xmin[1]);
+ boxsize[0] = xmax[0] - xmin[0];
+ boxsize[1] = xmax[1] - xmin[1];
area = boxsize[0]*boxsize[1];
if (*nrandom == 0) {
grouping[i] = 2;
}
memcpy(*xcombined, xtemp, n*dim*sizeof(real));
- *nrandom = *nrandom + n - nh;/* count everything except cluster HIGHLIGHT_SET as random */
+ *nrandom += n - nh;/* count everything except cluster HIGHLIGHT_SET as random */
n = nh;
if (Verbose) fprintf(stderr,"nh = %d\n",nh);
FREE(xtemp);
get_tri(n + *nrandom, dim2, *xcombined, &nt, &Tp, &E, flag);
get_polygons(exclude_random, n, *nrandom, dim2, graph, grouping, nt, Tp, E, nverts, x_poly, npolys, poly_lines, polys, polys_groups,
poly_point_map, country_graph, flag);
- /*
- {
- plot_voronoi(n + *nrandom, E, Tp);
- printf("(*voronoi*),");
-
- }
-*/
-
-
-
SparseMatrix_delete(E);
FREE(Tp);
return 0;
}
-
int make_map_from_point_groups(int exclude_random, int include_OK_points,
int n, int dim, real *x, int *grouping, SparseMatrix graph, real bounding_box_margin[], int *nrandom,
real shore_depth_tol, real edge_bridge_tol, real **xcombined, int *nverts, real **x_poly,
plot_points(n + *nrandom, dim, *xcombined);
-
printf(",");
plot_polys(TRUE, *poly_lines, *x_poly, *polys_groups, NULL, NULL, NULL);
(*x)[(*n)*2+1] = point[1];
(*groups)[*n] = igrp;
(*n)++;
-
}
static void get_boundingbox(int n, int dim, real *x, real *width, real *bbox){
}
}
-
int make_map_from_rectangle_groups(int exclude_random, int include_OK_points,
int n, int dim, real *x, real *sizes,
int *grouping, SparseMatrix graph0, real bounding_box_margin[], int *nrandom, int *nart, int nedgep,
}
return res;
-
}