~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to intern/moto/include/MT_Quaternion.inl

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
 
75
75
GEN_INLINE MT_Quaternion MT_Quaternion::slerp(const MT_Quaternion& q, const MT_Scalar& t) const
76
76
{
77
 
        MT_Scalar theta = angle(q);
78
 
        
79
 
        if (!MT_fuzzyZero(theta))
 
77
        MT_Scalar d, s0, s1;
 
78
        MT_Scalar s = dot(q);
 
79
        bool neg = (s < 0.0);
 
80
 
 
81
        if (neg)
 
82
                s = -s;
 
83
        if ((1.0 - s) > 0.0001) 
80
84
        {
81
 
                MT_Scalar d = MT_Scalar(1.0) / sin(theta);
82
 
                MT_Scalar s0 = sin((MT_Scalar(1.0) - t) * theta);
83
 
                MT_Scalar s1 = sin(t * theta);
84
 
                
85
 
                return d*(*this * s0 + q * s1);
 
85
                MT_Scalar theta = acos(s);
 
86
                d = MT_Scalar(1.0) / sin(theta);
 
87
                s0 = sin((MT_Scalar(1.0) - t) * theta);
 
88
                s1 = sin(t * theta);
86
89
        }
87
90
        else
88
91
        {
89
 
                return *this;
 
92
                d = MT_Scalar(1.0);
 
93
                s0 = MT_Scalar(1.0) - t;
 
94
                s1 = t;
90
95
        }
 
96
        if (neg)
 
97
                s1 = -s1;
 
98
        return d*(*this * s0 + q * s1);
91
99
}
92
100