| 153 | } |
| 154 | |
| 155 | Segment Obb::segment(size_t pos) |
| 156 | { |
| 157 | assert(pos < 12); |
| 158 | |
| 159 | // Each pair is a set of indices that represent the corners of an edge. |
| 160 | // Top row is the segments that make up the "top" rectangle. Second |
| 161 | // row makes up the "bottom" rectangle. Third row makes up the edges |
| 162 | // connecting the top corners to the bottom corners. |
| 163 | std::array<std::pair<std::size_t, std::size_t>, 12> segs |
| 164 | {{ |
| 165 | {0, 2}, {2, 6}, {6, 4}, {4, 0}, |
| 166 | {1, 3}, {3, 7}, {7, 5}, {5, 1}, |
| 167 | {0, 1}, {2, 3}, {4, 5}, {6, 7} |
| 168 | }}; |
| 169 | return { corner(segs[pos].first), corner(segs[pos].second) }; |
| 170 | } |
| 171 | |
| 172 | // For this to work both this and the clip box must be in the same cartesian |
| 173 | // system. |