How can I compare normals in AN with python I am trying to create a script that assigns a differente rotation to polys according to their normals but I can´t figure out how to do it. This is my script so far.

import math
import mathutils


mirando_arriba = mathutils.Vector((0.0000,0.0000,1.0000))
mirando_derecha = mathutils.Vector((0.0000,1.0000,0.0000))
mirando_izquierda = mathutils.Vector((-0.0000,-1.0000,-0.0000))
mirando_abajo = mathutils.Vector((0.0000,0.0000,-1.0000))
mirando_fondo = mathutils.Vector((1.0000,0.0000,0.0000))
mirando_trasera = mathutils.Vector((-1.0000,0.0000,-0.0000))
if (Normal == mirando_arriba):
    result = rotateY
    TextBlock = "Mira hacia arriba"
elif (Normal ==  mirando_derecha):
    result = rotateX
    TextBlock = "Mira hacia derecha"
elif (Normal ==  mirando_abajo):
    result = rotateX
    TextBlock = "Mira hacia abajo"   
elif (Normal ==  mirando_fondo):
    result = rotateX     
    TextBlock = "Mira hacia fondo" 
elif (Normal ==  mirando_izquierda):
    result = rotateX     
    TextBlock = "Mira hacia izquierda" 
elif (Normal ==  mirando_trasera):
    result = rotateY     
    TextBlock = "Mira hacia trasera"     
else:
    result = rotateY
    TextBlock = "No mira"
The only issue I see here is comparing vectors that are float vectors and that can give false negatives.

For vector comparison it's better to use "distance", rather than "==".
(Also, in blender precision appears to go up to 6, so use at most &lt; 0.00001)

For more see: https://github.com/JacquesLucke/animation_nodes/issues/327 



However, that means in your code:

if (Normal - mirando_arriba).length_squared &lt; 0.0001:
    result = rotateY
    TextBlock = "Mira hacia arriba"


and same for the rest.