If you want to test whether an infinite line A intersects a line segment B, this can be done using boost::geometry::strategy::side::side_by_triangle:
template <typename Point>
struct line
{
boost::geometry::model::segment<Point> segment;
};
template <typename Point>
bool intersects(line<Point> const& A, boost::geometry::model::segment<Point> const& B)
{
using side = boost::geometry::strategy::side::side_by_triangle<>;
auto const firstSide = side::apply(A.segment.first, A.segment.second, B.first);
auto const secondSide = side::apply(A.segment.first, A.segment.second, B.second);
return firstSide == 0 || secondSide == 0 || (firstSide < 0) != (secondSide < 0);
}
The line type simply represents a line using a segment that is part of that line, but as a separate type so it can be distinguished from a segment by the type system, for the purposes of overloading.
It first queries on which side of A the two endpoints (first and second) of B lie. Then, if either of firstSide or secondSide are zero, this means the corresponding endpoint is touching A, so intersects is true. Otherwise, intersects is true iff the endpoints are on opposite sides of A.