~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: MT_Quaternion.h,v 1.6 2002/12/26 18:25:15 mein Exp $
 
2
 * $Id: MT_Quaternion.h,v 1.8 2005/03/25 14:48:29 sirdude Exp $
3
3
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or
59
59
    MT_Quaternion(const double v[4]) : MT_Vector4(v) {}
60
60
    MT_Quaternion(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz, MT_Scalar ww) :
61
61
        MT_Vector4(xx, yy, zz, ww) {}
62
 
    MT_Quaternion(const MT_Vector3& axis, MT_Scalar angle) { 
63
 
        setRotation(axis, angle); 
 
62
    MT_Quaternion(const MT_Vector3& axis, MT_Scalar mt_angle) { 
 
63
        setRotation(axis, mt_angle); 
64
64
    }
65
65
    MT_Quaternion(MT_Scalar yaw, MT_Scalar pitch, MT_Scalar roll) { 
66
66
        setEuler(yaw, pitch, roll); 
67
67
    }
68
68
 
69
 
    void setRotation(const MT_Vector3& axis, MT_Scalar angle) {
 
69
    void setRotation(const MT_Vector3& axis, MT_Scalar mt_angle) {
70
70
        MT_Scalar d = axis.length();
71
71
        MT_assert(!MT_fuzzyZero(d));
72
 
        MT_Scalar s = sin(angle * MT_Scalar(0.5)) / d;
 
72
        MT_Scalar s = sin(mt_angle * MT_Scalar(0.5)) / d;
73
73
        setValue(axis[0] * s, axis[1] * s, axis[2] * s, 
74
 
                 cos(angle * MT_Scalar(0.5)));
 
74
                 cos(mt_angle * MT_Scalar(0.5)));
75
75
    }
76
76
 
77
77
    void setEuler(MT_Scalar yaw, MT_Scalar pitch, MT_Scalar roll) {
95
95
    void invert();
96
96
    MT_Quaternion inverse() const;
97
97
 
 
98
    MT_Scalar angle(const MT_Quaternion& q) const;
 
99
    MT_Quaternion slerp(const MT_Quaternion& q, const MT_Scalar& t) const;
 
100
    
98
101
    static MT_Quaternion random();
99
102
};
100
103