diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-10 22:13:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-10 22:13:05 +0300 |
commit | 385875632d7953080375ef4bf74f894c1053fc4b (patch) | |
tree | 8f7d69622d67953cfc413f0d5b2e87ef013042d7 /source/blender/blenlib/intern/math_geom.c | |
parent | d611dd373558814ea2fc21bcd5418404f1c77a4d (diff) |
Math Lib
* Fix remaining issues before conversion.
* Inline various vector functions, currently enabled for all platforms.
I expect this to work in GCC/MSVC at least, if other platforms don't
support it, #ifdef's can be added.
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 5c7890ffee4..30dce25fea3 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -124,7 +124,7 @@ float area_tri_v3(float *v1, float *v2, float *v3) /* Triangles */ #define MAX3(x,y,z) MAX2(MAX2((x),(y)) , (z)) -float area_poly_v3(int nr, float *verts, float *normal) +float area_poly_v3(int nr, float verts[][3], float *normal) { float x, y, z, area, max; float *cur, *prev; @@ -142,13 +142,13 @@ float area_poly_v3(int nr, float *verts, float *normal) } /* The Trapezium Area Rule */ - prev= verts+3*(nr-1); - cur= verts; + prev= verts[nr-1]; + cur= verts[0]; area= 0; for(a=0; a<nr; a++) { area+= (cur[px]-prev[px])*(cur[py]+prev[py]); - prev= cur; - cur+=3; + prev= verts[a]; + cur= verts[a+1]; } return (float)fabs(0.5*area/max); @@ -232,7 +232,7 @@ float dist_to_line_segment_v3(float *v1, float *v2, float *v3) /******************************* Intersection ********************************/ /* intersect Line-Line, shorts */ -short isect_line_line_v2_short(short *v1, short *v2, short *v3, short *v4) +int isect_line_line_v2_short(short *v1, short *v2, short *v3, short *v4) { /* return: -1: colliniar @@ -257,7 +257,7 @@ short isect_line_line_v2_short(short *v1, short *v2, short *v3, short *v4) } /* intersect Line-Line, floats */ -short isect_line_line_v2(float *v1, float *v2, float *v3, float *v4) +int isect_line_line_v2(float *v1, float *v2, float *v3, float *v4) { /* return: -1: colliniar |