From 4bd0a2ba2dadee66d52f9a1101ee918f1327eec4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 Sep 2011 04:14:12 +0000 Subject: replace VECCOPY -> copy_v3_v3, added copy_v*_v*_short too for typesafe copying, some parts of the code are copying float -> short normals without scaling. fix coming next. --- source/blender/blenlib/BLI_math_vector.h | 6 ++++++ source/blender/blenlib/intern/graph.c | 4 ++-- source/blender/blenlib/intern/math_vector_inline.c | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index d30168c8657..a807a395b78 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -56,6 +56,12 @@ MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); MINLINE void swap_v4_v4(float a[4], float b[4]); +/* short */ +MINLINE void copy_v2_v2_short(short r[2], const short a[2]); +MINLINE void copy_v3_v3_short(short r[3], const short a[3]); +MINLINE void copy_v4_v4_short(short r[4], const short a[4]); + + /********************************* Arithmetic ********************************/ MINLINE void add_v3_fl(float r[3], float f); diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index 2e26f4bd9c9..8b9cddcc1d1 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -591,7 +591,7 @@ static void testRadialSymmetry(BGraph *graph, BNode* root_node, RadialArc* ring, node1 = BLI_otherNode(ring[i].arc, root_node); node2 = BLI_otherNode(ring[j].arc, root_node); - VECCOPY(p, node2->p); + copy_v3_v3(p, node2->p); BLI_mirrorAlongAxis(p, root_node->p, normal); /* check if it's within limit before continuing */ @@ -605,7 +605,7 @@ static void testRadialSymmetry(BGraph *graph, BNode* root_node, RadialArc* ring, if (symmetric) { /* mark node as symmetric physically */ - VECCOPY(root_node->symmetry_axis, axis); + copy_v3_v3(root_node->symmetry_axis, axis); root_node->symmetry_flag |= SYM_PHYSICAL; root_node->symmetry_flag |= SYM_RADIAL; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 28708af7486..13623d9a93a 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -79,6 +79,28 @@ MINLINE void copy_v4_v4(float r[4], const float a[4]) r[3]= a[3]; } +/* short */ +MINLINE void copy_v2_v2_short(short r[2], const short a[2]) +{ + r[0]= a[0]; + r[1]= a[1]; +} + +MINLINE void copy_v3_v3_short(short r[3], const short a[3]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; +} + +MINLINE void copy_v4_v4_short(short r[4], const short a[4]) +{ + r[0]= a[0]; + r[1]= a[1]; + r[2]= a[2]; + r[3]= a[3]; +} + MINLINE void swap_v2_v2(float a[2], float b[2]) { SWAP(float, a[0], b[0]); -- cgit v1.2.3