GeoDoodle
Geodesic distance computation for Blender meshes
Table of Contents
Overview
This addon provides an operator for computing geodesic distances on general meshes (ngons and triangular).
Geodesic distance describes a shortest path from any point on the surface to some boundary, e.g. a selected vertex. It can differ from simple Euclidian distance significantly.
Prerequisites
The addon uses the SciPy math library for efficient sparse matrix computations.
SciPy is not shipped with the Python installation in Blender, so you may need to install the package once. A convenient method is to use the text editor.
Note: You may need to run Blender in administrator mode for permissions to install into the packages folder!
-
Open Blender.
-
Open a text editor window and create a new text.
-
Paste in the following code and execute the script:
import sys import subprocess py_exec = sys.executable py_prefix = sys.exec_prefix # ensure pip is installed & update subprocess.call([str(py_exec), "-m", "ensurepip", "--user"]) subprocess.call([str(py_exec), "-m", "pip", "install", "--target={}".format(py_prefix), "--upgrade", "pip"]) # install dependencies using pip # dependencies such as 'numpy' could be added to the end of this command's list subprocess.call([str(py_exec),"-m", "pip", "install", "--target={}".format(py_prefix), "scipy"])
Usage
-
Create a mesh object.
-
Add a boundary vertex group. The default name should be "Boundary", although the operator can work with arbitrary vertex groups.
Procedurally generated vertex groups are also supported (e.g. with a proximity modifier). However, topology modifiers such as subdivision are not recommended because the operator will copy the modifier result to the base mesh.
-
Select the mesh object.
-
Invoke the Geodesic Distance operator from the dropdown next to the vertex group list.
Implementation
The implementation is based on the Heat Method as described by Crane et al. 1. The Laplacian for polygonal meshes is described in the paper "Polygon laplacian made simple" 2.
1: Crane, Keenan, Clarisse Weischedel, and Max Wardetzky. "Geodesics in heat: A new approach to computing distance based on heat flow." ACM Transactions on Graphics (TOG) 32.5 (2013): 1-11.
2: Bunge, Astrid, et al. "Polygon laplacian made simple." Computer Graphics Forum. Vol. 39. No. 2. 2020.