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
| import math
import random
NOMBRE_POINTS=4
def norm(a,b,c):
return math.sqrt(a*a+b*b+c*c)
def normalize(a,b,c):
n=norm(a,b,c)
return(a/n,b/n,c/n)
def pointrandom():
return (random.random()-0.5, random.random()-0.5, random.random()-0.5)
def intit_points_random():
points=[]
for i in range (1,4):
(a,b,c)=pointrandom()
(a,b,c)=normalize(a,b,c)
points.append((a,b,c))
return points
def dessine_points(L_points):
for point in L_points:
(a,b,c)=point
#bpy.ops.mesh.primitive_uv_sphere_add(size=0.05, view_align=False, enter_editmode=False, location=(a*1.02,b*1.02,c*1.0))
return
L_points=intit_points_random
dessine_points(L_points) |