diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-28 02:27:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-28 02:27:06 +0400 |
commit | e2360ab49544bb2d40308afd0f793bb11f0d474e (patch) | |
tree | fdb698f5725790adf1aeef669300c39160aab769 /intern | |
parent | f02254f02649448d69a03523d0bfd03330734ddf (diff) |
IK's were converting double -> float -> double's in a few places, since precision is important and doubles are used a lot here anyway. just use doubles, also quiet some double promotion warnings.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/iksolver/intern/IK_QJacobianSolver.cpp | 16 | ||||
-rw-r--r-- | intern/iksolver/intern/IK_QJacobianSolver.h | 2 | ||||
-rw-r--r-- | intern/iksolver/intern/IK_QSegment.cpp | 8 | ||||
-rw-r--r-- | intern/iksolver/intern/IK_QSegment.h | 4 | ||||
-rw-r--r-- | intern/iksolver/intern/IK_QTask.h | 6 | ||||
-rw-r--r-- | intern/iksolver/intern/IK_Solver.cpp | 8 |
6 files changed, 22 insertions, 22 deletions
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.cpp b/intern/iksolver/intern/IK_QJacobianSolver.cpp index fe5ecf8abe3..b310f2cdfdf 100644 --- a/intern/iksolver/intern/IK_QJacobianSolver.cpp +++ b/intern/iksolver/intern/IK_QJacobianSolver.cpp @@ -46,18 +46,18 @@ IK_QJacobianSolver::IK_QJacobianSolver() MT_Scalar IK_QJacobianSolver::ComputeScale() { std::vector<IK_QSegment*>::iterator seg; - float length = 0.0f; + MT_Scalar length = 0.0f; for (seg = m_segments.begin(); seg != m_segments.end(); seg++) length += (*seg)->MaxExtension(); - if(length == 0.0f) - return 1.0f; + if(length == 0.0) + return 1.0; else - return 1.0f/length; + return 1.0 / length; } -void IK_QJacobianSolver::Scale(float scale, std::list<IK_QTask*>& tasks) +void IK_QJacobianSolver::Scale(MT_Scalar scale, std::list<IK_QTask*>& tasks) { std::list<IK_QTask*>::iterator task; std::vector<IK_QSegment*>::iterator seg; @@ -172,8 +172,8 @@ void IK_QJacobianSolver::SetPoleVectorConstraint(IK_QSegment *tip, MT_Vector3& g static MT_Scalar safe_acos(MT_Scalar f) { // acos that does not return NaN with rounding errors - if (f <= -1.0f) return MT_PI; - else if (f >= 1.0f) return 0.0; + if (f <= -1.0) return MT_PI; + else if (f >= 1.0) return 0.0; else return acos(f); } @@ -245,7 +245,7 @@ void IK_QJacobianSolver::ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTa // we compute the pole angle that to rotate towards the target m_poleangle = angle(mat[1], polemat[1]); - if(rootz.dot(mat[1]*cos(m_poleangle) + mat[0]*sin(m_poleangle)) > 0.0f) + if(rootz.dot(mat[1]*cos(m_poleangle) + mat[0]*sin(m_poleangle)) > 0.0) m_poleangle = -m_poleangle; // solve again, with the pole angle we just computed diff --git a/intern/iksolver/intern/IK_QJacobianSolver.h b/intern/iksolver/intern/IK_QJacobianSolver.h index cfcd2849fb2..ead2b150b40 100644 --- a/intern/iksolver/intern/IK_QJacobianSolver.h +++ b/intern/iksolver/intern/IK_QJacobianSolver.h @@ -77,7 +77,7 @@ private: void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks); MT_Scalar ComputeScale(); - void Scale(float scale, std::list<IK_QTask*>& tasks); + void Scale(MT_Scalar scale, std::list<IK_QTask*>& tasks); private: diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp index d81ed453037..710faa061ce 100644 --- a/intern/iksolver/intern/IK_QSegment.cpp +++ b/intern/iksolver/intern/IK_QSegment.cpp @@ -75,9 +75,9 @@ static MT_Scalar EulerAngleFromMatrix(const MT_Matrix3x3& R, int axis) static MT_Scalar safe_acos(MT_Scalar f) { - if (f <= -1.0f) + if (f <= -1.0) return MT_PI; - else if (f >= 1.0f) + else if (f >= 1.0) return 0.0; else return acos(f); @@ -345,7 +345,7 @@ void IK_QSegment::PrependBasis(const MT_Matrix3x3& mat) m_basis = m_rest_basis.inverse() * mat * m_rest_basis * m_basis; } -void IK_QSegment::Scale(float scale) +void IK_QSegment::Scale(MT_Scalar scale) { m_start *= scale; m_translation *= scale; @@ -1035,7 +1035,7 @@ void IK_QTranslateSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) m_limit[axis]= true; } -void IK_QTranslateSegment::Scale(float scale) +void IK_QTranslateSegment::Scale(MT_Scalar scale) { int i; diff --git a/intern/iksolver/intern/IK_QSegment.h b/intern/iksolver/intern/IK_QSegment.h index 68d40829137..25a8fbc0804 100644 --- a/intern/iksolver/intern/IK_QSegment.h +++ b/intern/iksolver/intern/IK_QSegment.h @@ -170,7 +170,7 @@ public: void Reset(); // scale - virtual void Scale(float scale); + virtual void Scale(MT_Scalar scale); protected: @@ -338,7 +338,7 @@ public: void SetWeight(int axis, MT_Scalar weight); void SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax); - void Scale(float scale); + void Scale(MT_Scalar scale); private: int m_axis[3]; diff --git a/intern/iksolver/intern/IK_QTask.h b/intern/iksolver/intern/IK_QTask.h index 3d968cdfe38..45b1e59e606 100644 --- a/intern/iksolver/intern/IK_QTask.h +++ b/intern/iksolver/intern/IK_QTask.h @@ -78,7 +78,7 @@ public: virtual bool PositionTask() const { return false; } - virtual void Scale(float) {} + virtual void Scale(MT_Scalar) {} protected: int m_id; @@ -103,7 +103,7 @@ public: MT_Scalar Distance() const; bool PositionTask() const { return true; } - void Scale(float scale) { m_goal *= scale; m_clamp_length *= scale; } + void Scale(MT_Scalar scale) { m_goal *= scale; m_clamp_length *= scale; } private: MT_Vector3 m_goal; @@ -141,7 +141,7 @@ public: MT_Scalar Distance() const; - void Scale(float scale) { m_goal_center *= scale; m_distance *= scale; } + void Scale(MT_Scalar scale) { m_goal_center *= scale; m_distance *= scale; } private: MT_Scalar ComputeTotalMass(const IK_QSegment *segment); diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index 3876f26362c..7586e9e6057 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -197,14 +197,14 @@ void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax) void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness) { - if (stiffness < 0.0) + if (stiffness < 0.0f) return; - if (stiffness > 0.999) - stiffness = 0.999; + if (stiffness > 0.999f) + stiffness = 0.999f; IK_QSegment *qseg = (IK_QSegment*)seg; - MT_Scalar weight = 1.0-stiffness; + MT_Scalar weight = 1.0f - stiffness; if (axis >= IK_TRANS_X) { if(!qseg->Translational()) { |