Monobjc.GLKit.GLKMatrix3.MakeWithQuaternion C# (CSharp) Method

MakeWithQuaternion() public static method

Returns a 3x3 matrix that performs a rotation based on a quaternion.

Original signature is 'GLKMatrix3 GLKMatrix3MakeWithQuaternion ( GLKQuaternion quaternion );'

Available in OS X x0.8 and later.

public static MakeWithQuaternion ( GLKQuaternion quaternion ) : GLKMatrix3
quaternion GLKQuaternion MISSING
return GLKMatrix3
		public static GLKMatrix3 MakeWithQuaternion (GLKQuaternion quaternion)
		{
			quaternion = GLKQuaternion.Normalize (quaternion);
    
			float x = quaternion.x;
			float y = quaternion.y;
			float z = quaternion.z;
			float w = quaternion.w;
    
			float _2x = x + x;
			float _2y = y + y;
			float _2z = z + z;
			float _2w = w + w;
    
			GLKMatrix3 m = new GLKMatrix3 (1.0f - _2y * y - _2z * z,
                    _2x * y + _2w * z,
                    _2x * z - _2w * y,

                    _2x * y - _2w * z,
                    1.0f - _2x * x - _2z * z,
                    _2y * z + _2w * x,

                    _2x * z + _2w * y,
                    _2y * z - _2w * x,
                    1.0f - _2x * x - _2y * y);
    
			return m;
		}