[grits] Use common vector operations for ROAM
- From: Andy Spencer <andys src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grits] Use common vector operations for ROAM
- Date: Mon, 24 Jan 2011 05:30:10 +0000 (UTC)
commit 902fb15b250b78bd5f69258ecb29a00960dd9b83
Author: Andy Spencer <andy753421 gmail com>
Date: Sat Jan 22 19:58:33 2011 +0000
Use common vector operations for ROAM
src/roam.c | 25 ++++---------------------
1 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/src/roam.c b/src/roam.c
index 768ca35..6ac1a1e 100644
--- a/src/roam.c
+++ b/src/roam.c
@@ -206,27 +206,10 @@ RoamTriangle *roam_triangle_new(RoamPoint *l, RoamPoint *m, RoamPoint *r,
// triangle->split->lat, l->lat);
/* Update normal */
- double pa[3];
- double pb[3];
- pa[0] = triangle->p.l->x - triangle->p.m->x;
- pa[1] = triangle->p.l->y - triangle->p.m->y;
- pa[2] = triangle->p.l->z - triangle->p.m->z;
-
- pb[0] = triangle->p.r->x - triangle->p.m->x;
- pb[1] = triangle->p.r->y - triangle->p.m->y;
- pb[2] = triangle->p.r->z - triangle->p.m->z;
-
- triangle->norm[0] = pa[1] * pb[2] - pa[2] * pb[1];
- triangle->norm[1] = pa[2] * pb[0] - pa[0] * pb[2];
- triangle->norm[2] = pa[0] * pb[1] - pa[1] * pb[0];
-
- double total = sqrt(triangle->norm[0] * triangle->norm[0] +
- triangle->norm[1] * triangle->norm[1] +
- triangle->norm[2] * triangle->norm[2]);
-
- triangle->norm[0] /= total;
- triangle->norm[1] /= total;
- triangle->norm[2] /= total;
+ crossd3((gdouble*)triangle->p.l,
+ (gdouble*)triangle->p.m,
+ (gdouble*)triangle->p.r, triangle->norm);
+ normd(triangle->norm);
/* Store bounding box, for get_intersect */
RoamPoint *p[] = {l,m,r};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]