Bugfix #4081: support for OpenBSD platform for scons. Big thanks to Nathan Houghton...
[blender-staging.git] / extern / bullet / LinearMath / SimdQuaternion.h
index 6a8513ae0d9058c3080b1e99de9fb99077da6c96..2d152268ead77b3a1853290774abd9b16c88dd0d 100644 (file)
@@ -1,31 +1,19 @@
 /*
+Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/
 
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+This software is provided 'as-is', without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose, 
+including commercial applications, and to alter it and redistribute it freely, 
+subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
 */
 
 
+
 #ifndef SIMD__QUATERNION_H_
 #define SIMD__QUATERNION_H_
 
@@ -56,9 +44,9 @@ public:
        {
                SimdScalar d = axis.length();
                assert(d != SimdScalar(0.0));
-               SimdScalar s = sinf(angle * SimdScalar(0.5)) / d;
+               SimdScalar s = SimdSin(angle * SimdScalar(0.5)) / d;
                setValue(axis.x() * s, axis.y() * s, axis.z() * s, 
-                       cosf(angle * SimdScalar(0.5)));
+                       SimdCos(angle * SimdScalar(0.5)));
        }
 
        void setEuler(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll)
@@ -66,12 +54,12 @@ public:
                SimdScalar halfYaw = SimdScalar(yaw) * SimdScalar(0.5);  
                SimdScalar halfPitch = SimdScalar(pitch) * SimdScalar(0.5);  
                SimdScalar halfRoll = SimdScalar(roll) * SimdScalar(0.5);  
-               SimdScalar cosYaw = cosf(halfYaw);
-               SimdScalar sinYaw = sinf(halfYaw);
-               SimdScalar cosPitch = cosf(halfPitch);
-               SimdScalar sinPitch = sinf(halfPitch);
-               SimdScalar cosRoll = cosf(halfRoll);
-               SimdScalar sinRoll = sinf(halfRoll);
+               SimdScalar cosYaw = SimdCos(halfYaw);
+               SimdScalar sinYaw = SimdSin(halfYaw);
+               SimdScalar cosPitch = SimdCos(halfPitch);
+               SimdScalar sinPitch = SimdSin(halfPitch);
+               SimdScalar cosRoll = SimdCos(halfRoll);
+               SimdScalar sinRoll = SimdSin(halfRoll);
                setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw,
                        cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw,
                        sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw,
@@ -118,7 +106,7 @@ public:
 
        SimdScalar length() const
        {
-               return sqrtf(length2());
+               return SimdSqrt(length2());
        }
 
        SimdQuaternion& normalize() 
@@ -155,14 +143,14 @@ public:
 
        SimdScalar angle(const SimdQuaternion& q) const 
        {
-               SimdScalar s = sqrtf(length2() * q.length2());
+               SimdScalar s = SimdSqrt(length2() * q.length2());
                assert(s != SimdScalar(0.0));
-               return acosf(dot(q) / s);
+               return SimdAcos(dot(q) / s);
        }
 
        SimdScalar getAngle() const 
        {
-               SimdScalar s = 2.f * acosf(m_unusedW);
+               SimdScalar s = 2.f * SimdAcos(m_unusedW);
                return s;
        }
 
@@ -208,9 +196,9 @@ public:
                SimdScalar theta = angle(q);
                if (theta != SimdScalar(0.0))
                {
-                       SimdScalar d = SimdScalar(1.0) / sinf(theta);
-                       SimdScalar s0 = sinf((SimdScalar(1.0) - t) * theta);
-                       SimdScalar s1 = sinf(t * theta);   
+                       SimdScalar d = SimdScalar(1.0) / SimdSin(theta);
+                       SimdScalar s0 = SimdSin((SimdScalar(1.0) - t) * theta);
+                       SimdScalar s1 = SimdSin(t * theta);   
                        return SimdQuaternion((m_x * s0 + q.x() * s1) * d,
                                (m_y * s0 + q.y() * s1) * d,
                                (m_z * s0 + q.z() * s1) * d,