smbinterp/tools/blender/maketet.py

43 lines
723 B
Python

from Blender import *
import bpy
import math
phiaa = -19.471220333
r = 1.0
phia = math.pi * phiaa / 180.0
the120 = math.pi * 120.0 / 180.0
v = [[0,0,0], [0,0,0], [0,0,0], [0,0,0]]
v[0][0] = 0.0
v[0][1] = 0.0
v[0][2] = r
the = 0.0
for i in range(1,4):
v[i][0] = r * math.cos(the) * math.cos(phia)
v[i][1] = r * math.sin(the) * math.cos(phia)
v[i][2] = r * math.sin(phia)
the = the + the120
print v
# map vertices to 4 faces
f = []
f.append([0, 1, 2])
f.append([0, 2, 3])
f.append([0, 3, 1])
f.append([1, 2, 3])
me = bpy.data.meshes.new('points')
me.verts.extend([i for i in v])
me.faces.extend([i for i in f])
scn = bpy.data.scenes.active
ob = scn.objects.new(me, 'points_obj')