version 0.6.0

Functions/Subroutines

logical pure function mod_cg2_points::cg2_are_counterclockwise (p0, p1, p2)
 Return .true. if the points {p0, p1, p2} are defined in counterclockwise order. More...
 
logical pure function mod_cg2_points::cg2_is_point_left_of_line (l0, l1, p)
 Return .true. if point p is on the left side of the line (l0, l1) More...
 
logical pure function mod_cg2_points::cg2_is_point_left_of_or_on_line (l0, l1, p)
 Return .true. if point p is on the left side of the line (l0,l1) or on the line. More...
 
logical pure function mod_cg2_points::cg2_are_points_collinear (p0, p1, p2)
 Return .true. if the points p0, p1 and p2 are collinear. More...
 
logical pure function mod_cg2_points::cg2_is_point_on_segment (s0, s1, p)
 Return .true. if the point p is on the line segment [s0, s1]. More...
 
double precision pure function mod_cg2_points::cg2_perp_product (p0, p1)
 Return the 2D cross product of two points. More...
 
double precision pure function mod_cg2_points::cg2_triangle_double_area (p0, p1, p2)
 Return twice the signed area of the triangle {p0, p1, p2}. More...
 

Detailed Description

This module defines various functions to detect the relative position of many points from each other.

Attention
Modify these functions at your own risk. Many algorithms depend on the specific behaviour of these functions. They are designed to not generate false negative results. Note that false positive results may occur due to the finite representation of real numbers. Take that into consideration when writing new algorithms.

Function/Subroutine Documentation

◆ cg2_are_counterclockwise()

logical pure function mod_cg2_points::cg2_are_counterclockwise ( double precision, dimension(2), intent(in)  p0,
double precision, dimension(2), intent(in)  p1,
double precision, dimension(2), intent(in)  p2 
)
Parameters
[in]p0,p1,p2Any given points

◆ cg2_are_points_collinear()

logical pure function mod_cg2_points::cg2_are_points_collinear ( double precision, dimension(2), intent(in)  p0,
double precision, dimension(2), intent(in)  p1,
double precision, dimension(2), intent(in)  p2 
)
Parameters
[in]p0,p1,p2Any given point

◆ cg2_is_point_left_of_line()

logical pure function mod_cg2_points::cg2_is_point_left_of_line ( double precision, dimension(2), intent(in)  l0,
double precision, dimension(2), intent(in)  l1,
double precision, dimension(2), intent(in)  p 
)
Parameters
[in]l0,l1Two points defining a line
[in]pAny given point

◆ cg2_is_point_left_of_or_on_line()

logical pure function mod_cg2_points::cg2_is_point_left_of_or_on_line ( double precision, dimension(2), intent(in)  l0,
double precision, dimension(2), intent(in)  l1,
double precision, dimension(2), intent(in)  p 
)
Parameters
[in]l0,l1Two points defining a line
[in]pAny given point

◆ cg2_is_point_on_segment()

logical pure function mod_cg2_points::cg2_is_point_on_segment ( double precision, dimension(2), intent(in)  s0,
double precision, dimension(2), intent(in)  s1,
double precision, dimension(2), intent(in)  p 
)
Parameters
[in]s0,s1The two extreme points of a given line segment
[in]pAny given point

◆ cg2_perp_product()

double precision pure function mod_cg2_points::cg2_perp_product ( double precision, dimension(2), intent(in)  p0,
double precision, dimension(2), intent(in)  p1 
)
Parameters
p0,p1Any given points

◆ cg2_triangle_double_area()

double precision pure function mod_cg2_points::cg2_triangle_double_area ( double precision, dimension(2), intent(in)  p0,
double precision, dimension(2), intent(in)  p1,
double precision, dimension(2), intent(in)  p2 
)
Attention
The area of {p0, p1, p2} is of the opposite sign of the area of any non-circular permutation of these points.
Parameters
[in]p0,p1,p2The three ordered points defining a triangle