- on Ton's request use double versions of cos,sin,tan, sqrt etc.
just like Solid in MT_Scalar #if defined (__sun) || defined (__sun__) || defined (__sparc) || defined (__APPLE__)
- updated an url in the header of files
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
return tmp;
}
else {
- SimdScalar s = sqrtf(v[coneindices[0]] * v[coneindices[0]] + v[coneindices[2]] * v[coneindices[2]]);
+ SimdScalar s = SimdSqrt(v[coneindices[0]] * v[coneindices[0]] + v[coneindices[2]] * v[coneindices[2]]);
if (s > SIMD_EPSILON) {
SimdScalar d = m_radius / s;
SimdVector3 tmp;
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
vec.setValue(1,0,0);
} else
{
- float rlen = 1.f / sqrtf(lenSqr );
+ float rlen = 1.f / SimdSqrt(lenSqr );
vec *= rlen;
}
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
SimdVector3 tmp;
SimdScalar d ;
- SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+ SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
if (s != SimdScalar(0.0))
{
d = radius / s;
SimdVector3 tmp;
SimdScalar d ;
- SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+ SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
if (s != SimdScalar(0.0))
{
d = radius / s;
SimdVector3 tmp;
SimdScalar d ;
- SimdScalar s = sqrtf(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
+ SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]);
if (s != SimdScalar(0.0))
{
d = radius / s;
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
vec.setValue(1,0,0);
} else
{
- float rlen = 1.f / sqrtf(lenSqr );
+ float rlen = 1.f / SimdSqrt(lenSqr );
vec *= rlen;
}
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
vec.setValue(1,0,0);
} else
{
- float rlen = 1.f / sqrtf(lenSqr );
+ float rlen = 1.f / SimdSqrt(lenSqr );
vec *= rlen;
}
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
float radius = m_radius - GetMargin();
SimdScalar len = vec.length2();
- if (fabsf(len) < 0.0001f)
+ if (SimdFabs(len) < 0.0001f)
{
return SimdVector3(m_localScaling[0] * radius,m_localScaling[1]*radius,m_localScaling[2]*radius);
}
- return vec * (m_localScaling*(radius / sqrtf(len)));
+ return vec * (m_localScaling*(radius / SimdSqrt(len)));
}
SimdVector3 SphereShape::LocalGetSupportingVertex(const SimdVector3& vec)const
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
basic_h_local = p * 0.5f;
basic_h_local_delta = basic_h_local * basic_h_local - q;
if (basic_h_local_delta > 0.0f) {
- basic_h_local_delta = sqrtf(basic_h_local_delta);
+ basic_h_local_delta = SimdSqrt(basic_h_local_delta);
m_roots[0] = - basic_h_local + basic_h_local_delta;
m_roots[1] = - basic_h_local - basic_h_local_delta;
return 2;
SimdScalar radical = b * b - 4.0f * a * c;
if(radical >= 0.f)
{
- SimdScalar sqrtRadical = sqrtf(radical);
+ SimdScalar sqrtRadical = SimdSqrt(radical);
SimdScalar idenom = 1.0f/(2.0f * a);
m_roots[0]=(-b + sqrtRadical) * idenom;
m_roots[1]=(-b - sqrtRadical) * idenom;
#define cubic_rt(x) \
- ((x) > 0.0f ? powf((SimdScalar)(x), 0.333333333333333333333333f) : \
- ((x) < 0.0f ? -powf((SimdScalar)-(x), 0.333333333333333333333333f) : 0.0f))
+ ((x) > 0.0f ? SimdPow((SimdScalar)(x), 0.333333333333333333333333f) : \
+ ((x) < 0.0f ? -SimdPow((SimdScalar)-(x), 0.333333333333333333333333f) : 0.0f))
/* */
/* one real and two complex roots. note that v = -p / u. */
/* */
- u = -q + sqrtf(delta);
+ u = -q + SimdSqrt(delta);
u = cubic_rt(u);
m_roots[0] = u - p / u - a;
return 1;
/* */
/* Casus irreducibilis: we have three real roots */
/* */
- r = sqrtf(-p);
+ r = SimdSqrt(-p);
p *= -r;
r *= 2.0;
- phi = acosf(-q / p) / 3.0f;
+ phi = SimdAcos(-q / p) / 3.0f;
dummy = SIMD_2_PI / 3.0f;
- m_roots[0] = r * cosf(phi) - a;
- m_roots[1] = r * cosf(phi + dummy) - a;
- m_roots[2] = r * cosf(phi - dummy) - a;
+ m_roots[0] = r * SimdCos(phi) - a;
+ m_roots[1] = r * SimdCos(phi + dummy) - a;
+ m_roots[2] = r * SimdCos(phi - dummy) - a;
return 3;
}
else {
if (m_roots[0] > 0.0f) {
if (num_roots > 1) {
if ((m_roots[1] > 0.0f) && (m_roots[1] != m_roots[0])) {
- u = sqrtf(m_roots[1]);
+ u = SimdSqrt(m_roots[1]);
m_roots[2] = u - a;
m_roots[3] = -u - a;
- u = sqrtf(m_roots[0]);
+ u = SimdSqrt(m_roots[0]);
m_roots[0] = u - a;
m_roots[1] = -u - a;
return 4;
}
else {
- u = sqrtf(m_roots[0]);
+ u = SimdSqrt(m_roots[0]);
m_roots[0] = u - a;
m_roots[1] = -u - a;
return 2;
}
}
else {
- u = sqrtf(m_roots[0]);
+ u = SimdSqrt(m_roots[0]);
m_roots[0] = u - a;
m_roots[1] = -u - a;
return 2;
if (SimdEqual(u, SIMD_EPSILON))
u = 0.0;
else if (u > 0.0f)
- u = sqrtf(u);
+ u = SimdSqrt(u);
else
return 0;
if (SimdEqual(v, SIMD_EPSILON))
v = 0.0;
else if (v > 0.0f)
- v = sqrtf(v);
+ v = SimdSqrt(v);
else
return 0;
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
linvel.setValue(0.,0.,0.);
}
SimdVector3 angvel;
- angvel[0] = 2.f * asinf (qrel[0]);
- angvel[1] = 2.f * asinf (qrel[1]);
- angvel[2] = 2.f * asinf (qrel[2]);
+ angvel[0] = 2.f * SimdAsin (qrel[0]);
+ angvel[1] = 2.f * SimdAsin (qrel[1]);
+ angvel[2] = 2.f * SimdAsin (qrel[2]);
if (angvel.length() < SCREWEPSILON)
{
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
//edge doesn't intersect the circle (motion of the vertex)
return false;
}
- SimdScalar rad = sqrtf(r2);
+ SimdScalar rad = SimdSqrt(r2);
if (SimdFuzzyZero(disc))
{
{
SimdScalar mu;
- intersectPt.setY((-2.f*aa*bb+2.f*sqrtf(disc))/(2.f*(aa*aa+1.f)));
+ intersectPt.setY((-2.f*aa*bb+2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f)));
intersectPt.setX(aa*intersectPt.y()+bb);
mu = ((intersectPt.getY()-c.getY())/v.getY());
if (0.f <= mu && mu <= 1.f)
{
hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime);
}
- intersectPt.setY((-2.f*aa*bb-2.f*sqrtf(disc))/(2.f*(aa*aa+1.f)));
+ intersectPt.setY((-2.f*aa*bb-2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f)));
intersectPt.setX(aa*intersectPt.y()+bb);
mu = ((intersectPt.getY()-c.getY())/v.getY());
if (0 <= mu && mu <= 1)
{
SimdScalar mu;
- intersectPt.setX((-2.f*aa*bb+2.f*sqrtf(disc))/(2*(aa*aa+1.f)));
+ intersectPt.setX((-2.f*aa*bb+2.f*SimdSqrt(disc))/(2*(aa*aa+1.f)));
intersectPt.setY(aa*intersectPt.x()+bb);
mu = ((intersectPt.getX()-c.getX())/v.getX());
if (0 <= mu && mu <= 1)
{
hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime);
}
- intersectPt.setX((-2.f*aa*bb-2.f*sqrtf(disc))/(2.f*(aa*aa+1.f)));
+ intersectPt.setX((-2.f*aa*bb-2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f)));
intersectPt.setY(aa*intersectPt.x()+bb);
mu = ((intersectPt.getX()-c.getX())/v.getX());
if (0.f <= mu && mu <= 1.f)
t1 = v.y()*s; t2 = t1*u.x();
t3 = v.x()*s;
t4 = t3*u.y();
- t7 = tanf(w/2.0f);
+ t7 = SimdTan(w/2.0f);
t8 = 1.0f/t7;
t10 = 1.0f/v.z();
aa = (t2-t4)*t8*t10;
t2 = t1*vx;
t3 = ux*s;
t4 = t3*vy;
- t7 = tanf(w/2.0f);
+ t7 = SimdTan(w/2.0f);
t8 = 1/t7;
t10 = 1/uz;
t13 = ux*az;
if (!SimdFuzzyZero(v.z()))
{
SimdScalar A1=(ux-ux*tau*tau-2.f*tau*uy)-((1.f+tau*tau)*vx*uz/vz);
- SimdScalar B1=((1.f+tau*tau)*(cx*tanf(1.f/2.f*w)*vz+
- vx*az*tanf(1.f/2.f*w)-vx*cz*tanf(1.f/2.f*w)+
- vx*s*tau)/tanf(1.f/2.f*w)/vz)-(ax-ax*tau*tau-2.f*tau*ay);
+ SimdScalar B1=((1.f+tau*tau)*(cx*SimdTan(1.f/2.f*w)*vz+
+ vx*az*SimdTan(1.f/2.f*w)-vx*cz*SimdTan(1.f/2.f*w)+
+ vx*s*tau)/SimdTan(1.f/2.f*w)/vz)-(ax-ax*tau*tau-2.f*tau*ay);
lambda = B1/A1;
- mu = (a.z()-c.z()+lambda*u.z()+(s*tau)/(tanf(w/2.f)))/v.z();
+ mu = (a.z()-c.z()+lambda*u.z()+(s*tau)/(SimdTan(w/2.f)))/v.z();
//double check in original equation
SimdScalar rhs = c.x()+mu*v.x();
- rhs = ((1.f+tau*tau)*(cx*tanf(1.f/2.f*w)*vz+vx*az*tanf(1.f/2.f*w)-
- vx*cz*tanf(1.f/2.f*w)+vx*s*tau)/(tanf(1.f/2.f*w)*vz))-
+ rhs = ((1.f+tau*tau)*(cx*SimdTan(1.f/2.f*w)*vz+vx*az*SimdTan(1.f/2.f*w)-
+ vx*cz*SimdTan(1.f/2.f*w)+vx*s*tau)/(SimdTan(1.f/2.f*w)*vz))-
(ax-ax*tau*tau-2.f*tau*ay);
}
- SimdScalar t = 2.f*atanf(tau)/screwAB.GetW();
+ SimdScalar t = 2.f*SimdAtan(tau)/screwAB.GetW();
//tau = tan (wt/2) so 2*atan (tau)/w
if (t>=0.f && t<minTime)
{
// now calculate the planeEquation for the vertex motion,
// and check if the intersectionpoint is at the positive side
- SimdPoint3 rotPt1(cosf(rotW)*rotPt.x()-sinf(rotW)*rotPt.y(),
- sinf(rotW)*rotPt.x()+cosf(rotW)*rotPt.y(),
+ SimdPoint3 rotPt1(SimdCos(rotW)*rotPt.x()-SimdSin(rotW)*rotPt.y(),
+ SimdSin(rotW)*rotPt.x()+SimdCos(rotW)*rotPt.y(),
0.f);
SimdVector3 rotVec = rotPt1-rotPt;
//hypothenuse = sqrt(r2);
SimdScalar adjacent = intersectPt.dot(rotPt)/rotRadius;
SimdScalar hypo = rotRadius;
- SimdScalar alpha = acosf(adjacent/hypo);
+ SimdScalar alpha = SimdAcos(adjacent/hypo);
SimdScalar t = alpha / rotW;
if (t >= 0 && t < minTime)
{
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Stephane Redon / Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Stephane Redon / Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
// u : vector along the screwing axis (||u||=1)
// o : point on the screwing axis
- m_w=sqrtf(wx*wx+wy*wy+wz*wz);
+ m_w=SimdSqrt(wx*wx+wy*wy+wz*wz);
//if (!w) {
if (fabs(m_w)<SCREWEPSILON ) {
assert(m_w == 0.f);
m_w=0.;
- m_s=sqrtf(dx*dx+dy*dy+dz*dz);
+ m_s=SimdSqrt(dx*dx+dy*dy+dz*dz);
if (fabs(m_s)<SCREWEPSILON ) {
assert(m_s == 0.);
n1.normalize();
SimdVector3 n1orth=m_u.cross(n1);
- float n2x=cosf(0.5f*m_w);
- float n2y=sinf(0.5f*m_w);
+ float n2x=SimdCos(0.5f*m_w);
+ float n2y=SimdSin(0.5f*m_w);
m_o=0.5f*t.dot(n1)*(n1+n2x/n2y*n1orth);
}
if ((m_u[0]>SCREWEPSILON)||(m_u[0]<-SCREWEPSILON)||(m_u[1]>SCREWEPSILON)||(m_u[1]<-SCREWEPSILON))
{
// to avoid numerical problems
- float n=sqrtf(m_u[0]*m_u[0]+m_u[1]*m_u[1]);
+ float n=SimdSqrt(m_u[0]*m_u[0]+m_u[1]*m_u[1]);
float invn=1.0f/n;
SimdMatrix3x3 mat;
SimdPoint3 org = tr.getOrigin();
SimdPoint3 neworg (
- org.x()*cosf(m_w*t)-org.y()*sinf(m_w*t),
- org.x()*sinf(m_w*t)+org.y()*cosf(m_w*t),
+ org.x()*SimdCos(m_w*t)-org.y()*SimdSin(m_w*t),
+ org.x()*SimdSin(m_w*t)+org.y()*SimdCos(m_w*t),
org.z()+m_s*CalculateF(t));
SimdTransform newtr;
result = t;
} else
{
- result = ( tanf((m_w*t)/2.f) / tanf(m_w/2.f));
+ result = ( SimdTan((m_w*t)/2.f) / SimdTan(m_w/2.f));
}
return result;
}
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
inline SimdPoint3 InBetweenPosition(const SimdPoint3& pt,SimdScalar t) const
{
return SimdPoint3(
- pt.x()*cosf(m_w*t)-pt.y()*sinf(m_w*t),
- pt.x()*sinf(m_w*t)+pt.y()*cosf(m_w*t),
+ pt.x()*SimdCos(m_w*t)-pt.y()*SimdSin(m_w*t),
+ pt.x()*SimdSin(m_w*t)+pt.y()*SimdCos(m_w*t),
pt.z()+m_s*CalculateF(t));
}
inline SimdVector3 InBetweenVector(const SimdVector3& vec,SimdScalar t) const
{
return SimdVector3(
- vec.x()*cosf(m_w*t)-vec.y()*sinf(m_w*t),
- vec.x()*sinf(m_w*t)+vec.y()*cosf(m_w*t),
+ vec.x()*SimdCos(m_w*t)-vec.y()*SimdSin(m_w*t),
+ vec.x()*SimdSin(m_w*t)+vec.y()*SimdCos(m_w*t),
vec.z());
}
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
#define BU_Polynomial BU_IntervalArithmeticPolynomialSolver
#endif
-inline bool TestFuzzyZero(SimdScalar x) { return fabsf(x) < 0.0001f; }
+inline bool TestFuzzyZero(SimdScalar x) { return SimdFabs(x) < 0.0001f; }
BU_VertexPoly::BU_VertexPoly()
//ax^3+bx^2+cx+d=0
//degenerate coefficients mess things up :(
- SimdScalar ietsje = (r*s)/tanf(w/2.f);
+ SimdScalar ietsje = (r*s)/SimdTan(w/2.f);
if (ietsje*ietsje < 0.01f)
ietsje = 0.f;
{
SimdScalar tau = polynomialSolver.GetRoot(i);
- SimdScalar t = 2.f*atanf(tau)/w;
+ SimdScalar t = 2.f*SimdAtan(tau)/w;
//tau = tan (wt/2) so 2*atan (tau)/w
if (swapAB)
{
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
-* Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+* Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
//valid normal
if (lenSqr > SIMD_EPSILON)
{
- float rlen = 1.f / sqrtf(lenSqr );
+ float rlen = 1.f / SimdSqrt(lenSqr );
normalInB *= rlen; //normalize
- SimdScalar s = sqrtf(squaredDistance);
+ SimdScalar s = SimdSqrt(squaredDistance);
ASSERT(s > SimdScalar(0.0));
pointOnA -= m_cachedSeparatingAxis * (marginA / s);
pointOnB += m_cachedSeparatingAxis * (marginB / s);
float lenSqr = normalInB.length2();
if (lenSqr > SIMD_EPSILON)
{
- normalInB /= sqrtf(lenSqr);
+ normalInB /= SimdSqrt(lenSqr);
distance = -(pointOnA-pointOnB).length();
} else
{
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
-* Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+* Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
-* Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+* Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
// the constraints are ordered so that all lambda[] values needed have
// already been computed.
if (findex[index] >= 0) {
- hi[index] = fabsf (hicopy[index] * lambda[findex[index]]);
+ hi[index] = SimdFabs (hicopy[index] * lambda[findex[index]]);
lo[index] = -hi[index];
}
#define M_SQRT12 SimdScalar(0.7071067811865475244008443621048490)
-#define dRecipSqrt(x) ((float)(1.0f/sqrtf(float(x)))) /* reciprocal square root */
+#define dRecipSqrt(x) ((float)(1.0f/SimdSqrt(float(x)))) /* reciprocal square root */
void dPlaneSpace1 (const dVector3 n, dVector3 p, dVector3 q)
{
- if (fabsf(n[2]) > M_SQRT12) {
+ if (SimdFabs(n[2]) > M_SQRT12) {
// choose p in y-z plane
SimdScalar a = n[1]*n[1] + n[2]*n[2];
SimdScalar k = dRecipSqrt (a);
m_angularVelocity(0.f,0.f,0.f),
m_restitution(restitution),
m_friction(friction)
-
{
m_debugBodyId = uniqueId++;
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
void setEulerYPR(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll)
{
- SimdScalar cy(cosf(yaw));
- SimdScalar sy(sinf(yaw));
- SimdScalar cp(cosf(pitch));
- SimdScalar sp(sinf(pitch));
- SimdScalar cr(cosf(roll));
- SimdScalar sr(sinf(roll));
+ SimdScalar cy(SimdCos(yaw));
+ SimdScalar sy(SimdSin(yaw));
+ SimdScalar cp(SimdCos(pitch));
+ SimdScalar sp(SimdSin(pitch));
+ SimdScalar cr(SimdCos(roll));
+ SimdScalar sr(SimdSin(roll));
SimdScalar cc = cy * cr;
SimdScalar cs = cy * sr;
SimdScalar sc = sy * cr;
**/
void setEulerZYX(SimdScalar eulerX,SimdScalar eulerY,SimdScalar eulerZ) {
- SimdScalar ci ( cosf(eulerX));
- SimdScalar cj ( cosf(eulerY));
- SimdScalar ch ( cosf(eulerZ));
- SimdScalar si ( sinf(eulerX));
- SimdScalar sj ( sinf(eulerY));
- SimdScalar sh ( sinf(eulerZ));
+ SimdScalar ci ( SimdCos(eulerX));
+ SimdScalar cj ( SimdCos(eulerY));
+ SimdScalar ch ( SimdCos(eulerZ));
+ SimdScalar si ( SimdSin(eulerX));
+ SimdScalar sj ( SimdSin(eulerY));
+ SimdScalar sh ( SimdSin(eulerZ));
SimdScalar cc = ci * ch;
SimdScalar cs = ci * sh;
SimdScalar sc = si * ch;
if (trace > SimdScalar(0.0))
{
- SimdScalar s = sqrtf(trace + SimdScalar(1.0));
+ SimdScalar s = SimdSqrt(trace + SimdScalar(1.0));
q[3] = s * SimdScalar(0.5);
s = SimdScalar(0.5) / s;
int j = (i + 1) % 3;
int k = (i + 2) % 3;
- SimdScalar s = sqrtf(m_el[i][i] - m_el[j][j] - m_el[k][k] + SimdScalar(1.0));
+ SimdScalar s = SimdSqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + SimdScalar(1.0));
q[i] = s * SimdScalar(0.5);
s = SimdScalar(0.5) / s;
void getEuler(SimdScalar& yaw, SimdScalar& pitch, SimdScalar& roll) const
{
- pitch = SimdScalar(asinf(-m_el[2][0]));
+ pitch = SimdScalar(SimdAsin(-m_el[2][0]));
if (pitch < SIMD_2_PI)
{
if (pitch > SIMD_2_PI)
{
- yaw = SimdScalar(atan2f(m_el[1][0], m_el[0][0]));
- roll = SimdScalar(atan2f(m_el[2][1], m_el[2][2]));
+ yaw = SimdScalar(SimdAtan2(m_el[1][0], m_el[0][0]));
+ roll = SimdScalar(SimdAtan2(m_el[2][1], m_el[2][2]));
}
else
{
- yaw = SimdScalar(-atan2f(-m_el[0][1], m_el[0][2]));
+ yaw = SimdScalar(-SimdAtan2(-m_el[0][1], m_el[0][2]));
roll = SimdScalar(0.0);
}
}
else
{
- yaw = SimdScalar(atan2f(-m_el[0][1], m_el[0][2]));
+ yaw = SimdScalar(SimdAtan2(-m_el[0][1], m_el[0][2]));
roll = SimdScalar(0.0);
}
}
SimdMatrix3x3::absolute() const
{
return SimdMatrix3x3(
- fabsf(m_el[0][0]), fabsf(m_el[0][1]), fabsf(m_el[0][2]),
- fabsf(m_el[1][0]), fabsf(m_el[1][1]), fabsf(m_el[1][2]),
- fabsf(m_el[2][0]), fabsf(m_el[2][1]), fabsf(m_el[2][2]));
+ SimdFabs(m_el[0][0]), SimdFabs(m_el[0][1]), SimdFabs(m_el[0][2]),
+ SimdFabs(m_el[1][0]), SimdFabs(m_el[1][1]), SimdFabs(m_el[1][2]),
+ SimdFabs(m_el[2][0]), SimdFabs(m_el[2][1]), SimdFabs(m_el[2][2]));
}
SIMD_FORCE_INLINE SimdMatrix3x3
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
{
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)
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,
SimdScalar length() const
{
- return sqrtf(length2());
+ return SimdSqrt(length2());
}
SimdQuaternion& normalize()
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;
}
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,
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
#endif
+
+
#define ASSERT assert
#endif
typedef float SimdScalar;
+#if defined (__sun) || defined (__sun__) || defined (__sparc) || defined (__APPLE__)
+//use double float precision operation on those platforms for Blender
+
+SIMD_FORCE_INLINE SimdScalar SimdSqrt(SimdScalar x) { return sqrt(x); }
+SIMD_FORCE_INLINE SimdScalar SimdFabs(SimdScalar x) { return fabs(x); }
+SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cos(x); }
+SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sin(x); }
+SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tan(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acos(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asin(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atan(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2(x, y); }
+SIMD_FORCE_INLINE SimdScalar SimdExp(SimdScalar x) { return exp(x); }
+SIMD_FORCE_INLINE SimdScalar SimdLog(SimdScalar x) { return log(x); }
+SIMD_FORCE_INLINE SimdScalar SimdPow(SimdScalar x,SimdScalar y) { return pow(x,y); }
+
+#else
+
+SIMD_FORCE_INLINE SimdScalar SimdSqrt(SimdScalar x) { return sqrtf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdFabs(SimdScalar x) { return fabsf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cosf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sinf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tanf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acosf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asinf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atanf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2f(x, y); }
+SIMD_FORCE_INLINE SimdScalar SimdExp(SimdScalar x) { return expf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdLog(SimdScalar x) { return logf(x); }
+SIMD_FORCE_INLINE SimdScalar SimdPow(SimdScalar x,SimdScalar y) { return powf(x,y); }
+
+#endif
+
+
const SimdScalar SIMD_2_PI = 6.283185307179586232f;
const SimdScalar SIMD_PI = SIMD_2_PI * SimdScalar(0.5f);
const SimdScalar SIMD_HALF_PI = SIMD_2_PI * SimdScalar(0.25f);
const SimdScalar SIMD_EPSILON = FLT_EPSILON;
const SimdScalar SIMD_INFINITY = FLT_MAX;
-SIMD_FORCE_INLINE bool SimdFuzzyZero(SimdScalar x) { return fabsf(x) < SIMD_EPSILON; }
+SIMD_FORCE_INLINE bool SimdFuzzyZero(SimdScalar x) { return SimdFabs(x) < SIMD_EPSILON; }
SIMD_FORCE_INLINE bool SimdEqual(SimdScalar a, SimdScalar eps) {
return (((a) <= eps) && !((a) < -eps));
SIMD_FORCE_INLINE bool SimdGreaterEqual (SimdScalar a, SimdScalar eps) {
return (!((a) <= eps));
}
-
-SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cosf(x); }
-SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sinf(x); }
-SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tanf(x); }
SIMD_FORCE_INLINE int SimdSign(SimdScalar x) {
return x < 0.0f ? -1 : x > 0.0f ? 1 : 0;
}
-SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acosf(x); }
-SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asinf(x); }
-SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atanf(x); }
-SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2f(x, y); }
SIMD_FORCE_INLINE SimdScalar SimdRadians(SimdScalar x) { return x * SIMD_RADS_PER_DEG; }
SIMD_FORCE_INLINE SimdScalar SimdDegrees(SimdScalar x) { return x * SIMD_DEGS_PER_RAD; }
-#endif
+
+
+#endif //SIMD___SCALAR_H
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
/*
- * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
+ * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
else
{
// sync(fAngle) = sin(c*fAngle)/t
- axis = angvel*( sinf(0.5f*fAngle*timeStep)/fAngle );
+ axis = angvel*( SimdSin(0.5f*fAngle*timeStep)/fAngle );
}
- SimdQuaternion dorn (axis.x(),axis.y(),axis.z(),cosf( fAngle*timeStep*0.5f ));
+ SimdQuaternion dorn (axis.x(),axis.y(),axis.z(),SimdCos( fAngle*timeStep*0.5f ));
SimdQuaternion orn0 = curTrans.getRotation();
SimdQuaternion predictedOrn = dorn * orn0;
if (len < 0.001f)
axis = SimdVector3(1.f,0.f,0.f);
else
- axis /= sqrtf(len);
+ axis /= SimdSqrt(len);
angVel = axis * angle / timeStep;
/*
-Copyright (c) 2005 Gino van den Bergen / Erwin Coumans <www.erwincoumans.com>
+Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
SIMD_FORCE_INLINE SimdScalar length() const
{
- return sqrtf(length2());
+ return SimdSqrt(length2());
}
SIMD_FORCE_INLINE SimdScalar distance2(const SimdVector3& v) const;
SIMD_FORCE_INLINE SimdScalar angle(const SimdVector3& v) const
{
- SimdScalar s = sqrtf(length2() * v.length2());
+ SimdScalar s = SimdSqrt(length2() * v.length2());
assert(s != SimdScalar(0.0));
- return acosf(dot(v) / s);
+ return SimdAcos(dot(v) / s);
}
SIMD_FORCE_INLINE SimdVector3 absolute() const
{
return SimdVector3(
- fabsf(m_x),
- fabsf(m_y),
- fabsf(m_z));
+ SimdFabs(m_x),
+ SimdFabs(m_y),
+ SimdFabs(m_z));
}
SIMD_FORCE_INLINE SimdVector3 cross(const SimdVector3& v) const
SIMD_FORCE_INLINE SimdVector4 absolute4() const
{
return SimdVector4(
- fabsf(m_x),
- fabsf(m_y),
- fabsf(m_z),
- fabsf(m_unusedW));
+ SimdFabs(m_x),
+ SimdFabs(m_y),
+ SimdFabs(m_z),
+ SimdFabs(m_unusedW));
}