Skip to main content

Edge extraction for triangle meshes

Project description

fast-edges-extraction

Cython implementation of edges extraction from triangles as well as adjacency information (edge degrees and adjacent points/triangles for manifold and boundary edges).

pip install fast-edges-extraction

Example

  • Extract the edges from the triangles
from fast_edges_extraction import extract_edges

triangles = [
    [0, 1, 2],
    [1, 2, 3],
]

edges = extract_edges(triangles)
print(edges)

Out:

[[0 1]
 [0 2]
 [1 2]
 [1 3]
 [2 3]]
  • Also extract adjacency information
# Extract edges, degrees, and adjacency information (triangles and points)
edges, degrees, t_a, p_a = extract_edges(triangles, return_adjacency=True)

# Extract manifold (2 adjacent triangles) and boundary (1 adjacent triangle) edges
manifold_edges = edges[degrees == 2]
boundary_edges = edges[degrees == 1]
other = edges[degrees > 2]

# For each manifold edge, extract the adjacent triangles and points
manifold_adjacent_triangles = t_a[degrees == 2]
manifold_adjacent_points = p_a[degrees == 2]

# For each boundary edge, extract the adjacent triangle and point
boundary_adjacent_triangles = t_a[degrees == 1][:, 0]
boundary_adjacent_points = p_a[degrees == 1][:, 0]

print("Number of manifold edges:", len(manifold_edges))
print("Number of boundary edges:", len(boundary_edges))
print("Number of other edges:", len(other))
print()

print("Manifold edges:\n---------------")

for i in range(len(manifold_edges)):

    adjacent_triangles_indices = manifold_adjacent_triangles[i]
    adjacent_points_indices = manifold_adjacent_points[i]

    adjacent_triangles = [triangles[i] for i in adjacent_triangles_indices]

    print(f"Edge {manifold_edges[i]}, ", end="")
    print(f"adjacent triangles: {adjacent_triangles}, ", end="")
    print(f"adjacent points: {adjacent_points_indices}")

print("\nBoundary edges:\n---------------")

for i in range(len(boundary_edges)):

    adjacent_triangle_indice = boundary_adjacent_triangles[i]
    adjacent_point_indice = boundary_adjacent_points[i]
    adjacent_triangle = triangles[adjacent_triangle_indice]

    print(f"Edge {boundary_edges[i],}", end=" ")
    print(f"adjacent triangles: {adjacent_triangle},", end=" ")
    print(f"adjacent points: {adjacent_point_indice}")

Out:

Number of manifold edges: 1
Number of boundary edges: 4
Number of other edges: 0

Manifold edges:
---------------
Edge [1 2], adjacent triangles: [[0, 1, 2], [1, 2, 3]], adjacent points: [0 2]

Boundary edges:
---------------
Edge (array([0, 1]),) adjacent triangles: [0, 1, 2], adjacent points: 2
Edge (array([0, 2]),) adjacent triangles: [0, 1, 2], adjacent points: 1
Edge (array([1, 3]),) adjacent triangles: [1, 2, 3], adjacent points: 1
Edge (array([2, 3]),) adjacent triangles: [1, 2, 3], adjacent points: 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_edges_extraction-0.1.3.tar.gz (160.8 kB view details)

Uploaded Source

Built Distributions

fast_edges_extraction-0.1.3-cp312-cp312-win_amd64.whl (239.7 kB view details)

Uploaded CPython 3.12 Windows x86-64

fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (682.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (673.1 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

fast_edges_extraction-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (245.4 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

fast_edges_extraction-0.1.3-cp311-cp311-win_amd64.whl (241.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (683.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (678.2 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

fast_edges_extraction-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (245.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

fast_edges_extraction-0.1.3-cp310-cp310-win_amd64.whl (241.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (651.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (644.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

fast_edges_extraction-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (245.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

fast_edges_extraction-0.1.3-cp39-cp39-win_amd64.whl (241.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (653.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (647.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

fast_edges_extraction-0.1.3-cp39-cp39-macosx_11_0_arm64.whl (245.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file fast_edges_extraction-0.1.3.tar.gz.

File metadata

  • Download URL: fast_edges_extraction-0.1.3.tar.gz
  • Upload date:
  • Size: 160.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for fast_edges_extraction-0.1.3.tar.gz
Algorithm Hash digest
SHA256 43a6ad36139f220d8ecc2e81319f059af3352c826fda85698af911015fc4f46b
MD5 4954e7897b4986837052c94ead062707
BLAKE2b-256 cfdf7ac87d359db36400a3053c88248debb023430eea5eab896b13377cf5e1e5

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b202b592f1694f90fcffee1f29cff43cdd93551ba94f8c16e4a7bfc5a3c90326
MD5 1c1159d727d94af32575f24390b6d388
BLAKE2b-256 1438d8437308f2e40153e01b8e5e9f37b95f6fa43010ede713ade8e6eeb8a1ee

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab7a4314b3c5fafd0155fa0e7b8c309d3d680f4dd39419819f48e1b588d520b9
MD5 2b326736ca588af9693bbe46cf126179
BLAKE2b-256 756a317471ff3caeb724d079a3dff009c3b37267db37719cde33f10bdbea1a9f

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5ecefdbe2e305eb5c4975da2f6c683352b6914982f21fed429f6e02842d016a7
MD5 8ee77cc1aa0164333897ba426085bbd6
BLAKE2b-256 81e39e7ddb4d770c8ec6fe98319327ac7d81ca1f35e584711c8058023f9fc506

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ad13a65add8cd93ae761bb9867a040202015a19cce6c55c571b0900f89d3639
MD5 308057a22d37e9dfc9a0f68355f4a853
BLAKE2b-256 bb46bddb157704a89970804e77939774d738a23b1a4052a542f8bc00d2f2d620

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 58ccc89a48b471dfb01edf205a4ba87e1d583f2198ca4e8fe2a56565a63a4426
MD5 b80da6650f588948d490ba235304a834
BLAKE2b-256 d5e91f2d23d080054f59bbe5f0cd6210055148cf3f4c8455e48f27f3a4025be5

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e64a5e95c59ce1c45bb6ec440910aa57658776012c6db583cc78eae00113611e
MD5 736c7dc7f9149869fdebb747af41482e
BLAKE2b-256 e1ab5d8fdb1ebb7e2291c249e61887b38e39241493850956cfdaf685f0c07562

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a5ad0fee65dc42d1e08c8a6fad25bdf3e730d9d413112c22a09b91a7532ace48
MD5 f3ec296476bc03e3b0758280122dfec8
BLAKE2b-256 7326a8970b2ad192862f4a584a934eff2fe005ea9c70e5e6239662071353f8bb

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80893d139c79678e8e463bfb0cd0ab06ba1bea7b58bd006a1d575f1142f3ac6e
MD5 1c49d3b64d7c1c67c47b97d523156b5e
BLAKE2b-256 34524e74b4871f364949a930fc9717c1e9bc1ccfec2778f143887fb77a5ed6f2

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 deaa28ca7c135fd4374f82f2feb7faca9e040c30ff3a5efdcfdef22004221c41
MD5 08a957fa1ccbeedac14304a1b31a3983
BLAKE2b-256 9e5aacc756de62afe5823f5f033712a7d287b133cfe8d46d22f10f5097b8813c

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e3cccf46d2ceb6492b37a9e30872fc4dcbac0b8df28128a4b0d978453cafc08
MD5 d8ae4318f451808a7f9bf46648c464c3
BLAKE2b-256 3f7756e0981bddddd86feb659e42fb235bd9d9b91acb8e2c0baf6ec07780d8a9

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9ac2d95f61852c44ea81afdfb6af2e8ce951d3a07beafd179c6bb03ce1e394b3
MD5 0030882e83f61515277e365463b70358
BLAKE2b-256 49d3d4e92fed9eb918ccc75bee1cc39ab543e863b740e3e5608b2e6d4b8bdfce

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49a01931d929d60caf3566799027bb5621f5c24722281cb87039616570c08591
MD5 a890f5fb114ad856d8c7085a8d067b88
BLAKE2b-256 b375f28b542fd45daac55796108a45139cd5b9d333b1a5b085aa79308478e472

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 895cb3291a78e36ca319125ddace3d06a7f32cc089fd297003ab26a950dd1af5
MD5 64f1c294588bfab1ae4df545e81e9ba2
BLAKE2b-256 ba7ba20db8eeccbd77ab65ea9f74c1e1713e41b439c5d7200adb012229ed4f27

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc6c60092e12b65baa9764ee15f542b773a8d4afe3217cd81201d2401ce23d22
MD5 27c30c0addc758b83dbb2ae5be6e90ba
BLAKE2b-256 6f93495a260de43c6e14ed4919453dd7e53fe69740673ea65e8a260accf0677b

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 53670a5ae6defa2be724a3373b9f7baadccf0e8af74f4e3e6d7c8bcbf7b96cc3
MD5 2f916b650c8feade89ec107637b0573c
BLAKE2b-256 adfa6f69aa164d4733f12384907503c78afd643e5823978dc73125a968bbd253

See more details on using hashes here.

File details

Details for the file fast_edges_extraction-0.1.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_edges_extraction-0.1.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44832e4c3d03f138658a2a57adb55a7737a40f788c9520eed275fc71707a16ae
MD5 495f3c1b9d2a0c15531f053411bf14e9
BLAKE2b-256 f564cfe65ef49528b6f0309038818f92f61150c5bfce07229a33d7712265520a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page