Index: ChangeLog
===================================================================
--- ChangeLog	(revision 73568)
+++ ChangeLog	(working copy)
@@ -877,3 +877,7 @@
 
 	* Let Draw Text with viewport size instead of window size. When map is enabled then it should be rendered completely.
 
+2012-07-11  Christophe Sadoine
+
+	* Added a function to rotate an evas map with a quaternion: evas_map_util_quat_rotate().
+
Index: NEWS
===================================================================
--- NEWS	(revision 73568)
+++ NEWS	(working copy)
@@ -7,6 +7,7 @@ Additions:
 
    * Textgrid object.
    * Evas_Smart_Interface type, which brings simple interfaces support to smart objects.
+   * Function to rotate an evas map with a quaternion: evas_map_util_quat_rotate().
 
 Improvements:
    * Lock less font rendering.
Index: src/lib/canvas/evas_map.c
===================================================================
--- src/lib/canvas/evas_map.c	(revision 73568)
+++ src/lib/canvas/evas_map.c	(working copy)
@@ -881,6 +881,49 @@ evas_map_util_3d_rotate(Evas_Map *m, double dx, do
 }
 
 EAPI void
+evas_map_util_quat_rotate(Evas_Map *m, double dx, double dy, double dz,
+                          double dw, double cx, double cy, double cz)
+{
+   MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
+   return;
+   MAGIC_CHECK_END();
+
+   Evas_Map_Point *p, *p_end;
+
+   p = m->points;
+   p_end = p + m->count;
+
+   for (; p < p_end; p++)
+     {
+       double x, y, z, uvx, uvy, uvz, uuvx, uuvy, uuvz;
+
+       x = p->x - cx;
+       y = p->y - cy;
+       z = p->z - cz;
+
+       uvx = dy * z - dz * y;
+       uvy = dz * x - dx * z;
+       uvz = dx * y - dy * x;
+
+       uuvx = dy * uvz - dz * uvy;
+       uuvy = dz * uvx - dx * uvz;
+       uuvz = dx * uvy - dy * uvx;
+
+       uvx *= (2.0f * dw);
+       uvy *= (2.0f * dw);
+       uvz *= (2.0f * dw);
+
+       uuvx *= 2.0f;
+       uuvy *= 2.0f;
+       uuvz *= 2.0f;
+
+       p->px = p->x = cx + x + uvx + uuvx;
+       p->py = p->y = cy + y + uvy + uuvy;
+       p->z = cz + z + uvz + uuvz;
+     }
+}
+
+EAPI void
 evas_map_util_3d_lighting(Evas_Map *m,
                           Evas_Coord lx, Evas_Coord ly, Evas_Coord lz,
                           int lr, int lg, int lb, int ar, int ag, int ab)
Index: src/lib/Evas.h
===================================================================
--- src/lib/Evas.h	(revision 73568)
+++ src/lib/Evas.h	(working copy)
@@ -4753,6 +4753,30 @@ EAPI void            evas_map_util_zoom(Evas_Map *
 EAPI void            evas_map_util_3d_rotate(Evas_Map *m, double dx, double dy, double dz, Evas_Coord cx, Evas_Coord cy, Evas_Coord cz);
 
 /**
+ * Rotate the map in 3D using a quaternion
+ *
+ * This will rotate in 3D using a quaternion. Like with
+ * evas_map_util_3d_rotate() you provide a center point 
+ * to rotate around (in 3D).
+ *
+ * @param m map to change.
+ * @param dx x composante of the quaternion.
+ * @param dy y composante of the quaternion.
+ * @param dz z composante of the quaternion.
+ * @param dw w composante of the quaternion.
+ * @param cx rotation's center x.
+ * @param cy rotation's center y.
+ * @param cz rotation's center z.
+ *
+ * @warning Rotations can be done using a unit quaternion. Thus, this
+ * function expects a unit quaternion (i.e. dx² + dy² + dz² + dw² == 1).
+ * If this is not the case the behavior is undefined.
+ *
+ * @since 1.7
+ */
+EAPI void            evas_map_util_quat_rotate(Evas_Map *m, double dx, double dy, double dz, double dw, double cx, double cy, double cz);
+
+/**
  * Perform lighting calculations on the given Map
  *
  * This is used to apply lighting calculations (from a single light source)
