| 161 | } |
| 162 | |
| 163 | void CastRaySegment( |
| 164 | const K::Segment_3& ray_segment, |
| 165 | std::vector<AFSRTriangulation::Facet>* intersections) const { |
| 166 | intersections->clear(); |
| 167 | |
| 168 | AFSRTriangulation::Cell_handle next_cell = |
| 169 | triangulation_.locate(ray_segment.start()); |
| 170 | |
| 171 | bool next_cell_found = true; |
| 172 | while (next_cell_found) { |
| 173 | next_cell_found = false; |
| 174 | |
| 175 | if (triangulation_.is_infinite(next_cell)) { |
| 176 | for (const auto& hull_facet : hull_facets_) { |
| 177 | const K::Triangle_3 triangle = triangulation_.triangle(hull_facet); |
| 178 | if (CGAL::orientation( |
| 179 | triangle[0], triangle[1], triangle[2], ray_segment.start()) == |
| 180 | K::Orientation::NEGATIVE) { |
| 181 | continue; |
| 182 | } |
| 183 | |
| 184 | if (!CGAL::do_intersect(ray_segment, triangle)) { |
| 185 | continue; |
| 186 | } |
| 187 | |
| 188 | intersections->push_back( |
| 189 | AFSRTriangulation::Facet(hull_facet.first, hull_facet.second)); |
| 190 | next_cell = hull_facet.first->neighbor(hull_facet.second); |
| 191 | next_cell_found = true; |
| 192 | break; |
| 193 | } |
| 194 | } else { |
| 195 | for (int i = 0; i < 4; ++i) { |
| 196 | const K::Triangle_3 triangle = triangulation_.triangle(next_cell, i); |
| 197 | if (CGAL::orientation( |
| 198 | triangle[0], triangle[1], triangle[2], ray_segment.start()) == |
| 199 | K::Orientation::NEGATIVE) { |
| 200 | continue; |
| 201 | } |
| 202 | |
| 203 | if (!CGAL::do_intersect(ray_segment, triangle)) { |
| 204 | continue; |
| 205 | } |
| 206 | |
| 207 | intersections->push_back(AFSRTriangulation::Facet(next_cell, i)); |
| 208 | next_cell = next_cell->neighbor(i); |
| 209 | next_cell_found = true; |
| 210 | break; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | private: |
| 217 | void FindHullFacets() { |