Extension written in C++ intended to help finding sets with few r-holes.
Counts the r-holes in a point set.
This function counts how many convex r-holes are in points (the point set may be colored). It is an implementation of the algorithm presented in “Searching for Empty Convex Polygons” [1]
Parameters: | points : list
r : int
mono : boolean
|
---|---|
Returns: | h : int
|
Notes
The coordinates of the points should be less than or equal to \(2^{30}\) to prevent overflow on the C++ side.
Examples
The first call counts the empty quadrilaterals, disregarding the color of the points. The second call counts only monochromatic quadrilaterals.
>>> import holesCpp as holes
>>> points=[[0,2,0], [1,0,1], [2,4,0], [4,1,0], [4,3,0]]
>>> holes.count_convex_rholes(points, 4)
5
>>> holes.count_convex_rholes(points, 4, True)
1
Reports the r-holes in a point set.
This function reports how many convex r-holes are in points (the point set may be colored). It is an implementation of the algorithm presented in “Searching for Empty Convex Polygons”
Parameters: | points : list
r : int
mono : boolean
|
---|---|
Returns: | H : int
|
Notes
The coordinates of the points should be less than or equal to 2^30 to prevent overflow on the C++ side.
Counts the r-holes in a point set with certain point as vertex and the r-gons with only that point inside them.
This function counts how many convex r-holes in points have p as a vertex and how many convex r-gons in points have only p inside them. The point set may be colored. Point p must not be contained in points.
Parameters: | p : list
points : list
r : int
mono : boolean
|
---|---|
Returns: | (a, b) : tuple
|
Notes
The coordinates of the points should be less than or equal to 2^30 to prevent overflow on the C++ side. The point p must not be included in points.
Counts the number of empty triangles in points.
[1] | David Dobkin, Herbert Edelsbrunner, and Mark Overmars. “Searching for empty convex polygons”. Algorithmica, 5:561–571, 1990. |