Notifications
Clear all

[Closed] How to find if the object is cylinder?

firstbit added

I suggest to make it even more confusing :):


fn shuffleIndexes count seedValue: = 
(
   if seedValue != unsupplied do seed seedValue
   list = #()    
   list.count = count
   for k = 1 to count do 
   (
      i = random 1 k
      list[k] = list[i]
      list[i] = k
   )
   list
)
mapped fn reorderMesh node seedvalue: =
(
   if seedvalue == unsupplied do seedvalue = 0
      
   m = copy node.mesh
   pp = for k=1 to m.numverts collect (getvert m k) 
   nn = shuffleIndexes m.numverts seed:seedvalue   
   ff = for k=1 to m.numfaces collect (getface m k)
   ss = for k=1 to m.numfaces collect (getFaceSmoothGroup m k) 
   
   _pp = deepcopy pp
   for k=1 to nn.count collect _pp[nn[k]] = pp[k] 
   _ff = for f in ff collect [nn[f[1]],nn[f[2]],nn[f[3]]] 
   
   converttomesh node
   
   _m = trimesh()
   setmesh _m vertices:_pp faces:_ff
   for k=1 to _m.numfaces do (setFaceSmoothGroup _m k ss[k]) 
   node.mesh = _m
   update node
)
mapped fn randomizeObjectRotation node seedvalue: minmax:[30,30] reset:on =
(
   if seedvalue != unsupplied do seed seedvalue
      
   node.objectoffsetrot = eulerangles (random -minmax.x minmax.y) (random -minmax.x minmax.y) (random -minmax.x minmax.y)
   if reset do resetxform node
   converttomesh node
)

shuffle vertices to randomize topo, and randomize object rotation…

Page 4 / 4