mesh_tools

This file contains a selection of useful vector operations and mesh operations such as io, cleaning, converting etc. This file is imported by carto_mesh.

Functions

calcAvNormal(facets)

Calculates the average normal of a dataframe of triangles.

cleanMesh(pvmesh, tol[, iterations, print_si])

Uses built-in PyVista and PyMesh methods to clean the mesh.

cleanMesh_Meshtool(meshname[, threshold, ...])

Calls upon meshtool in a shell command to clean a mesh.

colorFromCsv([meshdir])

Makes mesh from VerticesSection.csv and TrianglesSection.csv Assigns tags in .mesh file as scalar data on this mesh Returns mesh with this scalar data.

convertMesh_Meshtool(meshname[, ifmt, ofmt])

Calls upon meshtool in a shell command to convert a mesh.

dist(co1, co2)

Calculates the distance between two coordinates.

getEdgeLengths(mesh)

Gets all edge lengths from a PyMesh mesh (used in homogenizeMesh())

getGroupIds([csvfile, col_name, skip])

Extract the tags from TrianglesSection.csv as generated by __cartoToCsv()

makeNonCollinear(pvmesh, edges)

Iterates mesh and replades points in the middle of two colinear edges.

makePyMesh(pvmesh)

Converts PyVista mesh to PyMesh mesh

makePyVista(pmmesh)

Converts PyMesh mesh to PyVista mesh (PolyData)

normalize(vector)

Normalizes a vector such that its length equals 1.

pmToPvFaces(pmfaces)

Given an array of pymesh triangles, where these triangles are arrays of the form [ind1, ind2, ind3], converts these faces to the PyVista representation of the form [3, ind1_0, ind2_0, ind3_0, 3, ind1_1, ind2_1, ind3_1, 3 ...]

ptsToParaview(filename[, column_name])

Takes a pts file, adds point ID as extra data to each point, writes out to csv file.

pvToPmCells(pyvistafaces)

Given an array of pyvista faces, converts these faces to the Pymesh representation.

pvToPmFaces(pyvistafaces)

Given an array of pyvista triangles, converts these faces to the PyMesh representation.

writeToSmesh(mesh, name)

Writes out a .smesh file with a hole in the middle.