Computational geometry tools relative to points
More...
|
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.
|
|
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 )
|
|
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.
|
|
logical pure function | mod_cg2_points::cg2_are_points_collinear (p0, p1, p2) |
| Return .true. if the points p0 , p1 and p2 are collinear.
|
|
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 ].
|
|
double precision pure function | mod_cg2_points::cg2_perp_product (p0, p1) |
| Return the 2D cross product of two points.
|
|
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} .
|
|
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.
◆ 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,p2 | Any 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,p2 | Any 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,l1 | Two points defining a line |
[in] | p | Any 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,l1 | Two points defining a line |
[in] | p | Any 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,s1 | The two extreme points of a given line segment |
[in] | p | Any 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 ) |
◆ 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,p2 | The three ordered points defining a triangle |