Last active
March 7, 2021 17:52
-
-
Save ganzuul/114bee8cb958f9544cdc8bfb5d570dc6 to your computer and use it in GitHub Desktop.
Blender qhull stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import numpy as np | |
from scipy.spatial import Delaunay | |
points = np.random.rand(20,3) | |
tri = Delaunay(points) | |
mesh = bpy.data.meshes.new("myUnrulyMess") # add the new mesh | |
obj = bpy.data.objects.new(mesh.name, mesh) | |
col = bpy.data.collections.get("Collection") | |
col.objects.link(obj) | |
bpy.context.view_layer.objects.active = obj | |
verts = [list(v) for v in points] | |
edges = [] | |
faces = np.ndarray.tolist(tri.simplices) | |
mesh.from_pydata(verts, edges, faces) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment