curvey.edges¤
edges
¤
Edges
¤
A 'edge soup' of directed line segments defined by their vertex coordinates and connectivity
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
PointsLike
|
|
required |
edges |
EdgesLike | None
|
|
required |
point_data |
dict[str, ndarray] | None
|
Point data in key => value format. Values are |
None
|
edge_data |
dict[str, ndarray] | None
|
Edge data in key => value format. Values are |
None
|
Source code in src\curvey\edges.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
|
edge_data: MappingProxyType[str, ndarray]
property
¤
A read-only view of the edge data
edge_length: ndarray
cached
property
¤
A n_edges
length vector of edge lengths
edges: ndarray = asanyarray(edges) if edges is not None else zeros((0, 2), dtype='int')
instance-attribute
¤
(n, 2)
integer array of vertex indices.
n_edges: int
property
¤
Number of edges
n_points: int
property
¤
Number of vertices
This includes points not referenced by the edges array.
point_data: MappingProxyType[str, ndarray]
property
¤
A read-only view of the point data
points: ndarray = asanyarray(points)
instance-attribute
¤
(n, 2)
array of vertex coordinates.
shapely: shapely.MultiLineString
cached
property
¤
Representation of the edges as a `shapely.MultiLineString
tree: shapely.STRtree
cached
property
¤
A shapely.STRtree of edges for fast distance queries
closest_edge(points: PointsLike) -> tuple[ndarray, ndarray]
¤
The edge index and distance to the corresponding closest points to the input
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
PointsLike
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
edge_idx |
ndarray
|
|
distance |
ndarray
|
|
Source code in src\curvey\edges.py
closest_point(points: ndarray)
¤
The closest points on the closest edge
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
edge_idx |
|
|
distance |
|
|
closest |
|
Source code in src\curvey\edges.py
concatenate(*es: Self) -> Self
classmethod
¤
Concatenate multiple edge sets into one
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*es |
Self
|
Multiple |
()
|
Source code in src\curvey\edges.py
drop_degenerate_edges() -> Self
¤
drop_edges() -> Self
¤
drop_unreferenced_verts() -> Self
¤
Drop points that aren't referenced by the edge array
Source code in src\curvey\edges.py
edge_labels(labels: Iterable[str] | None = None, ax: Axes | None = None, clip=True, **kwargs) -> list[Text]
¤
Draw labels on edge midpoints
Source code in src\curvey\edges.py
empty() -> Self
classmethod
¤
plot_edges(**kwargs) -> LineCollection | Quiver
¤
Plot edges
See curvey.plot.segments
for additional kwargs descriptions.
plot_points(color: str | ndarray | Any | None = None, size: str | ndarray | float | None = None, scale_sz: tuple[float, float] | None = None, ax: Axes | None = None, **kwargs) -> PathCollection
¤
Plot a scalar quantity on vertices
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color |
str | ndarray | Any | None
|
If a string, assumed to be a name of a |
None
|
size |
str | ndarray | float | None
|
Name of a |
None
|
scale_sz |
tuple[float, float] | None
|
Min and max sizes to scale the vertex quantity |
None
|
ax |
Axes | None
|
Matplotlib axes to plot in. Defaults to the current axes. |
None
|
**kwargs |
additional kwargs passed to |
{}
|
Source code in src\curvey\edges.py
point_labels(labels: Iterable[str] | None = None, ax: Axes | None = None, clip=True, **kwargs) -> list[Text]
¤
Draw labels on points
reverse() -> Edges
¤
to_csgraph(weighted=True, directed=True) -> scipy.sparse.coo_array
¤
Vertex adjacency array for use with scipy's sparse groph routines
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weighted |
If true, edge weights are set to inverse edge lengths. Otherwise, edge weights are
set to |
True
|
|
directed |
If true, the adjacency matrix |
True
|
Returns:
Name | Type | Description |
---|---|---|
adj |
coo_array
|
A |
Source code in src\curvey\edges.py
triangulate(max_tri_area: float | None = None, min_angle: float | None = None, polygon: bool = False, holes: ndarray | None = None, interior_points: ndarray | None = None, extra_params: str | None = None) -> Triangulation
¤
Triangulate the polygon enclosed by the edges with Jonathan Shewchuck's
triangle
library.
The python bindings triangle must be importable.
They can be installed with pip install triangle
.
Note
This assumes, but does not enforce, no repeated points. triangle
will often segfault
with repeated points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
polygon |
bool
|
If true, perform constrained polygon triangulation. This is equivalent
to including |
False
|
max_tri_area |
float | None
|
A global maximum triangle area constraint. |
None
|
min_angle |
float | None
|
Minimum angle constraint, in degrees. |
None
|
holes |
ndarray | None
|
If this edge set includes edges clockwise bounding an exterior hole, specify a point interior to that hole to discard triangles inside that hole. |
None
|
interior_points |
ndarray | None
|
Additional vertex constraints in addition to |
None
|
extra_params |
str | None
|
See the API documentation. E.g. `extra_params='S10X' specifies a maximum number of 10 Steiner points and suppresses exact arithmetic. |
None
|
Source code in src\curvey\edges.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
|
with_(points: ndarray | None = None, edges: ndarray | None = None, point_data: dict[str, ndarray] | None = None, edge_data: dict[str, ndarray] | None = None) -> Self
¤
Copy of self replacing some subset of properties
Source code in src\curvey\edges.py
with_edge_data(**kwargs) -> Self
¤
Attach edge data in key=value format
Values must be (n_edges,)
or (n_edges, n_dims)
arrays, or a scalar value, in which
case the scalar is broadcast to a (n_edges,)
array.
Source code in src\curvey\edges.py
with_point_data(**kwargs) -> Self
¤
Attach point data in key=value format
Values must be (n_points,)
or (n_points, n_dims)
arrays, or a scalar value, in which
case the scalar is broadcast to a (n_points,)
array.