Skip to main content

3D mesh to graph

Project description

Intro

This project is born to easily conduct static analysis on 3D mesh geometries. Meshgraph allows you to convert 3D objects into graphs and thus perform algorithms on them.

How to use Meshgraph

Install

Install the meshgraph package using:

python3 -m pip install meshgraph

Convert .obj to Graph

Load a .obj file and convert it to a graph using:

from meshgraph import ObjLoader

graph = ObjLoader.load_graph_from_file(path_to_obj_file)

or use a local string:

graph = ObjLoader.load_graph_from_string(obj_string)

Nodes

Nodes can be accessed using:

from meshgraph.Node import Node
#...
graph_nodes = graph.nodes
#Accessing by index:
node0 = graph.nodes[0]
#Or using the accessor function:
node1 = graph.get_node(1)

Access a node's position using:

print(node0.pos)

Get a distance between two nodes node0 and node1 using:

distance = node0.distance(node1)

Access the neighbors of a node using:

node0.neighbors

Copyright

Copyright(c) 2022 Sebastiano Campisi - ianovir.com. Read the LICENSE file for more details.

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

meshgraph-1.0.0.tar.gz (13.1 kB view hashes)

Uploaded Source

Built Distribution

meshgraph-1.0.0-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

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