瀏覽代碼

bugfix:
- add global namespace statement to sqrt.

refactoring:
- include cmath instead of math.h in c++ API.

Signed-off-by: Kim Kulling <[email protected]>

Kim Kulling 11 年之前
父節點
當前提交
f9d5852ef9
共有 4 個文件被更改,包括 18 次插入5 次删除
  1. 6 1
      include/assimp/matrix4x4.inl
  2. 5 1
      include/assimp/vector2.h
  3. 5 2
      include/assimp/vector3.h
  4. 2 1
      include/assimp/vector3.inl

+ 6 - 1
include/assimp/matrix4x4.inl

@@ -53,7 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <algorithm>
 #include <limits>
-#include <math.h>
+
+#ifdef __cplusplus
+#   include <cmath>
+#else
+#   include <math.h>
+#endif
 
 // ----------------------------------------------------------------------------------------
 template <typename TReal>

+ 5 - 1
include/assimp/vector2.h

@@ -44,7 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AI_VECTOR2D_H_INC
 #define AI_VECTOR2D_H_INC
 
-#include <math.h>
+#ifdef __cplusplus
+#   include <cmath>
+#else
+#   include <math.h>
+#endif
 
 #include "./Compiler/pushpack1.h"
 

+ 5 - 2
include/assimp/vector3.h

@@ -44,8 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AI_VECTOR3D_H_INC
 #define AI_VECTOR3D_H_INC
 
-#include <math.h>
-
+#ifdef __cplusplus
+#   include <cmath>
+#else
+#   include <math.h>
+#endif
 
 #include "./Compiler/pushpack1.h"
 

+ 2 - 1
include/assimp/vector3.inl

@@ -90,7 +90,7 @@ AI_FORCE_INLINE TReal aiVector3t<TReal>::SquareLength() const {
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
 AI_FORCE_INLINE TReal aiVector3t<TReal>::Length() const {
-	return sqrt( SquareLength()); 
+	return ::sqrt( SquareLength()); 
 }
 // ------------------------------------------------------------------------------------------------
 template <typename TReal>
@@ -207,6 +207,7 @@ AI_FORCE_INLINE  aiVector3t<TReal> operator - ( const aiVector3t<TReal>& v)	{
 	return aiVector3t<TReal>( -v.x, -v.y, -v.z);
 }
 
+// ------------------------------------------------------------------------------------------------
 
 #endif // __cplusplus
 #endif // AI_VECTOR3D_INL_INC