fortplot_segment_clip Module

Clip device-space line segments to a rectangle before they are drawn. Backends call this so that data far outside the visible area (e.g. y ~ 1e21 under a small ylim) cost work proportional to what is seen.



Subroutines

public pure subroutine clip_segment(px1, py1, px2, py2, lo, hi, x0, y0, x1, y1, t_start, visible)

Liang-Barsky clip of (px1,py1)-(px2,py2) to [lo(1),hi(1)] x [lo(2),hi(2)]. A clipped end is placed exactly on the edge it crosses; t_start is the segment parameter of (x0, y0).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: px1
real(kind=wp), intent(in) :: py1
real(kind=wp), intent(in) :: px2
real(kind=wp), intent(in) :: py2
real(kind=wp), intent(in) :: lo(2)
real(kind=wp), intent(in) :: hi(2)
real(kind=wp), intent(out) :: x0
real(kind=wp), intent(out) :: y0
real(kind=wp), intent(out) :: x1
real(kind=wp), intent(out) :: y1
real(kind=wp), intent(out) :: t_start
logical, intent(out) :: visible