Returns 1 if the uv's match
| 684 | |
| 685 | // Returns 1 if the uv's match |
| 686 | int uvs_match(reading_face *a, int va, reading_face *b, int vb) { |
| 687 | int f1, f2, flag; |
| 688 | vector n1, n2; |
| 689 | float d1, d2; |
| 690 | float cosTheta; |
| 691 | float u_err, v_err; |
| 692 | |
| 693 | u_err = (float)fabs((a->face_uvls[va].u - b->face_uvls[vb].u) / ((a->face_uvls[va].u + b->face_uvls[vb].u) / 2.0f)); |
| 694 | v_err = (float)fabs((a->face_uvls[va].v - b->face_uvls[vb].v) / ((a->face_uvls[va].v + b->face_uvls[vb].v) / 2.0f)); |
| 695 | |
| 696 | if (u_err + v_err > 0.00001f) |
| 697 | return 0; |
| 698 | |
| 699 | f1 = compute_faces_mapping(a, &n1, &d1); |
| 700 | f2 = compute_faces_mapping(b, &n2, &d2); |
| 701 | |
| 702 | if (f1 || f2) |
| 703 | return 0; |
| 704 | |
| 705 | cosTheta = vm_DotProduct(&n1, &n2); |
| 706 | |
| 707 | if ((cosTheta < 0.99f) || (fabs(d2 - d1) > 0.0001f)) { |
| 708 | flag = 0; |
| 709 | } else { |
| 710 | flag = 1; |
| 711 | } |
| 712 | |
| 713 | return flag; |
| 714 | } |
| 715 | |
| 716 | #define MAX_POINT_DISTANCE_FROM_PLANE .1 |
| 717 |
no test coverage detected