This Python script for Blender 3D creates an ovoid model using the math formula for ovoid:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import bpy import math # Define the parameters of the ovoid a = 1.9 b = 1.5 c = 1.5 # Define the number of vertices in each direction n_long = 32 n_lat = 16 # Create a new mesh mesh = bpy.data.meshes.new(name="Ovoid") # Create the vertices verts = [] for j in range(n_lat): lat = (j / (n_lat - 1)) * math.pi for i in range(n_long): lon = (i / (n_long - 1)) * 2 * math.pi x = a * math.sin(lat) * math.cos(lon) y = b * math.sin(lat) * math.sin(lon) z = c * math.cos(lat) verts.append((x, y, z)) # Create the faces faces = [] for j in range(n_lat - 1): for i in range(n_long - 1): v1 = j * n_long + i v2 = j * n_long + i + 1 v3 = (j + 1) * n_long + i + 1 v4 = (j + 1) * n_long + i faces.append((v1, v2, v3, v4)) # Create the mesh and object mesh.from_pydata(verts, [], faces) obj = bpy.data.objects.new(name="Ovoid", object_data=mesh) # Add the object to the scene scene = bpy.context.scene scene.collection.objects.link(obj) |