| 503 | } |
| 504 | |
| 505 | IntersectionResult< Point2D > segment_line_intersection( |
| 506 | const Segment2D& segment, const InfiniteLine2D& line ) |
| 507 | { |
| 508 | auto line_intersection_result = |
| 509 | line_line_intersection( InfiniteLine2D{ segment }, line ); |
| 510 | if( line_intersection_result ) |
| 511 | { |
| 512 | // Test whether the line-line intersection is on the segment. |
| 513 | if( point_segment_distance( |
| 514 | line_intersection_result.result.value(), segment ) |
| 515 | > GLOBAL_EPSILON ) |
| 516 | { |
| 517 | return { INTERSECTION_TYPE::none }; |
| 518 | } |
| 519 | const auto lambdas = safe_segment_barycentric_coordinates( |
| 520 | line_intersection_result.result.value(), segment ); |
| 521 | line_intersection_result.correctness->first.second = |
| 522 | segment.vertices()[0].get() * lambdas[0] |
| 523 | + segment.vertices()[1].get() * lambdas[1]; |
| 524 | return line_intersection_result; |
| 525 | } |
| 526 | return line_intersection_result.type; |
| 527 | } |
| 528 | |
| 529 | IntersectionResult< absl::InlinedVector< Point3D, 2 > > |
| 530 | opengeode_geometry_api line_cylinder_intersection( |