Studying for the Computer Graphics final exam I bumped into a simple, but important fact about adding vectors. Is stated everywhere that in the Blinn-Phong reflection model, the angle spanned by the Halfway vector and the normal to the surface (where the reflection is taking place) is the half of the angle spanned by the Viewer (or Eye) vector and the Reflected vector ... English Version
Preparando el examen final de la materia Computer Graphics, me topé con una propiedad relacionada a la suma de vectores que, si bien es básica, no deja de ser importante. En muchos sitos de internet (link? no he visto muchos en Español...habrá que poner en wikipedia...tendré tiempo?) se dice que el vector de "Mediocamino" en el modelo de iluminación Blinn-Phong sustiende un ángulo con la normal de la superfice (donde la reflexión ocurre) que es la mitad del ángulo entre el vector que apunta al observador y el vector que indica la dirección de reflexión de la luz ... versión en Español
Figure 1: Light incident from direction L on a surface with normal N. The light is reflected in direction R and the viewer is pointed by V. H is the Halfway vector.
Figure 2: Addition of vectors using the parallelogram rule. The addition of vectors of arbitrary length does not yields the bisector of the angle. The addition of the normalized vectors produces the angle bisector.
En este blog podrá leer los comentarios del autor y ver algunas fotografías de los lugares que visita y los trabajos que realiza. El objetivo: Dejar que los que esten interesados miren. In this blog you will find comments of the author and some pictures of the places he visits and the jobs he is involved. The objective: Those who are interested can watch.
Translate
lunes, 7 de junio de 2010
martes, 29 de diciembre de 2009
Sandbox / Arenero
I am trying to do something sensible with the double language posting. Now I will try I tried a solution given by Ezequiel. Now I am using Luciano's solution. English Version
Estoy tratando de resolver el problema con las publicaciones en dos idiomas.Estoy intentando Estaba usando una solución que me dió Ezequiel. Ahora estoy usando una que me pasó Luciano. Versión en Español
Estoy tratando de resolver el problema con las publicaciones en dos idiomas.
Este es el tutorial que Luciano me mandó:
Es fácil. Te explico cómo hacer para que las funciones de JavaScript te queden en la plantilla de tu blog, así las podés usar en todas tus entradas.
En el panel de control de Blogger vas a Diseño -> Edición de HTML y en el cuadro de texto que te abre con el texto de tu plantilla ingresás el siguiente código javascript entre las etiquetas
La primera función muestra un div y la segunda oculta un div. Para saber con qué div trabajar la función necesitas que le pases como parámetro el ID del mismo.
Una vez que insertás ése código y guardas los cambios podés crear una entrada en la que vamos a necesitar 4 cosas: 2 links (uno para leer la nota en español y otro para leer la nota en inglés) y 2 divs (uno con el texto en español y el otro con el texto en inglés)
Te paso el código que yo usé para probar que todo funcione bien en mi blog.
Fijate que los links primero llaman a la función para ocultar el div del idioma que no hay que mostrar y después muestra el link del idioma que se seleccionó. De esta manera nos aseguramos que siempre se muestre solamente el idioma que se seleccionó.
En las etiquetas de los divs fijate que el id está compuesto por el nombre del post y el idioma. Tenés que asegurarte que el id de cada div sea único, si no el javascript no va a funcionar. Por eso armé así los id teniendo en cuenta que en la página principal del blog se muestran varias entradas juntas y si sólo ponés como id "divIngles" y "divEspanol" vas a tener varios divs con el mismo id en la misma página y el javascript no va a funcionar.
Por último fijate que los divs tienen el atributo style="display:none;". Esto es para que los divs cargue ocultos y después el javascript se encarga de cambiar éste atributo para que el div se muestre o se oculte.
Es fácil. Te explico cómo hacer para que las funciones de JavaScript te queden en la plantilla de tu blog, así las podés usar en todas tus entradas.
En el panel de control de Blogger vas a Diseño -> Edición de HTML y en el cuadro de texto que te abre con el texto de tu plantilla ingresás el siguiente código javascript entre las etiquetas
<head>y
</head>
<script language="javascript">
function showDiv(divId) {
document.getElementById(divId).style.display = 'inline';
}
function hideDiv(divId) {
document.getElementById(divId).style.display = 'none';
}
</script>
La primera función muestra un div y la segunda oculta un div. Para saber con qué div trabajar la función necesitas que le pases como parámetro el ID del mismo.
Una vez que insertás ése código y guardas los cambios podés crear una entrada en la que vamos a necesitar 4 cosas: 2 links (uno para leer la nota en español y otro para leer la nota en inglés) y 2 divs (uno con el texto en español y el otro con el texto en inglés)
Te paso el código que yo usé para probar que todo funcione bien en mi blog.
<a href="javascript:hideDiv('divMiPostIngles');showDiv('divMiPostEspanol');">Versión en Español</a>
<a href="javascript:hideDiv('divMiPostEspanol');showDiv('divMiPostIngles');">English Version</a>
<div id="divMiPostEspanol" style="display: none;">
Texto en español aquí
</div>
<div id="divMiPostIngles" style="display: none;">
English text here
</div>
Fijate que los links primero llaman a la función para ocultar el div del idioma que no hay que mostrar y después muestra el link del idioma que se seleccionó. De esta manera nos aseguramos que siempre se muestre solamente el idioma que se seleccionó.
En las etiquetas de los divs fijate que el id está compuesto por el nombre del post y el idioma. Tenés que asegurarte que el id de cada div sea único, si no el javascript no va a funcionar. Por eso armé así los id teniendo en cuenta que en la página principal del blog se muestran varias entradas juntas y si sólo ponés como id "divIngles" y "divEspanol" vas a tener varios divs con el mismo id en la misma página y el javascript no va a funcionar.
Por último fijate que los divs tienen el atributo style="display:none;". Esto es para que los divs cargue ocultos y después el javascript se encarga de cambiar éste atributo para que el div se muestre o se oculte.
This is a translation of Luciano's tutorial:
It is Easy! Let me explain to you how to add JavaScript functions to your Blog templateg, in this way you can use it for every post.
In Blogger's control panel go to Layout -> Edit HTML and in the text box that has your template add the following snipet anywhere between the tags
Here the snipet
The fisrt function shows a div and the second hides a div. To know which one to hide the function needs the ID of the div.
Once you have save your code you can write entries using this add-on. You need 4 things: 2 links (one to read the post in Spanish and the other to read it in English) and 2 divs (One with the Spanish text and the other with the text in English)
Here is the code Luciano's used in his post to check the functions.
Note that the links first call the hidding function of the other language (which we don't want to show) and then call the function to show the selected language. In this way we are pretty sure that only one language will be shown, the selected one.
In the attributes of the divs, check that the ID is composed with the name of the post and the language. This is because we need unique IDs for each div we create, otherwise javascript wont work. The main page of Blogger has many entries to gether if you use a ID like "divEnglish" y "divEspanol" many divs will have the same ID and javascript wont work.
Finally note that the divs have the attribute style="display:none;". This hides the div at startup and then javascript takes care of modifying this, rendering the div visible or invisible.
It is Easy! Let me explain to you how to add JavaScript functions to your Blog templateg, in this way you can use it for every post.
In Blogger's control panel go to Layout -> Edit HTML and in the text box that has your template add the following snipet anywhere between the tags
<head>y
</head>
Here the snipet
<script language="javascript">
function showDiv(divId) {
document.getElementById(divId).style.display = 'inline';
}
function hideDiv(divId) {
document.getElementById(divId).style.display = 'none';
}
</script>
The fisrt function shows a div and the second hides a div. To know which one to hide the function needs the ID of the div.
Once you have save your code you can write entries using this add-on. You need 4 things: 2 links (one to read the post in Spanish and the other to read it in English) and 2 divs (One with the Spanish text and the other with the text in English)
Here is the code Luciano's used in his post to check the functions.
<a href="javascript:hideDiv('divMiPostIngles');showDiv('divMiPostEspanol');">Versión en Español</a>
<a href="javascript:hideDiv('divMiPostEspanol');showDiv('divMiPostIngles');">English Version</a>
<div id="divMiPostEspanol" style="display: none;">
Texto en español aquí
</div>
<div id="divMiPostIngles" style="display: none;">
English text here
</div>
Note that the links first call the hidding function of the other language (which we don't want to show) and then call the function to show the selected language. In this way we are pretty sure that only one language will be shown, the selected one.
In the attributes of the divs, check that the ID is composed with the name of the post and the language. This is because we need unique IDs for each div we create, otherwise javascript wont work. The main page of Blogger has many entries to gether if you use a ID like "divEnglish" y "divEspanol" many divs will have the same ID and javascript wont work.
Finally note that the divs have the attribute style="display:none;". This hides the div at startup and then javascript takes care of modifying this, rendering the div visible or invisible.
martes, 8 de diciembre de 2009
Steering Behaviors: Part I / Comportamientos de dirección: Parte I
(Does anybody has a better Spanish translation for the title? / ¿Mejor traducción al Español para el título?)
Usign Google Wave push a friend of mine (Ezequiel) and me to re-start with some old projects. The idea is to explore Artificial Intelligence for games. He has his programmer/gamer approach and interest and I am more into the scientific/gamer side, anyway we both share a lot of interest in common and, despite eventual arguments (:D), the project is flowing smoothly. You can check the webpage of the current project at Google Code, fell free to check out the SVN and send us your comments. / Luego de experimentar con Google Wave por un tiempo, mi amigo Ezequiel y yo, nos motivamos a re-iniciar proyectos antiguos inconclusos. La idea es explorar inteligencia artifical para juegos. Eze encara los problemas desde el punto de vista del programador/jugador mientras que yo me soy del estio científico/jugador; por suerte ambos tenemos un ben solapamiento de intereses y, dejando d elado alguna que otra discusión (jeje), el projecto está sobre ruedas. Si estás interesado podes mirar la pagina en Google Code y hacer un checkout del repositorio SVN. tus comentarios son bienvenidos.
Currently I am doing my PhD at the Artificial Intelligence Laboratory one of my research interest is to understand the difference in the behavior of an agent (and the algorithms used to program it) when we allow the use of information acquired only through sensors of the agent, without external references. In short, What is the effect of using a frame of reference fixed to the agent? Where the meaning of "fixed" is a used in a wider sense than in rigid body mechanics. At the moment I am happy if I can re-write an algorithm that was defined using variables respect to an external fixed frame of reference, to one using only local variables, and variables that can be acquired by the use of sensors, without knowing the existence of an external reference. Confusing? Well, today's post brings an example. / Actualmente estoy haciendo mi doctorado en un laboratorio de inteligencia artificial y uno de mis intereses es entender como cambia el comportamiento de un agente (y los algoritmos que usamos para programarlo) cuando la información sobre el "mundo exterior" se la obtiene solo a travéz de sensores situados en el agente mismo. En pocas palabras: ¿Cuál es el efecto de utilizar un sistema de referencia solidario al agente? Donde "solidario" lo utilizo en un sentido un poco más amplio que en la mecánica de cuerpos rígidos. Por ahora me contento con traducir algoritmos que fueron definidos utilizando variables en referencia a un sistema de coordenadas fijo, a otros donde solo se utilizan variables en el sistema de referencia local, y ademas que son adquiribles, sin necesidad de conocer el sistema de referencia fijo. Ok, un poco confuso ¿verdad? El post de hoy trae un ejemplo.
You may have heard of Craig Reynolds and his implementation of steering behaviors using agent to agent interaction (sort of molecular dynamics for agents). If you didn't check out the myriads of applets out there in the web, like this one. I won't explain here all the details (check Reynolds webpage or his paper for full details), but is enough to say that for the sake of optimization and the objectives he had in mind (games, games! bwahaha!) all the behaviors are written using the positions and velocities of the agents respect to a global fixed frame of reference; even more an agent can know its own velocity respect to that frame, something not wrong in mathematical terms but impossible if the agent doesn't know the transformation (in this case a Galilean one) from the local frame to the global one, at all times...something difficult in a real agent (without external help, like GPS)./ Quizás hayas escuchado hablar de Craig Reynolds y su implemntación de comportamientos de dirección usando interacciones entre agentes (algo como una dinámica molecular para agentes). Si no escuchaste de el, podés mirar alguno de los applets del montón, como este. No voy a entrar en detalles de todos los comprtamientos (los detalles están en la pagina de Reynolds o en su artículo (todo en inglés)) pero basta decir que, por razones de optimización y porque el tenía en mente juegos, todos los comprtameintos utilizan posiciones y velocidades definidas en un sistema fijo global, incluso un agente puede conocer su velocidad respecto a ese sistema de referencia. Si bien esto no es matemáticamente incorrecto, es imposible hacerlo si el agente no conoce la trasnformación (de Galileo en este caso) entre su sistema local y el global, en todo momento... algo que es muy dificil de tener en un agente real (si ayuda externa, como un GPS).
There is one behavior that I want to look at, the one that aligns the agent to produce flocking. Reynolds paper states: "The Alignment steering behavior gives a character the ability to align itself with other nearby characters...can be computed by finding all characters in the local neighborhood, averaging together the velocity (or alternately, the unit forward vector) of the nearby characters. This average is the desired velocity, and so the steering vector is the difference between the average and our character's current velocity (or alternately, its unit forward vector)." . Can this behavior be written in terms of local (to the agent) variables? Can we achieve an easier (in terms of time complexity) algorithm by doing that? I will try to answer the first question, and to do that lets interpret Reynolds explanation: / En particular me voy a referir a uno de los comportamientos propuestos por Reynolds, el que alinea los agentes para producir flocking. En su artículo, Reynolds nos indica que para cada agente hay que hacer lo siguiente (lo indica en palabras, por lo tanto esto es una interpretación):
I am looking to have something more like: / Yo estoy buscando algo como:
To be continued.../ Continuará...
Usign Google Wave push a friend of mine (Ezequiel) and me to re-start with some old projects. The idea is to explore Artificial Intelligence for games. He has his programmer/gamer approach and interest and I am more into the scientific/gamer side, anyway we both share a lot of interest in common and, despite eventual arguments (:D), the project is flowing smoothly. You can check the webpage of the current project at Google Code, fell free to check out the SVN and send us your comments. / Luego de experimentar con Google Wave por un tiempo, mi amigo Ezequiel y yo, nos motivamos a re-iniciar proyectos antiguos inconclusos. La idea es explorar inteligencia artifical para juegos. Eze encara los problemas desde el punto de vista del programador/jugador mientras que yo me soy del estio científico/jugador; por suerte ambos tenemos un ben solapamiento de intereses y, dejando d elado alguna que otra discusión (jeje), el projecto está sobre ruedas. Si estás interesado podes mirar la pagina en Google Code y hacer un checkout del repositorio SVN. tus comentarios son bienvenidos.
Currently I am doing my PhD at the Artificial Intelligence Laboratory one of my research interest is to understand the difference in the behavior of an agent (and the algorithms used to program it) when we allow the use of information acquired only through sensors of the agent, without external references. In short, What is the effect of using a frame of reference fixed to the agent? Where the meaning of "fixed" is a used in a wider sense than in rigid body mechanics. At the moment I am happy if I can re-write an algorithm that was defined using variables respect to an external fixed frame of reference, to one using only local variables, and variables that can be acquired by the use of sensors, without knowing the existence of an external reference. Confusing? Well, today's post brings an example. / Actualmente estoy haciendo mi doctorado en un laboratorio de inteligencia artificial y uno de mis intereses es entender como cambia el comportamiento de un agente (y los algoritmos que usamos para programarlo) cuando la información sobre el "mundo exterior" se la obtiene solo a travéz de sensores situados en el agente mismo. En pocas palabras: ¿Cuál es el efecto de utilizar un sistema de referencia solidario al agente? Donde "solidario" lo utilizo en un sentido un poco más amplio que en la mecánica de cuerpos rígidos. Por ahora me contento con traducir algoritmos que fueron definidos utilizando variables en referencia a un sistema de coordenadas fijo, a otros donde solo se utilizan variables en el sistema de referencia local, y ademas que son adquiribles, sin necesidad de conocer el sistema de referencia fijo. Ok, un poco confuso ¿verdad? El post de hoy trae un ejemplo.
You may have heard of Craig Reynolds and his implementation of steering behaviors using agent to agent interaction (sort of molecular dynamics for agents). If you didn't check out the myriads of applets out there in the web, like this one. I won't explain here all the details (check Reynolds webpage or his paper for full details), but is enough to say that for the sake of optimization and the objectives he had in mind (games, games! bwahaha!) all the behaviors are written using the positions and velocities of the agents respect to a global fixed frame of reference; even more an agent can know its own velocity respect to that frame, something not wrong in mathematical terms but impossible if the agent doesn't know the transformation (in this case a Galilean one) from the local frame to the global one, at all times...something difficult in a real agent (without external help, like GPS)./ Quizás hayas escuchado hablar de Craig Reynolds y su implemntación de comportamientos de dirección usando interacciones entre agentes (algo como una dinámica molecular para agentes). Si no escuchaste de el, podés mirar alguno de los applets del montón, como este. No voy a entrar en detalles de todos los comprtamientos (los detalles están en la pagina de Reynolds o en su artículo (todo en inglés)) pero basta decir que, por razones de optimización y porque el tenía en mente juegos, todos los comprtameintos utilizan posiciones y velocidades definidas en un sistema fijo global, incluso un agente puede conocer su velocidad respecto a ese sistema de referencia. Si bien esto no es matemáticamente incorrecto, es imposible hacerlo si el agente no conoce la trasnformación (de Galileo en este caso) entre su sistema local y el global, en todo momento... algo que es muy dificil de tener en un agente real (si ayuda externa, como un GPS).
There is one behavior that I want to look at, the one that aligns the agent to produce flocking. Reynolds paper states: "The Alignment steering behavior gives a character the ability to align itself with other nearby characters...can be computed by finding all characters in the local neighborhood, averaging together the velocity (or alternately, the unit forward vector) of the nearby characters. This average is the desired velocity, and so the steering vector is the difference between the average and our character's current velocity (or alternately, its unit forward vector)." . Can this behavior be written in terms of local (to the agent) variables? Can we achieve an easier (in terms of time complexity) algorithm by doing that? I will try to answer the first question, and to do that lets interpret Reynolds explanation: / En particular me voy a referir a uno de los comportamientos propuestos por Reynolds, el que alinea los agentes para producir flocking. En su artículo, Reynolds nos indica que para cada agente hay que hacer lo siguiente (lo indica en palabras, por lo tanto esto es una interpretación):
- Get average velocity of agents nearby (or unit forward vector). / Calcule la velocidad promedio de los agentes cercanos (o el vector unitario que indica su orientación).
- Get the difference between that average and the agents velocity. / Tome la diferencia entre ese promedio y la velocidad del agente en cuestión.
- Apply a force proportional to that difference. / Aplique una fuerza al agente en cuestion proporcional al resultado de la diferencia.
I am looking to have something more like: / Yo estoy buscando algo como:
- Get average relative velocity of agents nearby (or relative heading); This can be achieved with distance sensors and some assumptions about the way another agents looks like or behaves (more on this to come). / Calcule la velocidad relativa promedio de los agentes cercanos (o la orientación relativa); que se puede obtener por medio de sensores de distancias y algunas hipótesis sobre el aspecto y la forma de moverse de los otros agentes.
- Apply a force to minimize the norm of that result. / Aplique una fuerza para reducir la norma de ese resultado.
To be continued.../ Continuará...
lunes, 9 de noviembre de 2009
Reunión CC - IM - F / CS - ME - P - Meeting


El viernes salí a tomar unas cervezas con un colega del trabajo, Matêj Hoffmann y con un ex-colega y gran amigo Emanuel Benker. Entre cerveza y cerveza ilustrabamos nuestra conversación...que importante tener papel y hoja a mano! / On Friday I went out for a couple of beers with Matêj Hoffmann and Emanuel Benker, both friends from the lab. Between beers we were illustrating our conversation in a piece of paper...How important to have pen and paper at hand!
Por ahi abajo se lee: / Down there you can read:
"Frauen sind wie Wellblech. Wenn du sie nicht nagelst, fliegen sie davon"
La broma es sexista y muy fea, producto del consumo excesivo de cerveza, pero es gracioso ver como lo popular se encuentra en muchas culturas...una lástima que sea esto. / The joke is sexist and ugly, due to the excess of beer, but is funny to see how popular stuff is multi cultural... a pitty that it is this joke.
sábado, 7 de noviembre de 2009
Sudoku para 2 segunda vuelta! / Sudoku for 2 second round!
I got an invitation to Google Wave form my friend Ezequiel. While learning how to use this mysterious application I found that there is a gadget (an extension/ plug-in) that allows multiplayer Sudoku, haha, pretty similar to my previous post on Sudoku for 2. check it out!
LabPixies: Sudoku Puzzles
Hace unos días recibí una invitación a Google Wave de mi amigo Ezequiel. Mientras intentaba aprende run poco sobre esta misteriosa aplicación, encontré que tiene un gadget (una extension) que permite hace juegos de Sudoku con muchos jugadores. Increiblement eparecido a lo que comentaba en mi post sobre el tema. Jaja, que bueno!
Aqui está el webapge de los que lo programaron...en inglés. LabPixies: Sudoku Puzzles
LabPixies: Sudoku Puzzles
Hace unos días recibí una invitación a Google Wave de mi amigo Ezequiel. Mientras intentaba aprende run poco sobre esta misteriosa aplicación, encontré que tiene un gadget (una extension) que permite hace juegos de Sudoku con muchos jugadores. Increiblement eparecido a lo que comentaba en mi post sobre el tema. Jaja, que bueno!
Aqui está el webapge de los que lo programaron...en inglés. LabPixies: Sudoku Puzzles
Suscribirse a:
Entradas (Atom)

