aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_map.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-29 17:18:23 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-29 17:20:29 +0200
commit0acf23857fccc300727c32aa5ef0583953528d5d (patch)
tree34104bab144076975df7829952a65fc5809cec73 /src/lib/evas/canvas/evas_map.c
parenteina: include dependency header cleanly. (diff)
downloadefl-0acf23857fccc300727c32aa5ef0583953528d5d.tar.gz
eina: beginning of a generic quaternion API.
Diffstat (limited to 'src/lib/evas/canvas/evas_map.c')
-rw-r--r--src/lib/evas/canvas/evas_map.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index 86ceebeba5..bd7e51b99b 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -1047,6 +1047,9 @@ EAPI void
evas_map_util_quat_rotate(Evas_Map *m, double qx, double qy, double qz,
double qw, double cx, double cy, double cz)
{
+ Eina_Quaternion q;
+ Eina_Point_3D c;
+
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
return;
MAGIC_CHECK_END();
@@ -1056,33 +1059,28 @@ evas_map_util_quat_rotate(Evas_Map *m, double qx, double qy, double qz,
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;
+ q.x = qx;
+ q.y = qy;
+ q.z = qz;
+ q.w = qw;
- uvx = qy * z - qz * y;
- uvy = qz * x - qx * z;
- uvz = qx * y - qy * x;
+ c.x = cx;
+ c.y = cy;
+ c.z = cz;
- uuvx = qy * uvz - qz * uvy;
- uuvy = qz * uvx - qx * uvz;
- uuvz = qx * uvy - qy * uvx;
+ for (; p < p_end; p++)
+ {
+ Eina_Point_3D current;
- uvx *= (2.0f * qw);
- uvy *= (2.0f * qw);
- uvz *= (2.0f * qw);
+ current.x = p->x;
+ current.y = p->y;
+ current.z = p->z;
- uuvx *= 2.0f;
- uuvy *= 2.0f;
- uuvz *= 2.0f;
+ eina_quaternion_rotate(&current, &c, &q);
- p->px = p->x = cx + x + uvx + uuvx;
- p->py = p->y = cy + y + uvy + uuvy;
- p->z = cz + z + uvz + uuvz;
+ p->px = p->x = current.x;
+ p->py = p->y = current.y;
+ p->z = current.z;
}
}