Finds a shared edge, if one exists, between two faces in the same room Parameters: fp0,fp1 - pointers to the two faces vn0,vn1 - filled in with the vertex numbers of the edge. These vert numbers are relative to their own faces. The shared edge is verts on face 0, and on face 1 Returns: true if a shared edge was found, else false
| 1545 | //verts <vn0,vn0+1> on face 0, and <vn1+1,vn1> on face 1 Returns: true if a shared edge was found, else |
| 1546 | // false |
| 1547 | bool FindSharedEdge(face *fp0, face *fp1, int *vn0, int *vn1) { |
| 1548 | int i, j, a0, b0, a1, b1; |
| 1549 | |
| 1550 | // Go through each edge in first face |
| 1551 | for (i = 0; i < fp0->num_verts; i++) { |
| 1552 | |
| 1553 | // Get edge verts - <a0,b0> is edge on first face |
| 1554 | a0 = fp0->face_verts[i]; |
| 1555 | b0 = fp0->face_verts[(i + 1) % fp0->num_verts]; |
| 1556 | |
| 1557 | // Check against second face |
| 1558 | for (j = 0; j < fp1->num_verts; j++) { |
| 1559 | |
| 1560 | // Get edge verts - <a1,b1> is edge on second face |
| 1561 | a1 = fp1->face_verts[j]; |
| 1562 | b1 = fp1->face_verts[(j + 1) % fp1->num_verts]; |
| 1563 | |
| 1564 | //@@if ((a0==a1) && (b0==b1)) |
| 1565 | //@@ Int3(); //If you hit this, you probably have a duplicate |
| 1566 | //or overlapping face |
| 1567 | |
| 1568 | if ((a0 == b1) && (b0 == a1)) { // found match! |
| 1569 | *vn0 = i; |
| 1570 | *vn1 = j; |
| 1571 | return 1; |
| 1572 | } |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // Didn't find an edge, so return error |
| 1577 | return 0; |
| 1578 | } |
| 1579 | |
| 1580 | // Finds a shared edge, if one exists, between two faces in different rooms |
| 1581 | // Parameters: rp0,rp1 - pointers to the two rooms |
no outgoing calls
no test coverage detected