0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_poly::inpoly Interface Reference

Determination point of polygon. More...

Public Member Functions

subroutine inpoly_sp (p, coord, erg)
 Determination point of polygon.
 
subroutine inpoly_dp (p, coord, erg)
 Determination point of polygon.
 

Detailed Description

Determination point of polygon.

Determines whether a 2D point is inside, outside or on vertex of a polygon (2D, convex or not).

The original version of the source code (pnpoly) was implemented by W. Randolph Franklin. It was insufficiently assigning vertex/edge points.

Example

polygon(:,1) = (/ 1.0_dp,2.0_dp,2.0_dp,1.0_dp /)
polygon(:,2) = (/ 1.0_dp,1.0_dp,2.0_dp,2.0_dp /)
point = (/ 1.5, 1.5 /)
call inpoly( point, polygon, inside )
! --> inside = 1 ... point is inside the polygon

See also example in test directory

Literature

  1. https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
Returns
Whether point is inside (=1), outside (=-1) or on a vertex/edge of the polygon (=0)
Parameters
[in]ppoint in question
[in]coordcoordinates of the polygon
[out]ergresult: inside: erg = 1 outside: erg = -1 on vertex/edge: erg = 0

Definition at line 47 of file mo_poly.f90.

Member Function/Subroutine Documentation

◆ inpoly_dp()

subroutine mo_poly::inpoly::inpoly_dp ( real(dp), dimension(2), intent(in)  p,
real(dp), dimension(:, :), intent(in)  coord,
integer(i4), intent(out)  erg 
)

Determination point of polygon.

Determines whether a 2D point is inside, outside or on vertex of a polygon (2D, convex or not).

The original version of the source code (pnpoly) was implemented by W. Randolph Franklin. It was insufficiently assigning vertex/edge points.

Example

polygon(:,1) = (/ 1.0_dp,2.0_dp,2.0_dp,1.0_dp /)
polygon(:,2) = (/ 1.0_dp,1.0_dp,2.0_dp,2.0_dp /)
point = (/ 1.5, 1.5 /)
call inpoly( point, polygon, inside )
! --> inside = 1 ... point is inside the polygon

See also example in test directory

Literature

  1. https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
Returns
Whether point is inside (=1), outside (=-1) or on a vertex/edge of the polygon (=0)
Parameters
[in]ppoint in question
[in]coordcoordinates of the polygon
[out]ergresult: inside: erg = 1 outside: erg = -1 on vertex/edge: erg = 0

Definition at line 607 of file mo_poly.f90.

◆ inpoly_sp()

subroutine mo_poly::inpoly::inpoly_sp ( real(sp), dimension(2), intent(in)  p,
real(sp), dimension(:, :), intent(in)  coord,
integer(i4), intent(out)  erg 
)

Determination point of polygon.

Determines whether a 2D point is inside, outside or on vertex of a polygon (2D, convex or not).

The original version of the source code (pnpoly) was implemented by W. Randolph Franklin. It was insufficiently assigning vertex/edge points.

Example

polygon(:,1) = (/ 1.0_dp,2.0_dp,2.0_dp,1.0_dp /)
polygon(:,2) = (/ 1.0_dp,1.0_dp,2.0_dp,2.0_dp /)
point = (/ 1.5, 1.5 /)
call inpoly( point, polygon, inside )
! --> inside = 1 ... point is inside the polygon

See also example in test directory

Literature

  1. https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
Returns
Whether point is inside (=1), outside (=-1) or on a vertex/edge of the polygon (=0)
Parameters
[in]ppoint in question
[in]coordcoordinates of the polygon
[out]ergresult: inside: erg = 1 outside: erg = -1 on vertex/edge: erg = 0

Definition at line 232 of file mo_poly.f90.


The documentation for this interface was generated from the following file: