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

MakeRotation() public static method

Returns a 3x3 matrix that performs a rotation around an arbitrary vector.

Original signature is 'GLKMatrix3 GLKMatrix3MakeRotation ( float radians, float x, float y, float z );'

Available in OS X x0.8 and later.

public static MakeRotation ( float radians, float x, float y, float z ) : GLKMatrix3
radians float MISSING
x float MISSING
y float MISSING
z float MISSING
return GLKMatrix3
		public static GLKMatrix3 MakeRotation (float radians, float x, float y, float z)
		{
			GLKVector3 v = GLKVector3.Normalize (GLKVector3.Make (x, y, z));
			float cos = (float)Math.Cos (radians);
			float cosp = 1.0f - cos;
			float sin = (float)Math.Sin (radians);
    
			GLKMatrix3 m = new GLKMatrix3 (cos + cosp * v.x * v.x,
                     cosp * v.x * v.y + v.z * sin,
                     cosp * v.x * v.z - v.y * sin,

                     cosp * v.x * v.y - v.z * sin,
                     cos + cosp * v.y * v.y,
                     cosp * v.y * v.z + v.x * sin,

                     cosp * v.x * v.z + v.y * sin,
                     cosp * v.y * v.z - v.x * sin,
                     cos + cosp * v.z * v.z);
    
			return m;
		}