#include <maya/MPxTransform.h>
#include <maya/MPxTransformationMatrix.h>
#include <maya/MGlobal.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MTransformationMatrix.h>
#include <maya/MIOStream.h>
#include "rockingTransform2.h"
#ifndef _USE_MATH_DEFINES
    #define _USE_MATH_DEFINES
#endif
#include <math.h>
MObject rockingTransform2Node::aRockInX;
 
MTypeId rockingTransform2Node::id(kRockingTransform2NodeID);
 
MTypeId rockingTransform2Matrix::id(kRockingTransform2MatrixID);
 
rockingTransform2Matrix::rockingTransform2Matrix()
{
    rockXValue = 0.0;
}
{
    return new rockingTransform2Matrix();
}
double rockingTransform2Matrix::getRockInX() const
{
    return rockXValue;
}
void rockingTransform2Matrix::setRockInX( double rock )
{
    rockXValue = rock;
}
MMatrix rockingTransform2Matrix::asMatrix()
 const 
{
    
    MMatrix m = ParentClass::asMatrix();
 
    
    
    
    DegreeRadianConverter conv;
    double newTheta = conv.degreesToRadians( getRockInX() );
    
    
}
MMatrix rockingTransform2Matrix::asMatrix(
double percent)
 const 
{
    
    trans *= percent;
    m.translateTo( trans );
    MPoint rotatePivotTrans = m.rotatePivot();
 
    rotatePivotTrans = rotatePivotTrans * percent;
    m.setRotatePivot( rotatePivotTrans );
    MPoint scalePivotTrans = m.scalePivotTranslation();
 
    scalePivotTrans = scalePivotTrans * percent;
    m.setScalePivotTranslation( scalePivotTrans );
    
    
    DegreeRadianConverter conv;
    double newTheta = conv.degreesToRadians( getRockInX() );
    m.rotateBy( quat );
    
    s.x = 1.0 + (s.x - 1.0)*percent;
    s.y = 1.0 + (s.y - 1.0)*percent;
    s.z = 1.0 + (s.z - 1.0)*percent;
    return m.asMatrix();
}
MMatrix rockingTransform2Matrix::asRotateMatrix()
 const 
{
    
    return ParentClass::asRotateMatrix();
}
rockingTransform2Node::rockingTransform2Node()
: ParentClass()
{
    rockXValue = 0.0;
}
void rockingTransform2Node::postConstructor()
{
    
    
    ParentClass::postConstructor();
    MPlug aRockInXPlug(thisMObject(), aRockInX);
 
}
rockingTransform2Node::~rockingTransform2Node()
{
}
{
    return new rockingTransform2Matrix();
}
void *rockingTransform2Node::creator()
{
    return new rockingTransform2Node();
}
MStatus rockingTransform2Node::initialize()
 
{
    addAttribute(aRockInX);
    
    mustCallValidateAndSet(aRockInX);
    return MS::kSuccess;
}
const char* rockingTransform2Node::className() 
{
    return "rockingTransform2Node";
}
void  rockingTransform2Node::resetTransformation (
const MMatrix &matrix)
 
{
    ParentClass::resetTransformation( matrix );
}
{
    ParentClass::resetTransformation( resetMatrix );
}
{
    
    
        return MS::kFailure;
    ReturnOnError(status);
    
    if ( plug == aRockInX )
    {
        
        blockHandle.
set(rockInX);
 
        rockXValue = rockInX;
        
        
        
        rockingTransform2Matrix *ltm = getRockingTransformMatrix();
        if (ltm)
            ltm->setRockInX(rockXValue);
            
        
        
        
        dirtyMatrix();      
    }
    
    
    return ParentClass::validateAndSetValue(plug, handle);
}
rockingTransform2Matrix *rockingTransform2Node::getRockingTransformMatrix()
{
    rockingTransform2Matrix *ltm = (rockingTransform2Matrix *) transformationMatrixPtr();
    return ltm;
}
double DegreeRadianConverter::degreesToRadians( double degrees )
{
     return degrees * ( M_PI/ 180.0 );
}
double DegreeRadianConverter::radiansToDegrees( double radians )
{
    return radians * (180.0/M_PI);
}