mymesh.tree#

Tree data structures and related methods. Tree structures are used to organize space into a hierarchy that makes it more efficient to search through them. This module currently includes an Octree data structure and its two dimensional analog the Quadtree.

These trees are based on uniform subdivision of an initial cube/square into eight/four smaller cubes/squares. The main principal is that if you know an entity (point, triangle, etc.) isn’t in a particular node of the tree, you know it’s not in any of the branches of that node and they don’t need to be searched. This can lead to significant efficiency improvements in a variety of operations, for example if searching for intersections between a ray and a surface mesh (mymesh.rays.RaySurfIntersection()), by testing for intersections between a ray and the cube represented by an octree node, you can eliminate the need to test for intersections between the ray and any of the triangles within that node.

Tree#

TreeNode([parent, data, level, state])

Tree Utilities#

Print(root[, show_empty])

Prints a formatted list of all nodes in the tree.

getAllLeaf(root[, include_empty])

Retrieve a list of all leaf nodes of the tree

Quadtree#

QuadtreeNode(centroid, size[, parent, data, ...])

Quadtree Creation#

Points2Quadtree(Points[, maxdepth])

Generate an quadtree structure from a set of points.

Edges2Quadtree(NodeCoords, LineConn[, ...])

Generate an octree representation of a line mesh.

Conversion From Quadtree#

Quadtree2Pixel(root[, sparse])

Convert an quadtree to a pixel mesh

Quadtree2Dual(root[, method])

Converts an quadtree to a mesh that is dual to the quadtree structure.

Octree#

OctreeNode(centroid, size[, parent, data, ...])

Octree Creation#

Points2Octree(Points[, maxdepth])

Generate an octree structure from a set of points.

Function2Octree(func, bounds[, threshold, ...])

Generate an octree structure adapted to an implicit function.

Surface2Octree(NodeCoords, SurfConn[, ...])

Generate an octree representation of a triangular surface mesh.

Voxel2Octree(VoxelCoords, VoxelConn[, maxdepth])

Generate an octree representation of an isotropic voxel mesh.

Conversion From Octree#

Octree2Voxel(root[, sparse])

Convert an octree to a voxel mesh

Octree2Dual(root[, method])

Converts an octree to a mesh that is dual to the octree structure.

Octree Querying#

SearchOctree(pt, root)

Retrieve the octree leaf node that contains the given point.

SearchOctreeTri(tri, root[, inclusive])

Retrieve the octree leaf node(s) that contain the triangle