1
votes

I am currently using the Delaunay function in scipy.spatial.Delaunay, like so (simplified):

import numpy as np
from scipy.spatial import Delaunay

points1 = np.random.rand(10,2)
points2 = np.random.rand(10,2)

tri = Delaunay(points1)
# tri2 = tri(points2)? - need help here

I would like to have the same triangulation applied to point2 - if I run Delaunay again I might get a different triangulation.

Is it possible to 'copy' one triangulation and apply it to a different set of points of the same size?

1
You’re okay with the result having overlapping triangles if the points are too different?Davis Herring
@DavisHerring yes- my points are facial landmarks, so there shouldn't be much differenceShtut
What do you want to do with the hybrid triangulation such that it matters? You can already use d.simplices and d.neighbors with whatever point array you want.Davis Herring
@DavisHerring I'm trying to create a consistent triangle 'face mask'- so that if a person is smiling or frowning the triangulation won't change- could you explain how to use the simplicies and the neighbors properties to achieve that? I'm not very familiar with it.Shtut
The Delaunay object, in its most basic usage (those two attributes), defines the topology of a triangulation whose geometry you already had (and provided as input). Whatever you want to do with the triangulation (e.g., render it) can be done by using that topology in conjunction with whatever geometry you like--the original is the obvious choice, but it makes no difference to use another of the same cardinality (so long as it's not "too different").Davis Herring

1 Answers

0
votes

For completeness' sake, based on Davis Herring's response in the comments-

tri.simplices contains the relation between the indices of the input, and doesn't rely on the actual values.

if for example I got a triangle between points[0], points[3] and points[4], tri.simplices will contain [0,3,4].

so to access the same triangulation with different 'points' I can just access them like so:

points2[tri.simplices]