Index: NEWS
===================================================================
--- NEWS	(revision 73591)
+++ 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/Evas.h
===================================================================
--- src/lib/Evas.h	(revision 73591)
+++ 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 unit quaternion.
+ *
+ * This will rotate in 3D using a unit quaternion. Like with
+ * evas_map_util_3d_rotate() you provide a center point 
+ * to rotate around (in 3D).
+ *
+ * @param m map to change.
+ * @param qx the x component of the imaginary part of the quaternion.
+ * @param qy the y component of the imaginary part of the quaternion.
+ * @param qz the z component of the imaginary part of the quaternion.
+ * @param qw the w component of the real part 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. qx² + qy² + qz² + qw² == 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 qx, double qy, double qz, double qw, 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)
Index: src/lib/canvas/evas_map.c
===================================================================
--- src/lib/canvas/evas_map.c	(revision 73591)
+++ 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 qx, double qy, double qz,
+                          double qw, 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 = qy * z - qz * y;
+       uvy = qz * x - qx * z;
+       uvz = qx * y - qy * x;
+
+       uuvx = qy * uvz - qz * uvy;
+       uuvy = qz * uvx - qx * uvz;
+       uuvz = qx * uvy - qy * uvx;
+
+       uvx *= (2.0f * qw);
+       uvy *= (2.0f * qw);
+       uvz *= (2.0f * qw);
+
+       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: ChangeLog
===================================================================
--- ChangeLog	(revision 73591)
+++ ChangeLog	(working copy)
@@ -880,3 +880,8 @@
 2012-07-11  Tom Hacohen (TAsn)
 
 	* Fixed runtime emboldenment with bitmap fonts.
+
+2012-07-12  Christophe Sadoine
+
+	* Added a function to rotate an evas map with a quaternion: evas_map_util_quat_rotate().
+
