| 67 | // Needed so we can use right facing models for left facing faces. |
| 68 | |
| 69 | Shape FlipShape( // flip shape horizontally |
| 70 | const Shape& shape, // in |
| 71 | int imgwidth) // in |
| 72 | { |
| 73 | const LANDMARK_INFO* info = nullptr; |
| 74 | switch (shape.rows) |
| 75 | { |
| 76 | case 77: info = LANDMARK_INFO_TAB; break; |
| 77 | default: Err("Do not know how to mirror a %d shape", shape.rows); |
| 78 | } |
| 79 | Shape outshape(shape.rows, 2); |
| 80 | for (int i = 0; i < shape.rows; i++) |
| 81 | { |
| 82 | int partner = info[i].partner; |
| 83 | |
| 84 | if (partner == -1) // no partner e.g. tip of nose |
| 85 | partner = i; |
| 86 | |
| 87 | FlipPoint(outshape, shape, partner, i, imgwidth); |
| 88 | } |
| 89 | return outshape; |
| 90 | } |
| 91 | |
| 92 | } // namespace stasm |
no test coverage detected