intersects Subroutine

public subroutine intersects(x1, x2, x3, x4, y1, y2, y3, y4, s, t)

intersects

Calculate the intersection between two line segments.

Description

This subroutine calculates the intersection point of two line segments defined by their endpoints (x1, y1) to (x2, y2) and (x3, y3) to (x4, y4). If the segments intersect, the parameters s and t will contain the normalized distances along each segment to the intersection point. The intersection point can be calculated as: If the segments do not intersect, s and t will be outside the range [0, 1].

Examples


References

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: x1
real(kind=pr), intent(in) :: x2
real(kind=pr), intent(in) :: x3
real(kind=pr), intent(in) :: x4
real(kind=pr), intent(in) :: y1
real(kind=pr), intent(in) :: y2
real(kind=pr), intent(in) :: y3
real(kind=pr), intent(in) :: y4
real(kind=pr), intent(out) :: s
real(kind=pr), intent(out) :: t

Calls

proc~~intersects~~CallsGraph proc~intersects intersects proc~solve_system solve_system proc~intersects->proc~solve_system none~dgesv dgesv proc~solve_system->none~dgesv

Called by

proc~~intersects~~CalledByGraph proc~intersects intersects proc~intersect_one_line intersect_one_line proc~intersect_one_line->proc~intersects

Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: A(2,2)
real(kind=pr), public :: b(2)
real(kind=pr), public :: tmp