network_find_cycles does not find faces in Mesh.from_lines()
See original GitHub issueHi, I’m trying to create a mesh from a network. However, it doesn’t work how I would like it to:
This is my network: This is how I would like it to be meshed: But this is what I get:
It seems like the network_find_cycles(network) is not functional?
import os
from compas.datastructures import Network
from compas.datastructures.mesh._mesh import Mesh
# ==============================================================================
# Paths
# ==============================================================================
HERE = os.path.dirname(__file__)
DATA = os.path.abspath(os.path.join(HERE, '..', 'data'))
FILE_I = os.path.join(DATA, 'ccf_3d.json')
# ==============================================================================
# Network to Mesh
# ==============================================================================
network = Network.from_json(FILE_I)
# lines = network.to_lines()
# mesh = Mesh.from_lines(lines, delete_boundary_face=True)
# ==============================================================================
# test the definition
# ==============================================================================
from compas.datastructures import network_find_cycles
vertices = network.to_points()
faces = network_find_cycles(network)
**# the faces are not found properly**:
**# the output is: [[13, 7, 12, 19, 20, 3, 29, 9, 32, 11, 17, 30, 15, 8, 0, 21, 14, 1, 23, 25, 31, 16, 13], [0, 8, 17, 6, 27, 30, 17, 8, 15, 30, 27, 6, 24, 5, 4, 22, 18, 10, 26, 28, 2, 7, 13, 16, 12, 7, 2, 28, 12, 16, 31, 19, 26, 10, 20, 25, 23, 3, 18, 22, 29, 3, 23, 1, 29, 22, 4, 9, 29, 1, 14, 9, 4, 5, 32, 9, 14, 21, 32, 5, 24, 11, 32, 21, 0], [0, 11, 24, 6, 17, 11, 0], [18, 3, 20, 10, 18], [12, 28, 26, 19, 12], [20, 19, 31, 25, 20]]
# but it should be a regular quad mesh**
mesh = Mesh.from_vertices_and_faces(vertices, faces)
mesh.delete_face(0)
mesh.cull_vertices()
# ==============================================================================
# Visualisation
# ==============================================================================
from compas_rhino.artists import NetworkArtist
from compas_rhino.artists import MeshArtist
artist = NetworkArtist(network, layer="Network")
artist.clear_layer()
artist.draw()
artist = MeshArtist(mesh, layer="Mesh")
artist.clear_layer()
artist.draw()
Many thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Given a mesh face, find its neighboring faces
I know that each face in geometry.faces contains members a,b,c that are indices into geometry.vertices. I don't believe the reverse information is stored, ......
Read more >Build an Amazon Rekognition collection and find faces in it ...
Create an Amazon Rekognition collection. Add images to the collection and detect faces in it. Search the collection for faces that match a...
Read more >MediaPipe Face Mesh - Google
MediaPipe Face Mesh is a solution that estimates 468 3D face landmarks in real-time even on mobile devices. It employs machine learning (ML)...
Read more >Class ProBuilderMesh | Package Manager UI website
Meshes are composed of vertices and faces. Faces primarily contain triangles and material information. With these components, ProBuilder will compile a mesh ......
Read more >Face mesh detection NEW | ML Kit
Recognize and locate faces Get the bounding box for detected faces in a selfie-like picture. Get face mesh information Get the 468 3D...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
more complicated and a bit slower, but yes…
also you can modify the face finding algorithm to only take the local neighbourhood of a node into account instead of the global geometry…