\returns the vertex of the bounding box at the corner defined by * the corner-id corner. It works only for a 1D, 2D or 3D bounding box. * For 1D bounding boxes corners are named by 2 enum constants: * BottomLeft and BottomRight. * For 2D bounding boxes, corners are named by 4 enum constants: * BottomLeft, BottomRight, TopLeft, TopRight. * For 3D bounding boxes, the followin
| 182 | * BottomLeftCeil, BottomRightCeil, TopLeftCeil, TopRightCeil. |
| 183 | */ |
| 184 | EIGEN_DEVICE_FUNC inline VectorType corner(CornerType corner) const |
| 185 | { |
| 186 | EIGEN_STATIC_ASSERT(AmbientDim_ <= 3, THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE); |
| 187 | |
| 188 | VectorType res; |
| 189 | |
| 190 | Index mult = 1; |
| 191 | for(Index d=0; d<dim(); ++d) |
| 192 | { |
| 193 | if( mult & corner ) res[d] = m_max[d]; |
| 194 | else res[d] = m_min[d]; |
| 195 | mult *= 2; |
| 196 | } |
| 197 | return res; |
| 198 | } |
| 199 | |
| 200 | /** \returns a random point inside the bounding box sampled with |
| 201 | * a uniform distribution */ |