Permalink
Browse files

Correctly output a normalized vec2 if the in/out pointers aren't the …

…same
  • Loading branch information...
1 parent 68bc15b commit 293f4cce97729faff87263c8373d7404490b472f @Kazade committed Jan 30, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/vec2.c
View
8 src/vec2.c
@@ -51,8 +51,12 @@ kmVec2* kmVec2Normalize(kmVec2* pOut, const kmVec2* pIn)
{
kmScalar l = 1.0f / kmVec2Length(pIn);
- pOut->x *= l;
- pOut->y *= l;
+ kmVec2 v;
+ v.x = pIn->x * l;
+ v.y = pIn->y * l;
+
+ pOut->x = v.x;
+ pOut->y = v.y;
return pOut;
}

0 comments on commit 293f4cc

Please sign in to comment.