Skip to content

surface_graph

SurfaceGraph

Class for building graph from surface points.

__init__()

add_geodesic_distance_array(polydata, sources, max_distance=None, name='GeodesicDistance') staticmethod

Add geodesic distance values computed from sources.

Parameters:

Name Type Description Default
polydata vtkPolyData

Polydata containing surface triangles

required
sources ndarray[N]

Indexes of the points.

required
max_distance None

Maximum distance for geodesic computation. Defaults to None.

None
name str

Name of the new array. Defaults to "GeodesicDistance".

'GeodesicDistance'

Returns:

Name Type Description
vtkPolyData vtkPolyData

Surface polydata with geodesic distance array.

build_voronoi_neighbors(points, point_ids, vertices, triangles) staticmethod

Build connection between neighbor points on the surface.

This function takes in the coordinates of the points on the surface, their corresponding indices, the coordinates of the surface points, and the triangle vertices. It builds connections between neighboring points on the surface using Voronoi diagrams.

Parameters:

Name Type Description Default
points ndarray[N, 3]

Coordinates of the points on the surface.

required
point_ids ndarray[N]

Indices of the points on the surface.

required
vertices ndarray[M, 3]

Coordinates of the surface points.

required
triangles ndarray[K, 3]

Triangle vertices.

required

Returns:

Type Description
ndarray

np.ndarray[L, 2]: Connection pairs representing the connections between neighboring points on the surface.

shortest_path(polydata, source, target) staticmethod

Find shortest path between source and target points on surface.

This function uses Dijkstra's algorithm to find the shortest path between two points on a surface represented by polydata.

Parameters:

Name Type Description Default
polydata vtkPolyData

Surface polydata.

required
source int

Source point id.

required
target int

Target point id.

required

Returns:

Type Description
ndarray

np.ndarray: A list of point ids forming the path.

vtkIdList_to_numpy(vtk_id_list)

Extract Ids from vtkIdList.

Parameters:

Name Type Description Default
vtk_id_list vtkIdList

Id of the points or cells.

required

Returns:

Name Type Description
out list

List of Ids.