create random spheres in retopo room, then remove one of groups, collapse edges randomly
create random spheres in retopo room, then remove one of groups, collapse edges randomly
1
2from coat import *
3import random
4
5
6ui.toRoom("Retopo")
7
8
9mesh = Model.fromRetopo()
10
11mesh.clear()
12
13sphere = Mesh.sphere(radius = 10)
14
15
16for i in range(0, 10):
17
18 sphere.setObjectName(0, "sphere" + str(i))
19
20 mesh.addTransformed(sphere, mat4.Translation(vec3.RandNormal()*150))
21
22
23
24
25mesh.removeObject(4)
26
27
28n = mesh.facesCount()
29for i in range(0, int(n/8)):
30 f = int(random.random() * mesh.facesCount())
31 verts = mesh.getFaceVerts(f)
32 print("verts: " + str(verts))
33 if len(verts) > 0:
34 mesh.collapseEdge(verts[0], verts[2])
35
36
37cube = Mesh.box(size = vec3(20, 20, 20),nx = 8, ny = 8, nz = 8)
38
39mesh.setObjectMesh(2, cube)
40mesh.setObjectName(2, "cube")