0

Starting from a sphere, I check if a new point is inside the sphere, if not I would like to add a sphere centered around the new point to the Delaunay Triangulated space. Unfortunately, I can only find a way to add points to the Delaunay class. Is there a way to merge two spheres. I need to repeat the calculation alot. I picked Delaunay as it seems to be one of the fastest.

import numpy as np
from scipy.spatial import Delaunay

def sphere_points(radius, num_points):
    ind = np.arange(0, num_points, dtype=float) + radius
    phi = np.arccos(1 - 2 * ind / num_points)
    theta = np.pi * (1 + 5**0.5) * ind
    return np.column_stack((np.cos(theta) * np.sin(phi), np.sin(theta) * np.sin(phi), np.cos(phi)))

# Initial sphere
tri = Delaunay(sphere_points(0.5, 100))

points = [[0,0,2], [2, 0, 0]]

for point in points:
    if not tri.find_simplex(point) >= 0:
        tri_new = Delaunay(sphere_points(0.5, 100) + point)
        # Merge the tri with tri_new
        pass
Raymond gsh
  • 363
  • 3
  • 15

0 Answers0