This could be optimized by storing things, and there is also symmetry that could eliminate rotations, but that seems unnecessary for now.
| 142 | // This could be optimized by storing things, and there is also symmetry |
| 143 | // that could eliminate rotations, but that seems unnecessary for now. |
| 144 | Eigen::Vector3d Obb::corner(size_t pos) |
| 145 | { |
| 146 | assert(pos < 8); |
| 147 | Eigen::Vector3d v((pos & 1) ? -m_hx : m_hx, |
| 148 | (pos & 2) ? -m_hy : m_hy, |
| 149 | (pos & 4) ? -m_hz : m_hz); |
| 150 | v = math::rotate(v, m_quat); |
| 151 | v += m_p; |
| 152 | return v; |
| 153 | } |
| 154 | |
| 155 | Segment Obb::segment(size_t pos) |
| 156 | { |