|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Geometric utilities for 2D points and segments. More...
Go to the source code of this file.
Functions | |
| const Geom_Number | area_of_parallelogram (const Point &a, const Point &b, const Point &c) |
| Compute signed area of parallelogram formed by three points. | |
| const Geom_Number | area_of_triangle (const Point &a, const Point &b, const Point &c) |
| Compute area of triangle formed by three points. | |
| const bool | points_are_colinear (const Point &a, const Point &b, const Point &c) |
| Test if three points are collinear. | |
| const bool | c_is_to_left_ (const Point &a, const Point &b, const Point &c) |
| Test if point c is strictly left of line a→b. | |
| const bool | is_clockwise (const Point &a, const Point &b, const Point &c) |
| Test if points are in clockwise order. | |
| const bool | left_on (const Point &a, const Point &b, const Point &c) |
| Test if point c is left of or on line a→b. | |
| const bool | proper_intersection (const Point &a, const Point &b, const Point &c, const Point &d) |
| Test for proper segment intersection. | |
| const bool | between (const Point &a, const Point &b, const Point &c) |
| Test if point c is between points a and b. | |
| const bool | intersect_improp (const Point &a, const Point &b, const Point &c, const Point &d) |
| Test for improper (endpoint) segment intersection. | |
| const bool | intersectp (const Point &a, const Point &b, const Point &c, const Point &d) |
| Test if two segments intersect (proper or improper). | |
| int | read_pixels (ifstream &in) |
| Read integer from input stream (pixel coordinates). | |
Geometric utilities for 2D points and segments.
This file provides functions for computational geometry operations including area calculations, collinearity tests, orientation tests, and segment intersection detection.
| Function | Description |
|---|---|
| area_of_parallelogram | Signed area of parallelogram |
| area_of_triangle | Triangle area |
| points_are_colinear | Collinearity test |
| left_on | Left-of-line test |
| intersectp | Segment intersection |
Definition in file point_utils.H.
|
inline |
Compute signed area of parallelogram formed by three points.
Uses cross product to compute 2x the signed area of triangle abc. The sign indicates orientation:
| a | First point |
| b | Second point |
| c | Third point |
Definition at line 74 of file point_utils.H.
References Point::get_x(), and Point::get_y().
Referenced by area_of_triangle(), and points_are_colinear().
|
inline |
Compute area of triangle formed by three points.
| a | First vertex |
| b | Second vertex |
| c | Third vertex |
Definition at line 90 of file point_utils.H.
References area_of_parallelogram().
Test if point c is between points a and b.
Assumes a, b, c are collinear.
| a | First endpoint |
| b | Second endpoint |
| c | Point to test |
Definition at line 190 of file point_utils.H.
References Point::get_x(), and Point::get_y().
Referenced by intersect_improp(), and TEST_F().
Test if point c is strictly left of line a→b.
| a | First point of line |
| b | Second point of line |
| c | Point to test |
Definition at line 122 of file point_utils.H.
Test for improper (endpoint) segment intersection.
Segments intersect improperly if an endpoint of one lies on the other segment.
| a | First endpoint of segment 1 |
| b | Second endpoint of segment 1 |
| c | First endpoint of segment 2 |
| d | Second endpoint of segment 2 |
Definition at line 217 of file point_utils.H.
References between().
Referenced by intersectp().
Test if two segments intersect (proper or improper).
Returns true if segments ab and cd intersect at any point.
| a | First endpoint of segment 1 |
| b | Second endpoint of segment 1 |
| c | First endpoint of segment 2 |
| d | Second endpoint of segment 2 |
Definition at line 240 of file point_utils.H.
References intersect_improp().
Test if points are in clockwise order.
| a | First point |
| b | Second point |
| c | Third point |
Definition at line 135 of file point_utils.H.
Test if point c is left of or on line a→b.
| a | First point of line |
| b | Second point of line |
| c | Point to test |
Definition at line 150 of file point_utils.H.
Test if three points are collinear.
Three points are collinear if they lie on the same line.
| a | First point |
| b | Second point |
| c | Third point |
Definition at line 107 of file point_utils.H.
References area_of_parallelogram().
| const bool proper_intersection | ( | const Point & | a, |
| const Point & | b, | ||
| const Point & | c, | ||
| const Point & | d | ||
| ) |
Test for proper segment intersection.
Two segments intersect properly if they cross each other's interior (not at endpoints).
| a | First endpoint of segment 1 |
| b | Second endpoint of segment 1 |
| c | First endpoint of segment 2 |
| d | Second endpoint of segment 2 |
Definition at line 167 of file point_utils.H.
| int read_pixels | ( | ifstream & | in | ) |
Read integer from input stream (pixel coordinates).
Helper function for reading image data.
| in | Input file stream |
Definition at line 260 of file point_utils.H.