version 1.1.1.1, 2000/01/09 17:00:50 |
version 1.1.1.3, 2003/09/15 07:09:24 |
Line 289 static void end_crnt_cntr() |
|
Line 289 static void end_crnt_cntr() |
|
{ |
{ |
int i; |
int i; |
struct gnuplot_contours *cntr = (struct gnuplot_contours *) |
struct gnuplot_contours *cntr = (struct gnuplot_contours *) |
gp_alloc((unsigned long) sizeof(struct gnuplot_contours), "gnuplot_contour"); |
gp_alloc(sizeof(struct gnuplot_contours), "gnuplot_contour"); |
cntr->coords = (struct coordinate GPHUGE *) |
cntr->coords = (struct coordinate GPHUGE *) |
gp_alloc((unsigned long) sizeof(struct coordinate) |
gp_alloc(sizeof(struct coordinate) * crnt_cntr_pt_index, |
* (unsigned long) crnt_cntr_pt_index, "contour coords"); |
"contour coords"); |
|
|
for (i = 0; i < crnt_cntr_pt_index; i++) { |
for (i = 0; i < crnt_cntr_pt_index; i++) { |
cntr->coords[i].x = crnt_cntr[i * 2]; |
cntr->coords[i].x = crnt_cntr[i * 2]; |
|
|
t = (t > 1.0 ? 1.0 : t); |
t = (t > 1.0 ? 1.0 : t); |
|
|
p_cntr = (struct cntr_struct *) |
p_cntr = (struct cntr_struct *) |
gp_alloc((unsigned long) sizeof(struct cntr_struct), "contour cntr_struct"); |
gp_alloc(sizeof(struct cntr_struct), "contour cntr_struct"); |
|
|
p_cntr->X = p_edge->vertex[1]->x * t + |
p_cntr->X = p_edge->vertex[1]->x * t + |
p_edge->vertex[0]->x * (1 - t); |
p_edge->vertex[0]->x * (1 - t); |
Line 536 struct poly_struct **p_polys; /* list of polygons outp |
|
Line 536 struct poly_struct **p_polys; /* list of polygons outp |
|
struct edge_struct **p_edges; /* list of edges output */ |
struct edge_struct **p_edges; /* list of edges output */ |
{ |
{ |
int i, j, grid_x_max = iso_lines->p_count; |
int i, j, grid_x_max = iso_lines->p_count; |
struct edge_struct *p_edge1, *p_edge2, *edge0, *edge1, *edge2, *pe_tail, |
struct edge_struct *p_edge1, *p_edge2, *edge0, *edge1, *edge2, |
*pe_tail1, *pe_tail2, *pe_temp; |
*pe_tail, *pe_tail2, *pe_temp; |
struct poly_struct *pp_tail, *lower_tri, *upper_tri; |
struct poly_struct *pp_tail, *lower_tri, *upper_tri; |
struct coordinate GPHUGE *p_vrtx1, GPHUGE * p_vrtx2; /* HBB 980308: need to tag *each* of them as GPHUGE! */ |
struct coordinate GPHUGE *p_vrtx1, GPHUGE * p_vrtx2; /* HBB 980308: need to tag *each* of them as GPHUGE! */ |
|
|
Line 545 struct edge_struct **p_edges; /* list of edges output |
|
Line 545 struct edge_struct **p_edges; /* list of edges output |
|
(*p_edges) = pe_tail = NULL; |
(*p_edges) = pe_tail = NULL; |
|
|
p_vrtx1 = iso_lines->points; /* first row of vertices */ |
p_vrtx1 = iso_lines->points; /* first row of vertices */ |
p_edge1 = pe_tail1 = NULL; /* clear list of edges */ |
p_edge1 = pe_tail = NULL; /* clear list of edges */ |
|
|
/* Generate edges of first row */ |
/* Generate edges of first row */ |
|
/* HBB 19991130: removed effectively unused variable 'pe_tail1' */ |
for (j = 0; j < grid_x_max - 1; j++) |
for (j = 0; j < grid_x_max - 1; j++) |
add_edge(p_vrtx1 + j, p_vrtx1 + j + 1, &p_edge1, &pe_tail1); |
add_edge(p_vrtx1 + j, p_vrtx1 + j + 1, &p_edge1, &pe_tail); |
|
|
(*p_edges) = p_edge1; /* update main list */ |
(*p_edges) = p_edge1; /* update main list */ |
pe_tail = pe_tail1; |
|
|
|
|
|
/* |
/* |
Line 562 struct edge_struct **p_edges; /* list of edges output |
|
Line 562 struct edge_struct **p_edges; /* list of edges output |
|
* (pe_tail points on last edge). |
* (pe_tail points on last edge). |
* |
* |
* Temporary pointers: |
* Temporary pointers: |
* 1. p_edge2: Top horizontal edge list: ----------------------- 2 |
* 1. p_edge2: Top horizontal edge list: +-----------------------+ 2 |
* 2. pe_tail: middle edge list: |\ |\ |\ |\ |\ |\ | |
* 2. p_tail : end of middle edge list: |\ |\ |\ |\ |\ |\ | |
* | \| \| \| \| \| \| |
* | \| \| \| \| \| \| |
* 3. p_edge1: Bottom horizontal edge list: ----------------------- 1 |
* 3. p_edge1: Bottom horizontal edge list: +-----------------------+ 1 |
* |
* |
|
* pe_tail2 : end of list beginning at p_edge2 |
|
* pe_temp : position inside list beginning at p_edge1 |
|
* p_edges : head of the master edge list (part of our output) |
|
* p_vrtx1 : start of lower row of input vertices |
|
* p_vrtx2 : start of higher row of input vertices |
|
* |
* The routine generates two triangle Lower Upper 1 |
* The routine generates two triangle Lower Upper 1 |
* upper one and lower one: | \ ---- |
* upper one and lower one: | \ ---- |
* (Nums. are edges order in polys) 0| \1 0\ |2 |
* (Nums. are edges order in polys) 0| \1 0\ |2 |
Line 633 struct edge_struct **p_edges; /* list of edges output |
|
Line 639 struct edge_struct **p_edges; /* list of edges output |
|
upper_tri = add_poly(edge0, edge1, edge2, p_polys, &pp_tail); |
upper_tri = add_poly(edge0, edge1, edge2, p_polys, &pp_tail); |
} |
} |
|
|
if ((*p_edges)) { /* Chain new edges to main list. */ |
if (p_edge2) { |
pe_tail->next = p_edge2; |
/* HBB 19991130 bugfix: if p_edge2 list is empty, |
pe_tail = pe_tail2; |
* don't change p_edges list! Crashes by access |
} else { |
* to NULL pointer pe_tail, the second time through, |
(*p_edges) = p_edge2; |
* otherwise */ |
pe_tail = pe_tail2; |
if ((*p_edges)) { /* Chain new edges to main list. */ |
|
pe_tail->next = p_edge2; |
|
pe_tail = pe_tail2; |
|
} else { |
|
(*p_edges) = p_edge2; |
|
pe_tail = pe_tail2; |
|
} |
} |
} |
|
|
|
/* this row finished, move list heads up one row: */ |
p_edge1 = p_edge2; |
p_edge1 = p_edge2; |
p_vrtx1 = p_vrtx2; |
p_vrtx1 = p_vrtx2; |
} |
} |
Line 714 struct edge_struct **p_edge, **pe_tail; /* pointers t |
|
Line 727 struct edge_struct **p_edge, **pe_tail; /* pointers t |
|
{ |
{ |
struct edge_struct *pe_temp = NULL; |
struct edge_struct *pe_temp = NULL; |
|
|
|
#if 1 |
|
if (point0->type == INRANGE && point1->type == INRANGE) { |
|
#else |
if (point0->type != UNDEFINED && point1->type != UNDEFINED) { |
if (point0->type != UNDEFINED && point1->type != UNDEFINED) { |
|
#endif |
|
|
pe_temp = (struct edge_struct *) |
pe_temp = (struct edge_struct *) |
gp_alloc((unsigned long) sizeof(struct edge_struct), "contour edge"); |
gp_alloc(sizeof(struct edge_struct), "contour edge"); |
|
|
pe_temp->poly[0] = NULL; /* clear links */ |
pe_temp->poly[0] = NULL; /* clear links */ |
pe_temp->poly[1] = NULL; |
pe_temp->poly[1] = NULL; |
Line 752 struct poly_struct **p_poly, **pp_tail; /* pointers to |
|
Line 769 struct poly_struct **p_poly, **pp_tail; /* pointers to |
|
if (edge0 && edge1 && edge2) { |
if (edge0 && edge1 && edge2) { |
|
|
pp_temp = (struct poly_struct *) |
pp_temp = (struct poly_struct *) |
gp_alloc((unsigned long) sizeof(struct poly_struct), "contour polygon"); |
gp_alloc(sizeof(struct poly_struct), "contour polygon"); |
|
|
pp_temp->edge[0] = edge0; /* First edge of triangle */ |
pp_temp->edge[0] = edge0; /* First edge of triangle */ |
pp_temp->edge[1] = edge1; /* Second one */ |
pp_temp->edge[1] = edge1; /* Second one */ |
|
|
} |
} |
} |
} |
delta_t = (double *) |
delta_t = (double *) |
gp_alloc((unsigned long) (sizeof(double) * num_pts), "contour delta_t"); |
gp_alloc((sizeof(double) * num_pts), "contour delta_t"); |
d2x = (double *) |
d2x = (double *) |
gp_alloc((unsigned long) (sizeof(double) * num_pts), "contour d2x"); |
gp_alloc((sizeof(double) * num_pts), "contour d2x"); |
d2y = (double *) |
d2y = (double *) |
gp_alloc((unsigned long) (sizeof(double) * num_pts), "contour d2y"); |
gp_alloc((sizeof(double) * num_pts), "contour d2y"); |
|
|
/* Width and hight of the grid is used at unit length (2d-norm) */ |
/* Width and hight of the grid is used at unit length (2d-norm) */ |
unit_x = xx_max - x_min; |
unit_x = xx_max - x_min; |
Line 1025 double unit_x, unit_y; /* Unit length in x and y (norm |
|
Line 1042 double unit_x, unit_y; /* Unit length in x and y (norm |
|
struct cntr_struct *pc_temp; |
struct cntr_struct *pc_temp; |
|
|
m = (tri_diag *) |
m = (tri_diag *) |
gp_alloc((unsigned long) (sizeof(tri_diag) * num_pts), "contour tridiag m"); |
gp_alloc((sizeof(tri_diag) * num_pts), "contour tridiag m"); |
|
|
/* |
/* |
* Calculate first differences in (d2x[i], d2y[i]) and interval lengths |
* Calculate first differences in (d2x[i], d2y[i]) and interval lengths |
|
|
double ti, tikp, *dx, *dy; /* Copy p_cntr into it to make it faster. */ |
double ti, tikp, *dx, *dy; /* Copy p_cntr into it to make it faster. */ |
|
|
dx = (double *) |
dx = (double *) |
gp_alloc((unsigned long) (sizeof(double) * (order + j)), "contour b_spline"); |
gp_alloc((sizeof(double) * (order + j)), "contour b_spline"); |
dy = (double *) |
dy = (double *) |
gp_alloc((unsigned long) (sizeof(double) * (order + j)), "contour b_spline"); |
gp_alloc((sizeof(double) * (order + j)), "contour b_spline"); |
|
|
/* Set the dx/dy - [0] iteration step, control points (p==0 iterat.): */ |
/* Set the dx/dy - [0] iteration step, control points (p==0 iterat.): */ |
for (i = j - order; i <= j; i++) { |
for (i = j - order; i <= j; i++) { |