🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

tetgenpy

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tetgenpy

tetgen python wrapper for points, PLCs and tetmesh inputs

0.1.0
95

Supply Chain Security

100

Vulnerability

100

Quality

100

Maintenance

70

License

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Shell access

Supply chain risk

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Found 1 instance in 1 package

Uses eval

Supply chain risk

Package uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.

Found 1 instance in 1 package

Maintainers
1

tetgenpy

main PyPI version

tetgenpy is a python wrapper for Hang Si's TetGen - A Quality Tetrahedral Mesh Generator and a 3D Delaunay Triangulator. It helps to prepare various types of inputs - points, piecewise linear complexes (PLCs), and tetmesh - for tetrahedron mesh generation based on simple python types, such as list and numpy.ndarray.

Install

pip install tetgenpy

For current development version,

pip install git+https://github.com/tataratat/tetgenpy.git@main

Quick Start

Following is an example for tetrahedralization of a unit cube defined as PLCs. Alternatively, you could also use tetgenpy.PLC class to prepare TetgenIO.

import tetgenpy
import numpy as np

# tetrahedralize unit cube
# define points
points=[
    [0.0, 0.0, 0.0],
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0],
    [1.0, 1.0, 0.0],
    [0.0, 0.0, 1.0],
    [1.0, 0.0, 1.0],
    [0.0, 1.0, 1.0],
    [1.0, 1.0, 1.0],
]

# define facets - it can be list of polygons.
# here, they are hexa faces
facets = [
    [1, 0, 2, 3],
    [0, 1, 5, 4],
    [2, 0, 4, 6],
    [1, 3, 7, 5],
    [3, 2, 6, 7],
    [4, 5, 7, 6],
]

# prepare TetgenIO - input for tetgen
tetgen_in = tetgenpy.TetgenIO()

# set points, facets, and facet_markers.
# facet_markers can be useful for setting boundary conditions
tetgen_in.setup_plc(
    points=points,
    facets=facets,
    facet_markers=[[i] for i in range(1, len(facets) + 1)],
)

# tetgen's tetraheralize function with switches
tetgen_out = tetgenpy.tetrahedralize("qa.05", tetgen_in)

# unpack output
print(tetgen_out.points())
print(tetgen_out.tetrahedra())
print(tetgen_out.trifaces())
print(tetgen_out.trifacemarkers())

This package also provides access to tetgen's binary executable. Try:

$ tetgen -h

Working with vedo

vedo natively supports tetgenpy.TetgenIO types starting with version >=2023.5.1. It is A python module for scientific analysis and visualization of эd objects that can be used to enhance further workflows. You can find an example (same as above) here or simply try:

pip install vedo
vedo -r tetgen1

Contributing

Write an issue or create a pull request! A simple guideline can be found at CONTRIBUTING.md

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts