8 #ifndef _ISOSURFACEGPMUTIL_H_
9 #define _ISOSURFACEGPMUTIL_H_
17 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2)
18 #pragma GCC diagnostic warning "-Wuninitialized"
87 scalar = vector1.
x * vector2.
x + vector1.
y * vector2.
y + vector1.
z * vector2.
z;
96 normal.
x = (vector1.
y * vector2.
z) - (vector2.
y * vector1.
z);
97 normal.
y = (vector2.
x * vector1.
z) - (vector1.
x * vector2.
z);
98 normal.
z = (vector1.
x * vector2.
y) - (vector2.
x * vector1.
y);
105 return sqrt(vector.
x * vector.
x + vector.
y * vector.
y + vector.
z * vector.
z);
108 ISOSURFACE_EDGE_INTERSECTION VertexInterpolate(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2,
float isovalue,
float data1,
float data2,
int v1,
int v2)
116 if (isovalue == data1)
154 if (isovalue == data2)
201 edge.
intersection.
x = x1 + (x2 -
x1) * ((isovalue - data1) / (data2 - data1));
202 edge.
intersection.
y = y1 + (y2 -
y1) * ((isovalue - data1) / (data2 - data1));
203 edge.
intersection.
z = z1 + (z2 - z1) * ((isovalue - data1) / (data2 - data1));
226 for (std::vector<ISOSURFACE_EDGE_INTERSECTION>::iterator existent_intsec = intsec_vector.begin(); existent_intsec < intsec_vector.end(); ++existent_intsec)
233 if (existent_intsec->vertex1 == intsec.
vertex1 && existent_intsec->vertex2 == intsec.
vertex2)
239 if (existent_intsec->vertex1 == intsec.
vertex2 && existent_intsec->vertex2 == intsec.
vertex1)
249 if (existent_intsec->vertex1 == intsec.
vertex1 || existent_intsec->vertex2 == intsec.
vertex2 || existent_intsec->vertex1 == intsec.
vertex2 || existent_intsec->vertex2 == intsec.
vertex1)
254 if (intsec.
vertex1 == existent_intsec->vertex1 || intsec.
vertex2 == existent_intsec->vertex2)
256 vtx1 = existent_intsec->vertex1;
257 vtx2 = existent_intsec->vertex2;
260 if (intsec.
vertex1 == existent_intsec->vertex2 || intsec.
vertex2 == existent_intsec->vertex1)
262 vtx1 = existent_intsec->vertex2;
263 vtx2 = existent_intsec->vertex1;
268 d1.
x = x_coord_in[vtx1] - x_coord_in[vtx2];
269 d1.
y = y_coord_in[vtx1] - y_coord_in[vtx2];
270 d1.
z = z_coord_in[vtx1] - z_coord_in[vtx2];
280 if ((length1 > 0) && (length2 > 0))
282 double cosangle =
dot_product(d1, d2) / (length1 * length2);
292 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
294 improper_topology =
true;
304 float map_to_isosurface(
float coord_x1,
float coord_x2,
float coord_y1,
float coord_y2,
float coord_z1,
float coord_z2,
float coord_isox,
float coord_isoy,
float coord_isoz,
float data_1,
float data_2,
bool int_vertex1,
bool int_vertex2)
310 if (int_vertex1 ==
true)
312 mapped_value = data_1;
315 else if (int_vertex2 ==
true)
317 mapped_value = data_2;
322 dist_x1x2 = sqrt(pow(coord_x1 - coord_x2, 2) + pow(coord_y1 - coord_y2, 2) + pow(coord_z1 - coord_z2, 2));
327 mapped_value = data_1;
332 dist_x1xiso = sqrt(pow(coord_x1 - coord_isox, 2) + pow(coord_y1 - coord_isoy, 2) + pow(coord_z1 - coord_isoz, 2));
333 mapped_value = data_1 + ((data_2 - data_1) / dist_x1x2) * dist_x1xiso;
340 ISOSURFACE_EDGE_INTERSECTION_VECTOR calculate_intersections(
int num_elem_in,
int *elem_in,
int num_conn_in,
int *conn_in,
float *x_coord_in,
float *y_coord_in,
float *z_coord_in,
float *isodata_in,
float isovalue,
float *sdata_in,
float *udata_in,
float *vdata_in,
float *wdata_in,
bool isomap,
bool &improper_topology)
352 intsec_vector.reserve(15);
354 for (i = 0; i < num_elem_in; i++)
356 if (i < num_elem_in - 1)
358 for (j = elem_in[i]; j <= elem_in[i + 1] - 1; j++)
360 if (j < elem_in[i + 1] - 1)
362 if (((isodata_in[conn_in[j]] <= isovalue) && (isovalue < isodata_in[conn_in[j + 1]])) || (isodata_in[conn_in[j]] > isovalue && isovalue >= isodata_in[conn_in[j + 1]]) || ((isodata_in[conn_in[j]] < isovalue) && (isovalue <= isodata_in[conn_in[j + 1]])) || (isodata_in[conn_in[j]] >= isovalue && isovalue > isodata_in[conn_in[j + 1]]))
364 data_vertex1 = isodata_in[conn_in[j]];
365 data_vertex2 = isodata_in[conn_in[j + 1]];
367 intersec =
VertexInterpolate(x_coord_in[conn_in[j]], y_coord_in[conn_in[j]], z_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j + 1]], isovalue, data_vertex1, data_vertex2, conn_in[j], conn_in[j + 1]);
372 if (!
test_intersection(intsec_vector, intersec, x_coord_in, y_coord_in, z_coord_in, improper_topology))
374 if (sdata_in !=
NULL)
381 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, sdata_in[conn_in[j]], sdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
385 else if (udata_in !=
NULL)
388 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, udata_in[conn_in[j]], udata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
389 intersec.
data_vertex_int.
v[1] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, vdata_in[conn_in[j]], vdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
390 intersec.
data_vertex_int.
v[2] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, wdata_in[conn_in[j]], wdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
393 intsec_vector.push_back(intersec);
399 else if (j == elem_in[i + 1] - 1)
401 if ((isodata_in[conn_in[j]] <= isovalue && isovalue < isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] > isovalue && isovalue >= isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] < isovalue && isovalue <= isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] >= isovalue && isovalue > isodata_in[conn_in[elem_in[i]]]))
403 data_vertex1 = isodata_in[conn_in[j]];
404 data_vertex2 = isodata_in[conn_in[elem_in[i]]];
406 intersec =
VertexInterpolate(x_coord_in[conn_in[j]], y_coord_in[conn_in[j]], z_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[elem_in[i]]], isovalue, data_vertex1, data_vertex2, conn_in[j], conn_in[elem_in[i]]);
411 if (!
test_intersection(intsec_vector, intersec, x_coord_in, y_coord_in, z_coord_in, improper_topology))
413 if (sdata_in !=
NULL)
420 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, sdata_in[conn_in[j]], sdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
424 else if (udata_in !=
NULL)
427 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, udata_in[conn_in[j]], udata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
428 intersec.
data_vertex_int.
v[1] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, vdata_in[conn_in[j]], vdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
429 intersec.
data_vertex_int.
v[2] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, wdata_in[conn_in[j]], wdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
432 intsec_vector.push_back(intersec);
442 for (j = elem_in[i]; j <= (num_conn_in - 1); j++)
444 if (j < (num_conn_in - 1))
446 if ((isodata_in[conn_in[j]] <= isovalue && isovalue < isodata_in[conn_in[j + 1]]) || (isodata_in[conn_in[j]] > isovalue && isovalue >= isodata_in[conn_in[j + 1]]) || (isodata_in[conn_in[j]] < isovalue && isovalue <= isodata_in[conn_in[j + 1]]) || (isodata_in[conn_in[j]] >= isovalue && isovalue > isodata_in[conn_in[j + 1]]))
448 data_vertex1 = isodata_in[conn_in[j]];
449 data_vertex2 = isodata_in[conn_in[j + 1]];
451 intersec =
VertexInterpolate(x_coord_in[conn_in[j]], y_coord_in[conn_in[j]], z_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j + 1]], isovalue, data_vertex1, data_vertex2, conn_in[j], conn_in[j + 1]);
456 if (!
test_intersection(intsec_vector, intersec, x_coord_in, y_coord_in, z_coord_in, improper_topology))
458 if (sdata_in !=
NULL)
465 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, sdata_in[conn_in[j]], sdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
469 else if (udata_in !=
NULL)
472 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, udata_in[conn_in[j]], udata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
473 intersec.
data_vertex_int.
v[1] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, vdata_in[conn_in[j]], vdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
474 intersec.
data_vertex_int.
v[2] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[j + 1]], y_coord_in[conn_in[j]], y_coord_in[conn_in[j + 1]], z_coord_in[conn_in[j]], z_coord_in[conn_in[j + 1]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, wdata_in[conn_in[j]], wdata_in[conn_in[j + 1]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
477 intsec_vector.push_back(intersec);
483 else if (j == (num_conn_in - 1))
485 if ((isodata_in[conn_in[j]] <= isovalue && isovalue < isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] > isovalue && isovalue >= isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] < isovalue && isovalue <= isodata_in[conn_in[elem_in[i]]]) || (isodata_in[conn_in[j]] >= isovalue && isovalue > isodata_in[conn_in[elem_in[i]]]))
487 data_vertex1 = isodata_in[conn_in[j]];
488 data_vertex2 = isodata_in[conn_in[elem_in[i]]];
490 intersec =
VertexInterpolate(x_coord_in[conn_in[j]], y_coord_in[conn_in[j]], z_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[elem_in[i]]], isovalue, data_vertex1, data_vertex2, conn_in[j], conn_in[elem_in[i]]);
495 if (!
test_intersection(intsec_vector, intersec, x_coord_in, y_coord_in, z_coord_in, improper_topology))
497 if (sdata_in !=
NULL)
504 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, sdata_in[conn_in[j]], sdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
508 else if (udata_in !=
NULL)
511 intersec.
data_vertex_int.
v[0] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, udata_in[conn_in[j]], udata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
512 intersec.
data_vertex_int.
v[1] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, vdata_in[conn_in[j]], vdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
513 intersec.
data_vertex_int.
v[2] =
map_to_isosurface(x_coord_in[conn_in[j]], x_coord_in[conn_in[elem_in[i]]], y_coord_in[conn_in[j]], y_coord_in[conn_in[elem_in[i]]], z_coord_in[conn_in[j]], z_coord_in[conn_in[elem_in[i]]], intersec.
intersection.
x, intersec.
intersection.
y, intersec.
intersection.
z, wdata_in[conn_in[j]], wdata_in[conn_in[elem_in[i]]], intersec.
intersection_at_vertex1, intersec.
intersection_at_vertex2);
516 intsec_vector.push_back(intersec);
525 return intsec_vector;
535 for (i = 0; i < intsec_vector.size(); i++)
537 if ((edge_vertex1 == intsec_vector[i].vertex1) && (edge_vertex2 == intsec_vector[i].vertex2))
543 if ((edge_vertex2 == intsec_vector[i].vertex1) && (edge_vertex1 == intsec_vector[i].vertex2))
560 for (i = 0; i < intsec_vector.size(); i++)
567 if ((edge_vertex1 == intsec_vector[i].vertex1) && (edge_vertex2 == intsec_vector[i].vertex2))
575 else if ((edge_vertex2 == intsec_vector[i].vertex1) && (edge_vertex1 == intsec_vector[i].vertex2))
587 else if (improper_topology)
589 if (edge_vertex1 == intsec_vector[i].vertex1 || edge_vertex2 == intsec_vector[i].vertex2 || edge_vertex2 == intsec_vector[i].vertex1 || edge_vertex1 == intsec_vector[i].vertex2)
594 if (edge_vertex1 == intsec_vector[i].vertex1 || edge_vertex2 == intsec_vector[i].vertex2)
596 vtx1 = intsec_vector[i].vertex1;
597 vtx2 = intsec_vector[i].vertex2;
600 if (edge_vertex1 == intsec_vector[i].vertex2 || edge_vertex2 == intsec_vector[i].vertex1)
602 vtx1 = intsec_vector[i].vertex2;
603 vtx2 = intsec_vector[i].vertex1;
608 d1.
x = x_coord_in[vtx1] - x_coord_in[vtx2];
609 d1.
y = y_coord_in[vtx1] - y_coord_in[vtx2];
610 d1.
z = z_coord_in[vtx1] - z_coord_in[vtx2];
613 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
614 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
615 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
620 if ((length1 > 0) && (length2 > 0))
622 double cosangle =
dot_product(d1, d2) / (length1 * length2);
626 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
628 if (edge_vertex1 == intsec_vector[i].vertex1)
629 edge_vertex2 = intsec_vector[i].vertex2;
630 else if (edge_vertex2 == intsec_vector[i].vertex2)
631 edge_vertex1 = intsec_vector[i].vertex1;
632 else if (edge_vertex1 == intsec_vector[i].vertex2)
633 edge_vertex2 = intsec_vector[i].vertex1;
634 else if (edge_vertex2 == intsec_vector[i].vertex1)
635 edge_vertex1 = intsec_vector[i].vertex2;
649 void find_current_face(
CONTOUR &contour,
ISOSURFACE_EDGE_INTERSECTION_VECTOR intsec_vector,
int &edge_vertex1,
int &edge_vertex2,
float &data_vertex1,
float &data_vertex2,
float *isodata_in,
int *elem_in,
int *conn_in,
int *index_list,
int *polygon_list,
int num_coord_in,
int num_conn_in,
int num_elem_in,
int &ring_counter,
int ¤t_face,
float *x_coord_in,
float *y_coord_in,
float *z_coord_in,
bool improper_topology,
bool &abort_tracing_isocontour)
651 bool adjacent_vertices;
658 int copy_current_face;
669 copy_current_face = current_face;
675 if ((edge_vertex1 < num_coord_in - 1) && (edge_vertex2 < num_coord_in - 1))
677 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
679 adjacent_vertices =
false;
680 neighbour_face1 = polygon_list[i];
681 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
683 neighbour_face2 = polygon_list[j];
690 if (neighbour_face1 == neighbour_face2)
692 if (neighbour_face1 < num_elem_in - 1)
694 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
696 if (conn_in[k] == edge_vertex1)
699 if (k == elem_in[neighbour_face1])
701 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
702 next_vertex = conn_in[k + 1];
705 else if (k < elem_in[neighbour_face1 + 1] - 1)
707 previous_vertex = conn_in[k - 1];
708 next_vertex = conn_in[k + 1];
711 else if (k == elem_in[neighbour_face1 + 1] - 1)
713 previous_vertex = conn_in[k - 1];
714 next_vertex = conn_in[elem_in[neighbour_face1]];
717 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
719 adjacent_vertices =
true;
728 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
730 if (conn_in[k] == edge_vertex1)
733 if (k == elem_in[neighbour_face1])
735 previous_vertex = conn_in[num_conn_in - 1];
736 next_vertex = conn_in[k + 1];
739 else if (k < num_conn_in - 1)
741 previous_vertex = conn_in[k - 1];
742 next_vertex = conn_in[k + 1];
745 else if (k == num_conn_in - 1)
747 previous_vertex = conn_in[k - 1];
748 next_vertex = conn_in[elem_in[neighbour_face1]];
751 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
753 adjacent_vertices =
true;
764 if (adjacent_vertices ==
true)
773 current_face = neighbour_face1;
799 if (improper_topology)
809 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
811 neighbour_face1 = polygon_list[i];
812 if (neighbour_face1 != current_face)
814 if (neighbour_face1 < num_elem_in - 1)
816 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
818 if (conn_in[k] == edge_vertex1)
821 if (k == elem_in[neighbour_face1])
823 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
824 next_vertex = conn_in[k + 1];
827 else if (k < elem_in[neighbour_face1 + 1] - 1)
829 previous_vertex = conn_in[k - 1];
830 next_vertex = conn_in[k + 1];
833 else if (k == elem_in[neighbour_face1 + 1] - 1)
835 previous_vertex = conn_in[k - 1];
836 next_vertex = conn_in[elem_in[neighbour_face1]];
840 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
844 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
845 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
846 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
849 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
850 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
851 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
854 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
855 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
856 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
862 if ((length1 > 0) && (length2 > 0))
864 double cosangle =
dot_product(d1, d2) / (length1 * length2);
868 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
871 new_edge_vertex = previous_vertex;
876 if ((length1 > 0) && (length3 > 0))
878 double cosangle =
dot_product(d1, d3) / (length1 * length3);
882 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
885 new_edge_vertex = next_vertex;
896 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
898 if (conn_in[k] == edge_vertex1)
901 if (k == elem_in[neighbour_face1])
903 previous_vertex = conn_in[num_conn_in - 1];
904 next_vertex = conn_in[k + 1];
907 else if (k < num_conn_in - 1)
909 previous_vertex = conn_in[k - 1];
910 next_vertex = conn_in[k + 1];
913 else if (k == num_conn_in - 1)
915 previous_vertex = conn_in[k - 1];
916 next_vertex = conn_in[elem_in[neighbour_face1]];
920 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
924 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
925 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
926 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
929 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
930 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
931 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
934 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
935 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
936 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
942 if ((length1 > 0) && (length2 > 0))
944 double cosangle =
dot_product(d1, d2) / (length1 * length2);
948 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
951 new_edge_vertex = previous_vertex;
956 if ((length1 > 0) && (length3 > 0))
958 double cosangle =
dot_product(d1, d3) / (length1 * length3);
962 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
965 new_edge_vertex = next_vertex;
979 if (T_vertices ==
true)
988 current_face = neighbour_face1;
991 edge_vertex2 = new_edge_vertex;
992 data_vertex2 = isodata_in[edge_vertex2];
1007 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
1009 neighbour_face2 = polygon_list[j];
1010 if (neighbour_face2 != current_face)
1012 if (neighbour_face2 < num_elem_in - 1)
1014 for (k = elem_in[neighbour_face2]; k < elem_in[neighbour_face2 + 1]; k++)
1016 if (conn_in[k] == edge_vertex2)
1019 if (k == elem_in[neighbour_face2])
1021 previous_vertex = conn_in[elem_in[neighbour_face2 + 1] - 1];
1022 next_vertex = conn_in[k + 1];
1025 else if (k < elem_in[neighbour_face2 + 1] - 1)
1027 previous_vertex = conn_in[k - 1];
1028 next_vertex = conn_in[k + 1];
1031 else if (k == elem_in[neighbour_face2 + 1] - 1)
1033 previous_vertex = conn_in[k - 1];
1034 next_vertex = conn_in[elem_in[neighbour_face2]];
1038 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
1042 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
1043 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
1044 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
1047 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
1048 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
1049 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
1052 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
1053 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
1054 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
1060 if ((length1 > 0) && (length2 > 0))
1062 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1066 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1069 new_edge_vertex = previous_vertex;
1074 if ((length1 > 0) && (length3 > 0))
1076 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1080 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1083 new_edge_vertex = next_vertex;
1094 for (k = elem_in[neighbour_face2]; k < num_conn_in; k++)
1096 if (conn_in[k] == edge_vertex2)
1099 if (k == elem_in[neighbour_face2])
1101 previous_vertex = conn_in[num_conn_in - 1];
1102 next_vertex = conn_in[k + 1];
1105 else if (k < num_conn_in - 1)
1107 previous_vertex = conn_in[k - 1];
1108 next_vertex = conn_in[k + 1];
1111 else if (k == num_conn_in - 1)
1113 previous_vertex = conn_in[k - 1];
1114 next_vertex = conn_in[elem_in[neighbour_face2]];
1118 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
1122 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
1123 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
1124 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
1127 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
1128 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
1129 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
1132 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
1133 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
1134 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
1140 if ((length1 > 0) && (length2 > 0))
1142 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1146 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1149 new_edge_vertex = previous_vertex;
1154 if ((length1 > 0) && (length3 > 0))
1156 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1160 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1163 new_edge_vertex = next_vertex;
1177 if (T_vertices ==
true)
1186 current_face = neighbour_face2;
1189 edge_vertex1 = new_edge_vertex;
1190 data_vertex1 = isodata_in[edge_vertex1];
1206 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
1208 adjacent_vertices =
false;
1209 neighbour_face1 = polygon_list[i];
1210 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
1212 neighbour_face2 = polygon_list[j];
1219 if (neighbour_face1 == neighbour_face2)
1221 if (neighbour_face1 < num_elem_in - 1)
1223 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
1225 if (conn_in[k] == edge_vertex1)
1228 if (k == elem_in[neighbour_face1])
1230 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
1231 next_vertex = conn_in[k + 1];
1234 else if (k < elem_in[neighbour_face1 + 1] - 1)
1236 previous_vertex = conn_in[k - 1];
1237 next_vertex = conn_in[k + 1];
1240 else if (k == elem_in[neighbour_face1 + 1] - 1)
1242 previous_vertex = conn_in[k - 1];
1243 next_vertex = conn_in[elem_in[neighbour_face1]];
1246 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1248 adjacent_vertices =
true;
1257 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
1259 if (conn_in[k] == edge_vertex1)
1262 if (k == elem_in[neighbour_face1])
1264 previous_vertex = conn_in[num_conn_in - 1];
1265 next_vertex = conn_in[k + 1];
1268 else if (k < num_conn_in - 1)
1270 previous_vertex = conn_in[k - 1];
1271 next_vertex = conn_in[k + 1];
1274 else if (k == num_conn_in - 1)
1276 previous_vertex = conn_in[k - 1];
1277 next_vertex = conn_in[elem_in[neighbour_face1]];
1280 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1282 adjacent_vertices =
true;
1289 if (adjacent_vertices ==
true)
1291 if (neighbour_face1 != copy_current_face)
1295 current_face = neighbour_face1;
1313 if (current_face == copy_current_face)
1315 abort_tracing_isocontour =
true;
1320 else if ((edge_vertex1 < num_coord_in - 1) && (edge_vertex2 == num_coord_in - 1))
1322 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
1324 adjacent_vertices =
false;
1325 neighbour_face1 = polygon_list[i];
1326 for (j = index_list[edge_vertex2]; j < num_conn_in; j++)
1328 neighbour_face2 = polygon_list[j];
1335 if (neighbour_face1 == neighbour_face2)
1337 if (neighbour_face1 < num_elem_in - 1)
1339 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
1341 if (conn_in[k] == edge_vertex1)
1344 if (k == elem_in[neighbour_face1])
1346 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
1347 next_vertex = conn_in[k + 1];
1350 else if (k < elem_in[neighbour_face1 + 1] - 1)
1352 previous_vertex = conn_in[k - 1];
1353 next_vertex = conn_in[k + 1];
1356 else if (k == elem_in[neighbour_face1 + 1] - 1)
1358 previous_vertex = conn_in[k - 1];
1359 next_vertex = conn_in[elem_in[neighbour_face1]];
1362 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1364 adjacent_vertices =
true;
1373 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
1375 if (conn_in[k] == edge_vertex1)
1378 if (k == elem_in[neighbour_face1])
1380 previous_vertex = conn_in[num_conn_in - 1];
1381 next_vertex = conn_in[k + 1];
1384 else if (k < num_conn_in - 1)
1386 previous_vertex = conn_in[k - 1];
1387 next_vertex = conn_in[k + 1];
1390 else if (k == num_conn_in - 1)
1392 previous_vertex = conn_in[k - 1];
1393 next_vertex = conn_in[elem_in[neighbour_face1]];
1396 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1398 adjacent_vertices =
true;
1409 if (adjacent_vertices ==
true)
1418 current_face = neighbour_face1;
1444 if (improper_topology)
1454 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
1456 neighbour_face1 = polygon_list[i];
1457 if (neighbour_face1 != current_face)
1459 if (neighbour_face1 < num_elem_in - 1)
1461 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
1463 if (conn_in[k] == edge_vertex1)
1466 if (k == elem_in[neighbour_face1])
1468 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
1469 next_vertex = conn_in[k + 1];
1472 else if (k < elem_in[neighbour_face1 + 1] - 1)
1474 previous_vertex = conn_in[k - 1];
1475 next_vertex = conn_in[k + 1];
1478 else if (k == elem_in[neighbour_face1 + 1] - 1)
1480 previous_vertex = conn_in[k - 1];
1481 next_vertex = conn_in[elem_in[neighbour_face1]];
1485 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
1489 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
1490 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
1491 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
1494 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
1495 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
1496 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
1499 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
1500 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
1501 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
1507 if ((length1 > 0) && (length2 > 0))
1509 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1513 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1516 new_edge_vertex = previous_vertex;
1521 if ((length1 > 0) && (length3 > 0))
1523 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1527 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1530 new_edge_vertex = next_vertex;
1541 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
1543 if (conn_in[k] == edge_vertex1)
1546 if (k == elem_in[neighbour_face1])
1548 previous_vertex = conn_in[num_conn_in - 1];
1549 next_vertex = conn_in[k + 1];
1552 else if (k < num_conn_in - 1)
1554 previous_vertex = conn_in[k - 1];
1555 next_vertex = conn_in[k + 1];
1558 else if (k == num_conn_in - 1)
1560 previous_vertex = conn_in[k - 1];
1561 next_vertex = conn_in[elem_in[neighbour_face1]];
1565 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
1569 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
1570 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
1571 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
1574 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
1575 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
1576 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
1579 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
1580 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
1581 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
1587 if ((length1 > 0) && (length2 > 0))
1589 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1593 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1596 new_edge_vertex = previous_vertex;
1601 if ((length1 > 0) && (length3 > 0))
1603 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1607 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1610 new_edge_vertex = next_vertex;
1620 if (T_vertices ==
true)
1630 current_face = neighbour_face1;
1633 edge_vertex2 = new_edge_vertex;
1634 data_vertex2 = isodata_in[edge_vertex2];
1649 for (j = index_list[edge_vertex2]; j < num_conn_in; j++)
1651 neighbour_face2 = polygon_list[j];
1652 if (neighbour_face2 != current_face)
1654 if (neighbour_face2 < num_elem_in - 1)
1656 for (k = elem_in[neighbour_face2]; k < elem_in[neighbour_face2 + 1]; k++)
1658 if (conn_in[k] == edge_vertex2)
1661 if (k == elem_in[neighbour_face2])
1663 previous_vertex = conn_in[elem_in[neighbour_face2 + 1] - 1];
1664 next_vertex = conn_in[k + 1];
1667 else if (k < elem_in[neighbour_face2 + 1] - 1)
1669 previous_vertex = conn_in[k - 1];
1670 next_vertex = conn_in[k + 1];
1673 else if (k == elem_in[neighbour_face2 + 1] - 1)
1675 previous_vertex = conn_in[k - 1];
1676 next_vertex = conn_in[elem_in[neighbour_face2]];
1680 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
1684 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
1685 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
1686 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
1689 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
1690 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
1691 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
1694 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
1695 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
1696 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
1702 if ((length1 > 0) && (length2 > 0))
1704 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1708 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1711 new_edge_vertex = previous_vertex;
1716 if ((length1 > 0) && (length3 > 0))
1718 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1722 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1725 new_edge_vertex = next_vertex;
1736 for (k = elem_in[neighbour_face2]; k < num_conn_in; k++)
1738 if (conn_in[k] == edge_vertex2)
1741 if (k == elem_in[neighbour_face2])
1743 previous_vertex = conn_in[num_conn_in - 1];
1744 next_vertex = conn_in[k + 1];
1747 else if (k < num_conn_in - 1)
1749 previous_vertex = conn_in[k - 1];
1750 next_vertex = conn_in[k + 1];
1753 else if (k == num_conn_in - 1)
1755 previous_vertex = conn_in[k - 1];
1756 next_vertex = conn_in[elem_in[neighbour_face2]];
1760 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
1764 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
1765 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
1766 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
1769 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
1770 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
1771 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
1774 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
1775 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
1776 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
1782 if ((length1 > 0) && (length2 > 0))
1784 double cosangle =
dot_product(d1, d2) / (length1 * length2);
1788 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1791 new_edge_vertex = previous_vertex;
1796 if ((length1 > 0) && (length3 > 0))
1798 double cosangle =
dot_product(d1, d3) / (length1 * length3);
1802 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
1805 new_edge_vertex = next_vertex;
1819 if (T_vertices ==
true)
1828 current_face = neighbour_face2;
1831 edge_vertex1 = new_edge_vertex;
1832 data_vertex1 = isodata_in[edge_vertex1];
1848 for (i = index_list[edge_vertex1]; i < index_list[edge_vertex1 + 1]; i++)
1850 adjacent_vertices =
false;
1851 neighbour_face1 = polygon_list[i];
1852 for (j = index_list[edge_vertex2]; j < num_conn_in; j++)
1854 neighbour_face2 = polygon_list[j];
1858 if (neighbour_face1 == neighbour_face2)
1860 if (neighbour_face1 < num_elem_in - 1)
1862 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
1864 if (conn_in[k] == edge_vertex1)
1867 if (k == elem_in[neighbour_face1])
1869 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
1870 next_vertex = conn_in[k + 1];
1873 else if (k < elem_in[neighbour_face1 + 1] - 1)
1875 previous_vertex = conn_in[k - 1];
1876 next_vertex = conn_in[k + 1];
1879 else if (k == elem_in[neighbour_face1 + 1] - 1)
1881 previous_vertex = conn_in[k - 1];
1882 next_vertex = conn_in[elem_in[neighbour_face1]];
1885 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1887 adjacent_vertices =
true;
1896 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
1898 if (conn_in[k] == edge_vertex1)
1901 if (k == elem_in[neighbour_face1])
1903 previous_vertex = conn_in[num_conn_in - 1];
1904 next_vertex = conn_in[k + 1];
1907 else if (k < num_conn_in - 1)
1909 previous_vertex = conn_in[k - 1];
1910 next_vertex = conn_in[k + 1];
1913 else if (k == num_conn_in - 1)
1915 previous_vertex = conn_in[k - 1];
1916 next_vertex = conn_in[elem_in[neighbour_face1]];
1919 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
1921 adjacent_vertices =
true;
1928 if (adjacent_vertices ==
true)
1930 if (neighbour_face1 != copy_current_face)
1934 current_face = neighbour_face1;
1952 if (current_face == copy_current_face)
1954 abort_tracing_isocontour =
true;
1959 else if ((edge_vertex1 == num_coord_in - 1) && (edge_vertex2 < num_coord_in - 1))
1961 for (i = index_list[edge_vertex1]; i < num_conn_in; i++)
1963 adjacent_vertices =
false;
1964 neighbour_face1 = polygon_list[i];
1965 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
1967 neighbour_face2 = polygon_list[j];
1971 if (neighbour_face1 == neighbour_face2)
1973 if (neighbour_face1 < num_elem_in - 1)
1975 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
1977 if (conn_in[k] == edge_vertex1)
1980 if (k == elem_in[neighbour_face1])
1982 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
1983 next_vertex = conn_in[k + 1];
1986 else if (k < elem_in[neighbour_face1 + 1] - 1)
1988 previous_vertex = conn_in[k - 1];
1989 next_vertex = conn_in[k + 1];
1992 else if (k == elem_in[neighbour_face1 + 1] - 1)
1994 previous_vertex = conn_in[k - 1];
1995 next_vertex = conn_in[elem_in[neighbour_face1]];
1998 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
2000 adjacent_vertices =
true;
2009 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
2011 if (conn_in[k] == edge_vertex1)
2014 if (k == elem_in[neighbour_face1])
2016 previous_vertex = conn_in[num_conn_in - 1];
2017 next_vertex = conn_in[k + 1];
2020 else if (k < num_conn_in - 1)
2022 previous_vertex = conn_in[k - 1];
2023 next_vertex = conn_in[k + 1];
2026 else if (k == num_conn_in - 1)
2028 previous_vertex = conn_in[k - 1];
2029 next_vertex = conn_in[elem_in[neighbour_face1]];
2032 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
2034 adjacent_vertices =
true;
2041 if (adjacent_vertices ==
true)
2051 current_face = neighbour_face1;
2070 if (improper_topology)
2076 for (i = index_list[edge_vertex1]; i < num_conn_in; i++)
2078 neighbour_face1 = polygon_list[i];
2079 if (neighbour_face1 != current_face)
2081 if (neighbour_face1 < num_elem_in - 1)
2083 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
2085 if (conn_in[k] == edge_vertex1)
2088 if (k == elem_in[neighbour_face1])
2090 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
2091 next_vertex = conn_in[k + 1];
2094 else if (k < elem_in[neighbour_face1 + 1] - 1)
2096 previous_vertex = conn_in[k - 1];
2097 next_vertex = conn_in[k + 1];
2100 else if (k == elem_in[neighbour_face1 + 1] - 1)
2102 previous_vertex = conn_in[k - 1];
2103 next_vertex = conn_in[elem_in[neighbour_face1]];
2107 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
2111 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
2112 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
2113 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
2116 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
2117 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
2118 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
2121 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
2122 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
2123 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
2129 if ((length1 > 0) && (length2 > 0))
2131 double cosangle =
dot_product(d1, d2) / (length1 * length2);
2135 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2138 new_edge_vertex = previous_vertex;
2143 if ((length1 > 0) && (length3 > 0))
2145 double cosangle =
dot_product(d1, d3) / (length1 * length3);
2149 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2152 new_edge_vertex = next_vertex;
2163 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
2165 if (conn_in[k] == edge_vertex1)
2168 if (k == elem_in[neighbour_face1])
2170 previous_vertex = conn_in[num_conn_in - 1];
2171 next_vertex = conn_in[k + 1];
2174 else if (k < num_conn_in - 1)
2176 previous_vertex = conn_in[k - 1];
2177 next_vertex = conn_in[k + 1];
2180 else if (k == num_conn_in - 1)
2182 previous_vertex = conn_in[k - 1];
2183 next_vertex = conn_in[elem_in[neighbour_face1]];
2187 if (previous_vertex != edge_vertex2 && next_vertex != edge_vertex2)
2191 d1.
x = x_coord_in[edge_vertex1] - x_coord_in[edge_vertex2];
2192 d1.
y = y_coord_in[edge_vertex1] - y_coord_in[edge_vertex2];
2193 d1.
z = z_coord_in[edge_vertex1] - z_coord_in[edge_vertex2];
2196 d2.
x = x_coord_in[edge_vertex1] - x_coord_in[previous_vertex];
2197 d2.
y = y_coord_in[edge_vertex1] - y_coord_in[previous_vertex];
2198 d2.
z = z_coord_in[edge_vertex1] - z_coord_in[previous_vertex];
2201 d3.
x = x_coord_in[edge_vertex1] - x_coord_in[next_vertex];
2202 d3.
y = y_coord_in[edge_vertex1] - y_coord_in[next_vertex];
2203 d3.
z = z_coord_in[edge_vertex1] - z_coord_in[next_vertex];
2209 if ((length1 > 0) && (length2 > 0))
2211 double cosangle =
dot_product(d1, d2) / (length1 * length2);
2215 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2218 new_edge_vertex = previous_vertex;
2223 if ((length1 > 0) && (length3 > 0))
2225 double cosangle =
dot_product(d1, d3) / (length1 * length3);
2229 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2232 new_edge_vertex = next_vertex;
2242 if (T_vertices ==
true)
2252 current_face = neighbour_face1;
2255 edge_vertex2 = new_edge_vertex;
2256 data_vertex2 = isodata_in[edge_vertex2];
2268 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
2270 neighbour_face2 = polygon_list[j];
2271 if (neighbour_face2 != current_face)
2273 if (neighbour_face2 < num_elem_in - 1)
2275 for (k = elem_in[neighbour_face2]; k < elem_in[neighbour_face2 + 1]; k++)
2277 if (conn_in[k] == edge_vertex2)
2280 if (k == elem_in[neighbour_face2])
2282 previous_vertex = conn_in[elem_in[neighbour_face2 + 1] - 1];
2283 next_vertex = conn_in[k + 1];
2286 else if (k < elem_in[neighbour_face2 + 1] - 1)
2288 previous_vertex = conn_in[k - 1];
2289 next_vertex = conn_in[k + 1];
2292 else if (k == elem_in[neighbour_face2 + 1] - 1)
2294 previous_vertex = conn_in[k - 1];
2295 next_vertex = conn_in[elem_in[neighbour_face2]];
2299 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
2303 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
2304 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
2305 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
2308 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
2309 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
2310 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
2313 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
2314 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
2315 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
2321 if ((length1 > 0) && (length2 > 0))
2323 double cosangle =
dot_product(d1, d2) / (length1 * length2);
2327 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2330 new_edge_vertex = previous_vertex;
2335 if ((length1 > 0) && (length3 > 0))
2337 double cosangle =
dot_product(d1, d3) / (length1 * length3);
2341 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2344 new_edge_vertex = next_vertex;
2355 for (k = elem_in[neighbour_face2]; k < num_conn_in; k++)
2357 if (conn_in[k] == edge_vertex2)
2360 if (k == elem_in[neighbour_face2])
2362 previous_vertex = conn_in[num_conn_in - 1];
2363 next_vertex = conn_in[k + 1];
2366 else if (k < num_conn_in - 1)
2368 previous_vertex = conn_in[k - 1];
2369 next_vertex = conn_in[k + 1];
2372 else if (k == num_conn_in - 1)
2374 previous_vertex = conn_in[k - 1];
2375 next_vertex = conn_in[elem_in[neighbour_face2]];
2379 if (previous_vertex != edge_vertex1 && next_vertex != edge_vertex1)
2383 d1.
x = x_coord_in[edge_vertex2] - x_coord_in[edge_vertex1];
2384 d1.
y = y_coord_in[edge_vertex2] - y_coord_in[edge_vertex1];
2385 d1.
z = z_coord_in[edge_vertex2] - z_coord_in[edge_vertex1];
2388 d2.
x = x_coord_in[edge_vertex2] - x_coord_in[previous_vertex];
2389 d2.
y = y_coord_in[edge_vertex2] - y_coord_in[previous_vertex];
2390 d2.
z = z_coord_in[edge_vertex2] - z_coord_in[previous_vertex];
2393 d3.
x = x_coord_in[edge_vertex2] - x_coord_in[next_vertex];
2394 d3.
y = y_coord_in[edge_vertex2] - y_coord_in[next_vertex];
2395 d3.
z = z_coord_in[edge_vertex2] - z_coord_in[next_vertex];
2401 if ((length1 > 0) && (length2 > 0))
2403 double cosangle =
dot_product(d1, d2) / (length1 * length2);
2407 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2410 new_edge_vertex = previous_vertex;
2415 if ((length1 > 0) && (length3 > 0))
2417 double cosangle =
dot_product(d1, d3) / (length1 * length3);
2421 if (
fabs(cosangle - 1.0) < 0.00001 && cosangle > 0)
2424 new_edge_vertex = next_vertex;
2434 if (T_vertices ==
true)
2444 current_face = neighbour_face2;
2447 edge_vertex1 = new_edge_vertex;
2448 data_vertex1 = isodata_in[edge_vertex1];
2460 for (i = index_list[edge_vertex1]; i < num_conn_in; i++)
2462 adjacent_vertices =
false;
2463 neighbour_face1 = polygon_list[i];
2464 for (j = index_list[edge_vertex2]; j < index_list[edge_vertex2 + 1]; j++)
2466 neighbour_face2 = polygon_list[j];
2470 if (neighbour_face1 == neighbour_face2)
2472 if (neighbour_face1 < num_elem_in - 1)
2474 for (k = elem_in[neighbour_face1]; k < elem_in[neighbour_face1 + 1]; k++)
2476 if (conn_in[k] == edge_vertex1)
2479 if (k == elem_in[neighbour_face1])
2481 previous_vertex = conn_in[elem_in[neighbour_face1 + 1] - 1];
2482 next_vertex = conn_in[k + 1];
2485 else if (k < elem_in[neighbour_face1 + 1] - 1)
2487 previous_vertex = conn_in[k - 1];
2488 next_vertex = conn_in[k + 1];
2491 else if (k == elem_in[neighbour_face1 + 1] - 1)
2493 previous_vertex = conn_in[k - 1];
2494 next_vertex = conn_in[elem_in[neighbour_face1]];
2497 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
2499 adjacent_vertices =
true;
2508 for (k = elem_in[neighbour_face1]; k < num_conn_in; k++)
2510 if (conn_in[k] == edge_vertex1)
2513 if (k == elem_in[neighbour_face1])
2515 previous_vertex = conn_in[num_conn_in - 1];
2516 next_vertex = conn_in[k + 1];
2519 else if (k < num_conn_in - 1)
2521 previous_vertex = conn_in[k - 1];
2522 next_vertex = conn_in[k + 1];
2525 else if (k == num_conn_in - 1)
2527 previous_vertex = conn_in[k - 1];
2528 next_vertex = conn_in[elem_in[neighbour_face1]];
2531 if (previous_vertex == edge_vertex2 || next_vertex == edge_vertex2)
2533 adjacent_vertices =
true;
2540 if (adjacent_vertices ==
true)
2542 if (neighbour_face1 != copy_current_face)
2546 current_face = neighbour_face1;
2564 if (current_face == copy_current_face)
2566 abort_tracing_isocontour =
true;
2572 void generate_isocontour(
ISOSURFACE_EDGE_INTERSECTION_VECTOR intsec_vector,
float data_vertex1,
float data_vertex2,
int edge_vertex1,
int edge_vertex2,
int &new_edge_vertex1,
int &new_edge_vertex2,
int *elem_in,
int *conn_in,
float isovalue,
int num_elem_in,
int num_conn_in,
int current_face,
float *x_coord_in,
float *y_coord_in,
float *z_coord_in,
bool improper_topology,
bool &abort_tracing_isocontour,
CONTOUR contour,
int num_of_rings,
int ring_end)
2595 index_v1 = elem_in[current_face];
2596 index_v2 = elem_in[current_face];
2602 if (current_face < num_elem_in - 1)
2604 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
2606 if (index_flag_v1 == 0)
2608 if (edge_vertex1 != conn_in[index_v1])
2619 if (index_flag_v2 == 0)
2621 if (edge_vertex2 != conn_in[index_v2])
2634 if (index_v1 == elem_in[current_face + 1] || index_v2 == elem_in[current_face + 1])
2636 abort_tracing_isocontour =
true;
2642 for (i = elem_in[current_face]; i < num_conn_in; i++)
2644 if (index_flag_v1 == 0)
2646 if (edge_vertex1 != conn_in[index_v1])
2657 if (index_flag_v2 == 0)
2659 if (edge_vertex2 != conn_in[index_v2])
2672 if (index_v1 == num_conn_in || index_v2 == num_conn_in)
2674 abort_tracing_isocontour =
true;
2678 counter1 = index_v1;
2679 counter2 = index_v2;
2681 if (!abort_tracing_isocontour)
2691 if (((data_vertex1 > isovalue) && (isovalue >= data_vertex2)) || ((data_vertex1 >= isovalue) && (isovalue > data_vertex2)))
2693 if (current_face < num_elem_in - 1)
2699 if (index_v1 > index_v2)
2701 if ((index_v1 != elem_in[current_face + 1] - 1) || (index_v2 != elem_in[current_face]))
2703 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
2708 if (counter1 == elem_in[current_face + 1])
2710 counter1 = elem_in[current_face];
2713 if (counter2 == elem_in[current_face + 1])
2715 counter2 = elem_in[current_face];
2719 new_edge_vertex1 = conn_in[counter1];
2720 new_edge_vertex2 = conn_in[counter2];
2722 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2724 if (num_of_rings == 0)
2726 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2727 if (it == contour.
ring.end() || it == contour.
ring.begin())
2735 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2736 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2737 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2746 else if ((index_v1 == elem_in[current_face + 1] - 1) && (index_v2 == elem_in[current_face]))
2748 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
2753 if (counter1 == elem_in[current_face] - 1)
2755 counter1 = elem_in[current_face + 1] - 1;
2758 if (counter2 == elem_in[current_face] - 1)
2760 counter2 = elem_in[current_face + 1] - 1;
2764 new_edge_vertex1 = conn_in[counter1];
2765 new_edge_vertex2 = conn_in[counter2];
2767 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2769 if (num_of_rings == 0)
2771 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2772 if (it == contour.
ring.end() || it == contour.
ring.begin())
2780 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2781 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2782 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2796 else if (index_v1 < index_v2)
2798 if ((index_v1 != elem_in[current_face]) || (index_v2 != elem_in[current_face + 1] - 1))
2800 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
2805 if (counter1 == elem_in[current_face] - 1)
2807 counter1 = elem_in[current_face + 1] - 1;
2810 if (counter2 == elem_in[current_face] - 1)
2812 counter2 = elem_in[current_face + 1] - 1;
2816 new_edge_vertex1 = conn_in[counter1];
2817 new_edge_vertex2 = conn_in[counter2];
2819 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2821 if (num_of_rings == 0)
2823 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2824 if (it == contour.
ring.end() || it == contour.
ring.begin())
2832 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2833 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2834 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2843 else if ((index_v1 == elem_in[current_face]) && (index_v2 == elem_in[current_face + 1] - 1))
2845 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
2850 if (counter1 == elem_in[current_face + 1])
2852 counter1 = elem_in[current_face];
2855 if (counter2 == elem_in[current_face + 1])
2857 counter2 = elem_in[current_face];
2861 new_edge_vertex1 = conn_in[counter1];
2862 new_edge_vertex2 = conn_in[counter2];
2864 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2866 if (num_of_rings == 0)
2868 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2869 if (it == contour.
ring.end() || it == contour.
ring.begin())
2877 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2878 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2879 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2896 if (index_v1 > index_v2)
2898 if ((index_v1 != num_conn_in - 1) || (index_v2 != elem_in[current_face]))
2900 for (i = elem_in[current_face]; i < num_conn_in; i++)
2905 if (counter1 == num_conn_in)
2907 counter1 = elem_in[current_face];
2910 if (counter2 == num_conn_in)
2912 counter2 = elem_in[current_face];
2916 new_edge_vertex1 = conn_in[counter1];
2917 new_edge_vertex2 = conn_in[counter2];
2919 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2921 if (num_of_rings == 0)
2923 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2924 if (it == contour.
ring.end() || it == contour.
ring.begin())
2932 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2933 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2934 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2943 else if ((index_v1 == num_conn_in - 1) && (index_v2 == elem_in[current_face]))
2945 for (i = elem_in[current_face]; i < num_conn_in; i++)
2950 if (counter1 == elem_in[current_face] - 1)
2952 counter1 = num_conn_in - 1;
2955 if (counter2 == elem_in[current_face] - 1)
2957 counter2 = num_conn_in - 1;
2961 new_edge_vertex1 = conn_in[counter1];
2962 new_edge_vertex2 = conn_in[counter2];
2964 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
2966 if (num_of_rings == 0)
2968 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
2969 if (it == contour.
ring.end() || it == contour.
ring.begin())
2977 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
2978 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
2979 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
2993 else if (index_v1 < index_v2)
2995 if ((index_v1 != elem_in[current_face]) || (index_v2 != num_conn_in - 1))
2997 for (i = elem_in[current_face]; i < num_conn_in; i++)
3002 if (counter1 == elem_in[current_face] - 1)
3004 counter1 = num_conn_in - 1;
3007 if (counter2 == elem_in[current_face] - 1)
3009 counter2 = num_conn_in - 1;
3013 new_edge_vertex1 = conn_in[counter1];
3014 new_edge_vertex2 = conn_in[counter2];
3016 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3018 if (num_of_rings == 0)
3020 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3021 if (it == contour.
ring.end() || it == contour.
ring.begin())
3029 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3030 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3031 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3040 else if ((index_v1 == elem_in[current_face]) && (index_v2 == num_conn_in - 1))
3042 for (i = elem_in[current_face]; i < num_conn_in; i++)
3047 if (counter1 == num_conn_in)
3049 counter1 = elem_in[current_face];
3052 if (counter2 == num_conn_in)
3054 counter2 = elem_in[current_face];
3058 new_edge_vertex1 = conn_in[counter1];
3059 new_edge_vertex2 = conn_in[counter2];
3061 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3063 if (num_of_rings == 0)
3065 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3066 if (it == contour.
ring.end() || it == contour.
ring.begin())
3074 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3075 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3076 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3087 if ((edge_vertex1 == new_edge_vertex1 && edge_vertex2 == new_edge_vertex2) || (edge_vertex1 == new_edge_vertex2 && edge_vertex2 == new_edge_vertex1))
3089 abort_tracing_isocontour =
true;
3097 else if (((data_vertex2 > isovalue) && (isovalue >= data_vertex1)) || ((data_vertex2 >= isovalue) && (isovalue > data_vertex1)))
3099 if (current_face < num_elem_in - 1)
3105 if (index_v1 < index_v2)
3107 if ((index_v1 != elem_in[current_face]) || (index_v2 != elem_in[current_face + 1] - 1))
3109 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
3114 if (counter1 == elem_in[current_face + 1])
3116 counter1 = elem_in[current_face];
3119 if (counter2 == elem_in[current_face + 1])
3121 counter2 = elem_in[current_face];
3125 new_edge_vertex1 = conn_in[counter1];
3126 new_edge_vertex2 = conn_in[counter2];
3128 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3130 if (num_of_rings == 0)
3132 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3133 if (it == contour.
ring.end() || it == contour.
ring.begin())
3141 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3142 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3143 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3152 else if ((index_v1 == elem_in[current_face]) && (index_v2 == elem_in[current_face + 1] - 1))
3154 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
3159 if (counter1 == elem_in[current_face] - 1)
3161 counter1 = elem_in[current_face + 1] - 1;
3164 if (counter2 == elem_in[current_face] - 1)
3166 counter2 = elem_in[current_face + 1] - 1;
3170 new_edge_vertex1 = conn_in[counter1];
3171 new_edge_vertex2 = conn_in[counter2];
3173 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3175 if (num_of_rings == 0)
3177 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3178 if (it == contour.
ring.end() || it == contour.
ring.begin())
3186 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3187 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3188 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3202 else if (index_v1 > index_v2)
3204 if ((index_v1 != elem_in[current_face + 1] - 1) || (index_v2 != elem_in[current_face]))
3206 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
3211 if (counter1 == elem_in[current_face] - 1)
3213 counter1 = elem_in[current_face + 1] - 1;
3216 if (counter2 == elem_in[current_face] - 1)
3218 counter2 = elem_in[current_face + 1] - 1;
3222 new_edge_vertex1 = conn_in[counter1];
3223 new_edge_vertex2 = conn_in[counter2];
3225 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3227 if (num_of_rings == 0)
3229 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3230 if (it == contour.
ring.end() || it == contour.
ring.begin())
3238 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3239 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3240 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3249 else if ((index_v1 == elem_in[current_face + 1] - 1) && (index_v2 == elem_in[current_face]))
3251 for (i = elem_in[current_face]; i < elem_in[current_face + 1]; i++)
3256 if (counter1 == elem_in[current_face + 1])
3258 counter1 = elem_in[current_face];
3261 if (counter2 == elem_in[current_face + 1])
3263 counter2 = elem_in[current_face];
3267 new_edge_vertex1 = conn_in[counter1];
3268 new_edge_vertex2 = conn_in[counter2];
3270 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3272 if (num_of_rings == 0)
3274 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3275 if (it == contour.
ring.end() || it == contour.
ring.begin())
3283 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3284 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3285 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3302 if (index_v1 < index_v2)
3304 if ((index_v1 != elem_in[current_face]) || (index_v2 != num_conn_in - 1))
3306 for (i = elem_in[current_face]; i < num_conn_in; i++)
3311 if (counter1 == num_conn_in)
3313 counter1 = elem_in[current_face];
3316 if (counter2 == num_conn_in)
3318 counter2 = elem_in[current_face];
3322 new_edge_vertex1 = conn_in[counter1];
3323 new_edge_vertex2 = conn_in[counter2];
3325 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3327 if (num_of_rings == 0)
3329 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3330 if (it == contour.
ring.end() || it == contour.
ring.begin())
3338 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3339 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3340 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3349 else if ((index_v1 == elem_in[current_face]) && (index_v2 == num_conn_in - 1))
3351 for (i = elem_in[current_face]; i < num_conn_in; i++)
3356 if (counter1 == elem_in[current_face] - 1)
3358 counter1 = num_conn_in - 1;
3361 if (counter2 == elem_in[current_face] - 1)
3363 counter2 = num_conn_in - 1;
3367 new_edge_vertex1 = conn_in[counter1];
3368 new_edge_vertex2 = conn_in[counter2];
3370 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3372 if (num_of_rings == 0)
3374 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3375 if (it == contour.
ring.end() || it == contour.
ring.begin())
3383 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3384 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3385 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3399 else if (index_v1 > index_v2)
3401 if ((index_v1 != num_conn_in - 1) || (index_v2 != elem_in[current_face]))
3403 for (i = elem_in[current_face]; i < num_conn_in; i++)
3408 if (counter1 == elem_in[current_face] - 1)
3410 counter1 = num_conn_in - 1;
3413 if (counter2 == elem_in[current_face] - 1)
3415 counter2 = num_conn_in - 1;
3419 new_edge_vertex1 = conn_in[counter1];
3420 new_edge_vertex2 = conn_in[counter2];
3422 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3424 if (num_of_rings == 0)
3426 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3427 if (it == contour.
ring.end() || it == contour.
ring.begin())
3435 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3436 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3437 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3446 else if ((index_v1 == num_conn_in - 1) && (index_v2 == elem_in[current_face]))
3448 for (i = elem_in[current_face]; i < num_conn_in; i++)
3453 if (counter1 == num_conn_in)
3455 counter1 = elem_in[current_face];
3458 if (counter2 == num_conn_in)
3460 counter2 = elem_in[current_face];
3464 new_edge_vertex1 = conn_in[counter1];
3465 new_edge_vertex2 = conn_in[counter2];
3467 if (
find_intersection(intsec_vector, new_edge_vertex1, new_edge_vertex2, x_coord_in, y_coord_in, z_coord_in, improper_topology, int_index))
3469 if (num_of_rings == 0)
3471 it = find(contour.
ring.begin(), contour.
ring.end(), int_index);
3472 if (it == contour.
ring.end() || it == contour.
ring.begin())
3480 it = find(contour.
ring.begin(), contour.
ring.begin() + ring_end, int_index);
3481 it2 = find(contour.
ring.begin() + ring_end, contour.
ring.end(), int_index);
3482 if (it == contour.
ring.begin() + ring_end && (it2 == contour.
ring.end() || it2 == contour.
ring.begin() + ring_end))
3493 if ((edge_vertex1 == new_edge_vertex1 && edge_vertex2 == new_edge_vertex2) || (edge_vertex1 == new_edge_vertex2 && edge_vertex2 == new_edge_vertex1))
3495 abort_tracing_isocontour =
true;
3507 else if (((data_vertex1 < isovalue) && (isovalue > data_vertex2)) || ((data_vertex1 > isovalue) && (isovalue < data_vertex2)))
3509 abort_tracing_isocontour =
true;
3516 bool end_of_triangulation;
3521 int temp_polygon_index;
3524 int triangulation_counter;
3525 int normal_vector_counter;
3541 polygon.reserve(15);
3547 for (i = 0; i < contour.
ring_index.size(); i++)
3567 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3568 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3569 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3571 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3572 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3573 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3577 tesselation_triangle.
normal.
x = normal.
x;
3578 tesselation_triangle.
normal.
y = normal.
y;
3579 tesselation_triangle.
normal.
z = normal.
z;
3582 triangulation.push_back(tesselation_triangle);
3594 polygon.push_back(contour.
ring[j]);
3602 end_of_triangulation =
false;
3603 triangulation_counter = 0;
3607 if (polygon.size() > 3)
3613 if (polygon_index == 1)
3615 predecessor = polygon_index - 1;
3616 successor = polygon_index + 1;
3619 else if (polygon_index == 0)
3621 predecessor = (int)polygon.size() - 1;
3622 successor = polygon_index + 1;
3625 else if (polygon_index == polygon.size() - 1)
3627 predecessor = polygon_index - 1;
3631 else if (polygon_index == polygon.size())
3634 predecessor = (int)polygon.size() - 1;
3635 successor = polygon_index + 1;
3640 predecessor = polygon_index - 1;
3641 successor = polygon_index + 1;
3645 tesselation_triangle.
vertex1 = polygon[predecessor];
3646 tesselation_triangle.
vertex2 = polygon[polygon_index];
3647 tesselation_triangle.
vertex3 = polygon[successor];
3650 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3651 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3652 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3654 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3655 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3656 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3659 temp_polygon_index = polygon_index;
3666 tesselation_triangle.
normal.
x = normal.
x;
3667 tesselation_triangle.
normal.
y = normal.
y;
3668 tesselation_triangle.
normal.
z = normal.
z;
3674 normal_vector_counter = 0;
3684 if (normal.
x == 0 && normal.
y == 0 && normal.
z == 0)
3688 normal_vector_counter++;
3691 if (polygon_index + 1 <= polygon.size())
3700 if (polygon_index == 0)
3702 predecessor = (int)polygon.size() - 1;
3703 successor = polygon_index + 1;
3706 else if (polygon_index == polygon.size() - 1)
3708 predecessor = polygon_index - 1;
3712 else if (polygon_index == polygon.size())
3715 predecessor = (int)polygon.size() - 1;
3716 successor = polygon_index + 1;
3719 else if (polygon_index != 0 && polygon_index != polygon.size() - 1 && polygon_index != polygon.size())
3721 predecessor = polygon_index - 1;
3722 successor = polygon_index + 1;
3726 tesselation_triangle.
vertex1 = polygon[predecessor];
3727 tesselation_triangle.
vertex2 = polygon[polygon_index];
3728 tesselation_triangle.
vertex3 = polygon[successor];
3731 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3732 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3733 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3735 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3736 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3737 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3741 tesselation_triangle.
normal.
x = normal.
x;
3742 tesselation_triangle.
normal.
y = normal.
y;
3743 tesselation_triangle.
normal.
z = normal.
z;
3744 }
while ((normal.
x == 0 && normal.
y == 0 && normal.
z == 0) && normal_vector_counter < polygon.size());
3749 triangulation_counter = (int)polygon.size() + 1;
3752 if (triangulation_counter > (
int)polygon.size())
3755 triangulation.push_back(temp_triangle);
3758 start = polygon.begin();
3759 end = polygon.end();
3760 new_end =
remove(
start,
end, polygon[temp_polygon_index]);
3761 polygon.erase(new_end, end);
3769 if (polygon.size() == 3)
3772 if (polygon_index == 1)
3774 predecessor = polygon_index - 1;
3775 successor = polygon_index + 1;
3778 else if (polygon_index == 0)
3780 predecessor = (int)polygon.size() - 1;
3781 successor = polygon_index + 1;
3784 else if (polygon_index == (
int)polygon.size() - 1)
3786 predecessor = polygon_index - 1;
3790 else if (polygon_index == (
int)polygon.size())
3793 predecessor = (int)polygon.size() - 1;
3794 successor = polygon_index + 1;
3799 predecessor = polygon_index - 1;
3800 successor = polygon_index + 1;
3804 tesselation_triangle.
vertex1 = polygon[predecessor];
3805 tesselation_triangle.
vertex2 = polygon[polygon_index];
3806 tesselation_triangle.
vertex3 = polygon[successor];
3809 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3810 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3811 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3813 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3814 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3815 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3819 tesselation_triangle.
normal.
x = normal.
x;
3820 tesselation_triangle.
normal.
y = normal.
y;
3821 tesselation_triangle.
normal.
z = normal.
z;
3824 triangulation.push_back(tesselation_triangle);
3825 end_of_triangulation =
true;
3827 }
while (end_of_triangulation !=
true);
3846 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3847 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3848 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3850 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3851 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3852 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3856 tesselation_triangle.
normal.
x = normal.
x;
3857 tesselation_triangle.
normal.
y = normal.
y;
3858 tesselation_triangle.
normal.
z = normal.
z;
3861 triangulation.push_back(tesselation_triangle);
3873 polygon.push_back(contour.
ring[j]);
3881 end_of_triangulation =
false;
3882 triangulation_counter = 0;
3886 if (polygon.size() > 3)
3892 if (polygon_index == 1)
3894 predecessor = polygon_index - 1;
3895 successor = polygon_index + 1;
3898 else if (polygon_index == 0)
3900 predecessor = (int)polygon.size() - 1;
3901 successor = polygon_index + 1;
3904 else if (polygon_index == (
int)polygon.size() - 1)
3906 predecessor = polygon_index - 1;
3910 else if (polygon_index == (
int)polygon.size())
3913 predecessor = (int)polygon.size() - 1;
3914 successor = polygon_index + 1;
3919 predecessor = polygon_index - 1;
3920 successor = polygon_index + 1;
3924 tesselation_triangle.
vertex1 = polygon[predecessor];
3925 tesselation_triangle.
vertex2 = polygon[polygon_index];
3926 tesselation_triangle.
vertex3 = polygon[successor];
3929 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3930 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3931 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3933 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
3934 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
3935 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
3938 temp_polygon_index = polygon_index;
3945 tesselation_triangle.
normal.
x = normal.
x;
3946 tesselation_triangle.
normal.
y = normal.
y;
3947 tesselation_triangle.
normal.
z = normal.
z;
3953 normal_vector_counter = 0;
3963 if (normal.
x == 0 && normal.
y == 0 && normal.
z == 0)
3967 normal_vector_counter++;
3970 if (polygon_index + 1 <= polygon.size())
3979 if (polygon_index == 1)
3981 predecessor = polygon_index - 1;
3982 successor = polygon_index + 1;
3985 else if (polygon_index == 0)
3987 predecessor = (int)polygon.size() - 1;
3988 successor = polygon_index + 1;
3991 else if (polygon_index == (
int)polygon.size() - 1)
3993 predecessor = polygon_index - 1;
3997 else if (polygon_index == (
int)polygon.size())
4000 predecessor = (int)polygon.size() - 1;
4001 successor = polygon_index + 1;
4006 predecessor = polygon_index - 1;
4007 successor = polygon_index + 1;
4011 tesselation_triangle.
vertex1 = polygon[predecessor];
4012 tesselation_triangle.
vertex2 = polygon[polygon_index];
4013 tesselation_triangle.
vertex3 = polygon[successor];
4016 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
4017 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
4018 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
4020 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
4021 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
4022 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
4027 tesselation_triangle.
normal.
x = normal.
x;
4028 tesselation_triangle.
normal.
y = normal.
y;
4029 tesselation_triangle.
normal.
z = normal.
z;
4030 }
while ((normal.
x == 0 && normal.
y == 0 && normal.
z == 0) && normal_vector_counter < polygon.size());
4035 triangulation_counter = (int)polygon.size() + 1;
4038 if (triangulation_counter > (
int)polygon.size())
4041 triangulation.push_back(temp_triangle);
4044 start = polygon.begin();
4045 end = polygon.end();
4046 new_end =
remove(
start,
end, polygon[temp_polygon_index]);
4047 polygon.erase(new_end, end);
4055 if (polygon.size() == 3)
4061 if (polygon_index == 1)
4063 predecessor = polygon_index - 1;
4064 successor = polygon_index + 1;
4067 if (polygon_index == 0)
4069 predecessor = (int)polygon.size() - 1;
4070 successor = polygon_index + 1;
4073 else if (polygon_index == polygon.size() - 1)
4075 predecessor = polygon_index - 1;
4079 else if (polygon_index == polygon.size())
4082 predecessor = (int)polygon.size() - 1;
4083 successor = polygon_index + 1;
4088 predecessor = polygon_index - 1;
4089 successor = polygon_index + 1;
4093 tesselation_triangle.
vertex1 = polygon[predecessor];
4094 tesselation_triangle.
vertex2 = polygon[polygon_index];
4095 tesselation_triangle.
vertex3 = polygon[successor];
4098 vector1.
x = intsec_vector[tesselation_triangle.
vertex2].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
4099 vector1.
y = intsec_vector[tesselation_triangle.
vertex2].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
4100 vector1.
z = intsec_vector[tesselation_triangle.
vertex2].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
4102 vector2.
x = intsec_vector[tesselation_triangle.
vertex3].intersection.x - intsec_vector[tesselation_triangle.
vertex1].intersection.x;
4103 vector2.
y = intsec_vector[tesselation_triangle.
vertex3].intersection.y - intsec_vector[tesselation_triangle.
vertex1].intersection.y;
4104 vector2.
z = intsec_vector[tesselation_triangle.
vertex3].intersection.z - intsec_vector[tesselation_triangle.
vertex1].intersection.z;
4108 tesselation_triangle.
normal.
x = normal.
x;
4109 tesselation_triangle.
normal.
y = normal.
y;
4110 tesselation_triangle.
normal.
z = normal.
z;
4113 triangulation.push_back(tesselation_triangle);
4114 end_of_triangulation =
true;
4116 }
while (end_of_triangulation !=
true);
std::vector< int >::iterator ITERATOR
Definition: IsoSurfaceGPMUtil.h:82
bool intersection_at_vertex2
Definition: IsoSurfaceGPMUtil.h:53
std::vector< int > POLYGON
Definition: IsoSurfaceGPMUtil.h:78
float data_vertex1
Definition: IsoSurfaceGPMUtil.h:59
std::vector< int > ring
Definition: IsoSurfaceGPMUtil.h:68
vector< int > ring_index
Definition: CuttingSurfaceGPMUtil.h:40
int vertex1
Definition: IsoSurfaceGPMUtil.h:56
double x
Definition: CuttingSurfaceGPMUtil.h:21
GLfloat GLfloat v1
Definition: khronos-glext.h:6753
int vertex3
Definition: IsoSurfaceGPMUtil.h:45
Definition: CuttingSurfaceGPMUtil.h:37
vector< int > polyhedron_faces
Definition: CuttingSurfaceGPMUtil.h:41
double vec_length(EDGE_VECTOR &vector)
Definition: IsoSurfaceGPMUtil.h:103
GLuint GLuint end
Definition: khronos-glext.h:6343
int int_flag
Definition: IsoSurfaceGPMUtil.h:55
__host__ __device__ float2 fabs(float2 v)
Definition: cutil_math.h:1380
double y
Definition: CuttingSurfaceGPMUtil.h:22
float data_vertex2
Definition: IsoSurfaceGPMUtil.h:60
std::vector< ISOSURFACE_EDGE_INTERSECTION > ISOSURFACE_EDGE_INTERSECTION_VECTOR
Definition: IsoSurfaceGPMUtil.h:73
Definition: IsoSurfaceGPMUtil.h:41
EDGE_VECTOR cross_product(EDGE_VECTOR &vector1, EDGE_VECTOR &vector2)
Definition: CuttingSurfaceGPMUtil.h:59
std::vector< int > polyhedron_faces
Definition: IsoSurfaceGPMUtil.h:70
std::vector< int > CONNECTIVITY_VECTOR
Definition: IsoSurfaceGPMUtil.h:77
#define NULL
Definition: covise_list.h:22
double z
Definition: CuttingSurfaceGPMUtil.h:23
const GLdouble * v
Definition: khronos-glext.h:6442
std::vector< int >::iterator POLYGON_ITERATOR
Definition: IsoSurfaceGPMUtil.h:81
int vertex1
Definition: IsoSurfaceGPMUtil.h:43
bool test_intersection(ISOSURFACE_EDGE_INTERSECTION_VECTOR &intsec_vector, ISOSURFACE_EDGE_INTERSECTION &intsec, float *x_coord_in, float *y_coord_in, float *z_coord_in, bool &improper_topology)
Definition: IsoSurfaceGPMUtil.h:209
float v[3]
Definition: CuttingSurfaceGPMUtil.h:15
bool find_intersection(PLANE_EDGE_INTERSECTION_VECTOR &intsec_vector, int edge_vertex1, int edge_vertex2)
Definition: CuttingSurfaceGPMUtil.h:512
float z
Definition: IsoSurfaceGPMUtil.h:38
S_V_DATA data_vertex_int
Definition: IsoSurfaceGPMUtil.h:62
GLuint start
Definition: khronos-glext.h:6343
void generate_tesselation(TESSELATION &triangulation, CONTOUR contour, ISOSURFACE_EDGE_INTERSECTION_VECTOR intsec_vector)
Definition: IsoSurfaceGPMUtil.h:3514
GLfixed GLfixed GLfixed y2
Definition: khronos-glext.h:11325
std::vector< int > ring_index
Definition: IsoSurfaceGPMUtil.h:69
int vertex2
Definition: IsoSurfaceGPMUtil.h:44
PLANE_EDGE_INTERSECTION_VECTOR calculate_intersections(float *udata_in, float *vdata_in, float *wdata_in, int num_elem_in, int *elem_in, int num_conn_in, int *conn_in, float *x_coord_in, float *y_coord_in, float *z_coord_in, float p, EDGE_VECTOR unit_normal_vector)
Definition: CuttingSurfaceGPMUtil.h:300
GLuint index
Definition: khronos-glext.h:6722
void generate_isocontour(ISOSURFACE_EDGE_INTERSECTION_VECTOR intsec_vector, float data_vertex1, float data_vertex2, int edge_vertex1, int edge_vertex2, int &new_edge_vertex1, int &new_edge_vertex2, int *elem_in, int *conn_in, float isovalue, int num_elem_in, int num_conn_in, int current_face, float *x_coord_in, float *y_coord_in, float *z_coord_in, bool improper_topology, bool &abort_tracing_isocontour, CONTOUR contour, int num_of_rings, int ring_end)
Definition: IsoSurfaceGPMUtil.h:2572
GLfixed GLfixed x2
Definition: khronos-glext.h:11325
std::vector< TRIANGLE > TESSELATION
Definition: IsoSurfaceGPMUtil.h:75
EDGE_VECTOR normal
Definition: IsoSurfaceGPMUtil.h:47
GLuint GLfloat GLfloat GLfloat x1
Definition: khronos-glext.h:13144
float map_to_isosurface(float coord_x1, float coord_x2, float coord_y1, float coord_y2, float coord_z1, float coord_z2, float coord_isox, float coord_isoy, float coord_isoz, float data_1, float data_2, bool int_vertex1, bool int_vertex2)
Definition: IsoSurfaceGPMUtil.h:304
EDGE_VECTOR intersection
Definition: IsoSurfaceGPMUtil.h:63
void find_current_face(CONTOUR &contour, ISOSURFACE_EDGE_INTERSECTION_VECTOR intsec_vector, int &edge_vertex1, int &edge_vertex2, float &data_vertex1, float &data_vertex2, float *isodata_in, int *elem_in, int *conn_in, int *index_list, int *polygon_list, int num_coord_in, int num_conn_in, int num_elem_in, int &ring_counter, int ¤t_face, float *x_coord_in, float *y_coord_in, float *z_coord_in, bool improper_topology, bool &abort_tracing_isocontour)
Definition: IsoSurfaceGPMUtil.h:649
bool intersection_at_vertex1
Definition: IsoSurfaceGPMUtil.h:52
std::vector< int > PROCESSED_ELEMENTS
Definition: IsoSurfaceGPMUtil.h:79
int vertex2
Definition: IsoSurfaceGPMUtil.h:57
Definition: CuttingSurfaceGPMUtil.h:13
GLfixed y1
Definition: khronos-glext.h:11325
double dot_product(EDGE_VECTOR &vector1, EDGE_VECTOR &vector2)
Definition: CuttingSurfaceGPMUtil.h:54
int dimension
Definition: CuttingSurfaceGPMUtil.h:16
int assign_int_index(PLANE_EDGE_INTERSECTION_VECTOR &intsec_vector, int edge_vertex1, int edge_vertex2)
Definition: CuttingSurfaceGPMUtil.h:469
Definition: IsoSurfaceGPMUtil.h:50
ISOSURFACE_EDGE_INTERSECTION VertexInterpolate(float x1, float y1, float z1, float x2, float y2, float z2, float isovalue, float data1, float data2, int v1, int v2)
Definition: IsoSurfaceGPMUtil.h:108
Definition: CuttingSurfaceGPMUtil.h:19
float y
Definition: IsoSurfaceGPMUtil.h:37
float x
Definition: IsoSurfaceGPMUtil.h:36
GLfloat GLfloat GLfloat v2
Definition: khronos-glext.h:6754
vector< int > ring
Definition: CuttingSurfaceGPMUtil.h:39