# How can I recreate an Icosphere made of separate triangles with AN?

The idea is to recreate the icosphere with triangle objects for further animation.

• Do you want each triangle as a independient triangle??? – yhoyo Feb 19 '16 at 13:15
• Yes, that´s the idea – Jorge Losilla Martínez Feb 19 '16 at 13:25

This here is maybe not the fastest method but it is quite easy to implement:

You see it already takes more than 8ms, maybe it would be good to "bake" the triangle objects before you continue to work on your animation. To do that you can eg copy all the objects and remove the node tree afterwards. Alternatively you can also go into the advanced settings of the Object Instancer node and click on "Unlink Instances from Node" and remove the node tree then.

• That´s really the easiest way. Withouth going into geometric calculations. Thanks Jacques – Jorge Losilla Martínez Feb 19 '16 at 22:37

The first answer (Jacques) is right and the most natural/ immediate to Animation Nodes logic.

Still, let's make extra variants and a comparison in speed.

1. each polygon to mesh to object, just like the first example
2. same, but using poly indices and not the polygon data
3. same, but use combine mesh instead of poly yo mesh

4. instance a triangle obj and just set vertex positions (move existing verts) like the triangles

all variations have an extra move poly to origin/ move object instance back (so that we have obj centers in the poly centers), so we add more operations to stress my computer in hope to make it slower so maybe the times will differ more

setups and conclusions:

variant 1, poly to mesh to obj:

• time 9-10 mil sec on my computer
• the instancer blanc object vs a copy of an obj does not matter (to speed)
• [poly info],[transform poly] and [setting to mesh]/[mesh to obj] are the specific nodes

variant 2, same, but poly indices:

• time 9-10 mil sec on my computer
• I avoid polygons and do the job manually with indices
• [transform vert list] and [combine mesh]+ extra loop to extract verts/poly are the specific nodes

variant 3, same, but combine mesh:

• time 8-9 mil sec on my computer
• the instancer blanc object vs a copy of an obj does not matter (to speed)
• [poly info],[transform vert list] and [combine mesh] are the specific nodes

variant 4, instance a triangle obj, move it's verts

• time 2-3 mil sec on my computer
• the instancer etc does same, not matter (to speed)
• [transform vert list] and [set verts on obj] are the specific nodes

Ok, jumping to conclusions:

• there is a slight, very little improvement where I replace poly to mesh with combine mesh
• I lose that when I extract manually instead of poly info,
• the significant speedup goes when moving verts instead of creating them

My wild guess is that

• move verts [set verts on obj] is using foreach_set that is way faster than looping /creating new mesh data
• the rest does not seam to vary time that much
• the extra operations don't add much (try wiothout)

ps: moving the verts allows to do extra tricks if the case, like morphing a quad or ngon to the triangles

you can use this code... just 1 click

import bpy

sub = 2 #ICO SPHERE SUBDIVISION
sz = 1 # ICO SPHERE SIZE
edit_mode=True #ICO SPHERE INTO EDIT_MODE

ops = bpy.ops