Comunidad de diseño web y desarrollo en internet online

Duda función Math.atan2()

Citar            
MensajeEscrito el 20 Ene 2008 02:41 pm
Muy buenas, me había surgido una dudilla respecto a la función Math.atan2(): en la ayuda de Flash pone textualmente "Calcula y devuelve el ángulo del punto y/ x en radianes cuando se mide en sentido contrario al de las agujas del reloj". ¿Por qué, entonces, en este ejemplo y con este código...

Código :

//Centro círculo = (275, 200)
var centro_x = 30;
var centro_y = 30;
//Comienza la función
_root.onMouseMove = function () {
   updateAfterEvent();
   xdif = _root._xmouse - centro_x;
   ydif = _root._ymouse - centro_y;
   angle_rad = Math.atan2(ydif, xdif);
   angle_deg = (angle_rad * 180) / Math.PI;
   coseno = Math.cos(angle_rad);
   seno = Math.sin(angle_rad);
   angulo_txt.htmlText = '<b>Ángulo: <font color="#FFCC00">' + Math.round(angle_deg * 1000) / 1000 + "º</font></b>";
   coseno_txt.htmlText = 'Coseno: <font color="#FFCC00">' + Math.round(coseno * 1000) / 1000 + "</font>";
   seno_txt.htmlText = 'Seno: <font color="#FFCC00">' + Math.round(seno * 1000) / 1000 + "</font>";
}


...me da que lo mide en el sentido de las agujas del reloj?

Por Juanlu_001

Claber

690 de clabLevel

6 tutoriales

 

firefox
Citar            
MensajeEscrito el 20 Ene 2008 02:42 pm
Bueno la primera linea del comentario es //Centro círculo = (30, 30), pero no tiene importancia :P

Por Juanlu_001

Claber

690 de clabLevel

6 tutoriales

 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.