%vst
coneRotation is shaftRotation;
coneX is carriageX;
coneY is rollerY+shaftLength*angleSin;
coneZ is rollerZ-shaftLength*angleCos;
coneCircumference is 2.5*2*PI;
rollerRotation is -360.0*rollerX/(coneCircumference);
rollerX is shaftX;
rollerY is trackHeightMiddle+rollerWidth;
rollerZ is trackZ+trackWidth/1.5;
rollerWidth is 5*rollerSize;
rollerSize is 0.3;
shaftLength is 6;
shaftX is coneX;
shaftY is coneY;
shaftZ is coneZ;
shaftRotation is rollerRotation;
originX is 0;
originY is 0;
originZ is 0;
trackX is originX;
trackY is originY;
trackZ is originZ;
trackLength is 20;
trackWidth is 1;
trackHeightFront is 0.3;
trackHeightRear is trackHeightFront+trackWidth*angleSin;
trackHeightMiddle is (trackHeightRear+trackHeightFront)/2.0;
traceLength is 16;
traceHeight is 10;
traceX is originX+3;
traceY is originY-1.5;
traceZ is originZ+4;
carriageX is penShaftX-5;
carriageY is coneY;
carriageZ is coneZ;
wheelCalibrate is -0.006389;
wheelRotation = 0;
wheelX is wheelShaftX;
wheelY is wheelShaftY;
wheelZ is wheelShaftZ+wheelShaftLength/2-wheelWidth;
wheelSize is 0.3;
wheelShaftSize is wheelSize/20;
wheelShaftLength is wheelSize*3;
wheelTaper is 0.17*wheelSize;
wheelShaftX is penShaftX-5;
wheelShaftY is penShaftY;
wheelShaftZ is penShaftZ+11;
wheelWidth is 0.15*wheelSize;
penShaftLength is traceZ - coneZ+9.85+11-wheelWidth;
penShaftX is penX;
penShaftY is penY;
penShaftZ is penZ+penWidth-penShaftLength;
penX is traceX-traceLength*mouseX;
penY is coneY+2.5*angleCos+5*wheelSize+wheelTaper;
penZ is traceZ+traceHeight*mouseY;
penWidth is 0.1;
wheelGearing is 1.0- (coneZ+2.5*angleSin - wheelZ-wheelWidth)/9.85;
angleSin is sin(PI/12);
angleCos is cos(PI/12);
previousConeRotation = 0;
proc updateWheelRotation : coneRotation {
auto increment;
increment = -wheelGearing*(coneRotation -previousConeRotation);
wheelRotation = wheelRotation + increment;
previousConeRotation=coneRotation;
};