Fast 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).
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.tar.gz
(158.5 kB
view hashes)
Built Distributions
Close
Hashes for fast_edges_extraction-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f961fb5c52963a132bc5fa366733b349de52f7a3d9988156e17486c6b9a657ef |
|
MD5 | f39750ad323c6508083b73d25269f4f7 |
|
BLAKE2b-256 | f712251dce2b28cfc9fc4acdb8cec01be68a47cfeed91128c18fb9f45ac1492a |
Close
Hashes for fast_edges_extraction-0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e206e7c1a3044ca8990d8ea9c4db84ecdb82955ae482bec4346013eb05992cd |
|
MD5 | 2f3c3277bd088874f9bcacc30db29be9 |
|
BLAKE2b-256 | 4d8656104a5ffccc0d09d6b389d6382348a956bd6e3d00a4611a1e8fadb68764 |
Close
Hashes for fast_edges_extraction-0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a118ee9abff584d1723ca6f3d4c3564df592454bb635f34ca03f2e24e923dfe |
|
MD5 | 966e3a95e7cc77cec089d2d60d4a5bb0 |
|
BLAKE2b-256 | 92ca2663d077ed6e0c3fee21a26918f1f0a4348c00fa3f23e0b5c655ae1b660d |
Close
Hashes for fast_edges_extraction-0.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf762596230694e12e924f40a8c62761c366922b8a368c7fe0d515f915ca27b3 |
|
MD5 | 9dc95fb7a47105f985c0367236de4c4d |
|
BLAKE2b-256 | edd5a7befbbd3a307e234df2d2575145a338403a1397542bb3507673e587ada6 |
Close
Hashes for fast_edges_extraction-0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abb59c5af95df87761f866c3acf79bd2dd483f1f65c680745cb7e875fa8f9d28 |
|
MD5 | 16f3816fa1138543c278bb7694e9c337 |
|
BLAKE2b-256 | 2480eda307a0933805d735d097d0b7842d7bc143e4f576fcf73c43dafe2f2547 |
Close
Hashes for fast_edges_extraction-0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32ce75ce75df2a18e7257702e5a63c0a86b962f482be9b31b90c0b51af56c185 |
|
MD5 | da78c358542203e1884de902dbdefc2f |
|
BLAKE2b-256 | 199aff140dcb486087df5b13227f62238dab0a868d455b4195b4e0eab59e4fd5 |
Close
Hashes for fast_edges_extraction-0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a51540d001733e0bbb2bb57372312d3fc7c59ff61dbbd45e0588782eb82f1d1 |
|
MD5 | 0c5dcd822d0951aaa184c29fd42d8e94 |
|
BLAKE2b-256 | 2e5d4f98022062f49b33fd5a666305861dad1d16bf895892bddf3ba6405e77c2 |
Close
Hashes for fast_edges_extraction-0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4820e7bd49589a7eee646e80a47b19411423dfee0a8bfc9e0ef594c019d3d31e |
|
MD5 | 46a89624ceb62ebf1eac8097e14ae3ae |
|
BLAKE2b-256 | 40ba2e36b8758a9ce724a652b509d104b2bf62cd82d4bc2a227c180428e40036 |
Close
Hashes for fast_edges_extraction-0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c26a34915278b64fd2bd257d1195b304888ccb143d6079d4e51c6c71d58a47d |
|
MD5 | ed42d7cf1c72f7af0adf5b575b1947cb |
|
BLAKE2b-256 | 41efc6511ffa8743b5389182043d7bddff9d242a407603d660217ee0f0fc89a6 |
Close
Hashes for fast_edges_extraction-0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0470092b3957c34c2e3f518b317ca0405ecc2b96ba97f9666db98222d4afbee |
|
MD5 | 860246b995bc0011f27f8c7d12a928ac |
|
BLAKE2b-256 | cf1d6b7c1766fb86392192a58917d811cde24f7e3dafbcaa63fdcdbc1a786c5f |
Close
Hashes for fast_edges_extraction-0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af166cb6dd7c8d4b07632a27d8cc74428784f4ef093e4a8673b2841e4524d30 |
|
MD5 | f1548239d89af6a0657c1d8a5f89180b |
|
BLAKE2b-256 | 3c9ffb28b2d2141912ba67ef286337ff49df1b584a1c342c6cfda9ae1605baf5 |
Close
Hashes for fast_edges_extraction-0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 617ff4c55d93ce54a1f5e5cdb3cc708b536d09826172f21e8b174938c217da97 |
|
MD5 | dcbd4e5a6152ae6c6737582a4ce46c92 |
|
BLAKE2b-256 | b2e8e283ba65a8efa4981f6292444b7d48cd2c8a446a61ffb31d9b631eda9fcf |
Close
Hashes for fast_edges_extraction-0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc1dde1d74c4d4ffe71a103344cdf51351d44724618ed741d443d48e964e9805 |
|
MD5 | 6a78af46e44837449a35e744d0d83376 |
|
BLAKE2b-256 | e4211680a194f3d3121c0414c17fc78ac816160efecdd36dbe507a0ba3cef102 |
Close
Hashes for fast_edges_extraction-0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9011b03e50a91a20d502981f283f7a1c22e51fbad31ff1ecb179e4c22f9153 |
|
MD5 | 43c99438e3de814f907fd16dac1f0035 |
|
BLAKE2b-256 | 8edc344ee233827350828e4660c92bd459df99396641a9c3732c84b896f90f9f |
Close
Hashes for fast_edges_extraction-0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 550c0b07d1cb3cb61c0253794bc8f9aecd5be7b6e41e68eab047c1ace00cff46 |
|
MD5 | c8af3fcf9a75b32af52a20c471e47f53 |
|
BLAKE2b-256 | 0ceea44ddc1d985f75f6a4573d135d8feab7082781f36b18575f33d7f892dc39 |
Close
Hashes for fast_edges_extraction-0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4342ebf9258dbf3bc7fad3b7ea16834c2216c57f9d0531afaecff0d25103397 |
|
MD5 | a574251ad8f63ffc2216c0bb4e13113a |
|
BLAKE2b-256 | 4c8d9c1ff5bc2feb6bca4d54a56821af1d0801eac7a1182f2655f29bdc01d777 |