Skip to content

Commit

Permalink
- BUGFIX : Fix aiQuaternion::nomalize method.
Browse files Browse the repository at this point in the history
- UPDATE : Improve performance by avoiding multiple divisions.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@873 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
  • Loading branch information
kimmi committed Nov 27, 2010
1 parent 76a733e commit bd92f15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ Contributed updated and improved xcode workspaces

- drparallax
Contributed the /samples/SimpleAssimpViewX sample

- Carsten Fuchs
Contributed a fix for the Normalize method in aiQuaternion.
4 changes: 4 additions & 0 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ SOURCE_GROUP( Common FILES
ScenePreprocessor.h
SkeletonMeshBuilder.cpp
SkeletonMeshBuilder.h
SplitByBoneCountProcess.cpp
SplitByBoneCountProcess.h
SmoothingGroups.h
StandardShapes.cpp
StandardShapes.h
Expand Down Expand Up @@ -615,6 +617,8 @@ ADD_LIBRARY( assimp SHARED
SceneCombiner.h
ScenePreprocessor.cpp
ScenePreprocessor.h
SplitByBoneCountProcess.cpp
SplitByBoneCountProcess.h
SkeletonMeshBuilder.cpp
SkeletonMeshBuilder.h
SmoothingGroups.h
Expand Down
11 changes: 6 additions & 5 deletions include/aiQuaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,14 @@ inline void aiQuaternion::Interpolate( aiQuaternion& pOut, const aiQuaternion& p
inline aiQuaternion& aiQuaternion::Normalize()
{
// compute the magnitude and divide through it
const float mag = x*x+y*y+z*z+w*w;
const float mag = sqrt(x*x + y*y + z*z + w*w);
if (mag)
{
x /= mag;
y /= mag;
z /= mag;
w /= mag;
const float invMag = 1.0f/mag;
x *= invMag;
y *= invMag;
z *= invMag;
w *= invMag;
}
return *this;
}
Expand Down

0 comments on commit bd92f15

Please sign in to comment.