cds2.geometry
Computational geometry: hulls, distances, polygons and intersections.
Computational geometry: hulls, distances, polygons and intersections.
HullResult
dataclass
Convex hull of a 2-D point set.
Source code in src/cds2/geometry.py
31 32 33 34 35 36 | |
convex_hull(points)
Counter-clockwise convex hull of a 2-D point set via scipy.spatial.
Source code in src/cds2/geometry.py
47 48 49 50 51 52 53 54 55 | |
hull_area(points)
Area enclosed by the convex hull of a 2-D point set.
Source code in src/cds2/geometry.py
58 59 60 61 62 63 | |
point_cloud_distances(a, b=None)
Pairwise Euclidean distances; B defaults to A itself.
Source code in src/cds2/geometry.py
66 67 68 69 70 71 72 73 74 | |
closest_pair(points)
Indices and distance of the closest pair of distinct points.
Source code in src/cds2/geometry.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
point_in_polygon(point, polygon)
Ray-casting containment test for one point against a closed ring.
Source code in src/cds2/geometry.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
polygon_area(ring)
Unsigned shoelace area of a simple polygon.
Source code in src/cds2/geometry.py
122 123 124 125 126 127 128 129 130 | |
polygon_perimeter(ring)
Total edge length of a polygon ring (closing edge included).
Source code in src/cds2/geometry.py
133 134 135 136 137 | |
segments_intersect(segment_a, segment_b)
Orientation-based intersection test between two 2-D segments.
Source code in src/cds2/geometry.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
line_intersection(line_a, line_b)
Intersection point of two infinite lines through the given point pairs.
Source code in src/cds2/geometry.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
centroid(points)
Arithmetic mean position of a point set.
Source code in src/cds2/geometry.py
195 196 197 198 199 | |
rotate_points(points, angle_rad, pivot=None)
Rotate a 2-D point set by angle_rad around pivot (default origin).
Source code in src/cds2/geometry.py
202 203 204 205 206 207 208 209 210 211 212 213 | |