Hi;
First I want to thank Max for creating such amazing program and others that are contributing to expand beyond. I am trying to create a math conversion node for converting Degree to radian and radian to degree. I created these two nodes by coping other example and modify them.My knowledge of Javascript very limited and I can not figureout why is not converting.
// *************** Math Conversion Degree to radian ****************************
function convertDegtoRad()
{
this.addInput("Deg","number");
this.addOutput("Rad","number");
this.properties = {Deg:0};
}
convertDegtoRad.title = "DegreeToRad";
convertDegtoRad.desc = "Degree to Radian";
convertDegtoRad.prototype.onExecute = function()
{
this.properties.Deg = this.getInputData(0, this.properties.Deg);
var outValue = (this.properties.Deg * 2 * Math.Pi) / 360;
this.setOutputData(0, outValue);
}
LiteGraph.registerNodeType("MathBasic/DegreeToRad", convertDegtoRad);
// *************** Math Conversion Radian to degree ****************************
function convertRadToDegree()
{
this.addInput("Rad","number");
this.addOutput("Deg","number");
this.properties = {Rad:0};
}
convertRadToDegree.title = "RadToDegree";
convertRadToDegree.desc = "Radian To Degree";
convertRadToDegree.prototype.onExecute = function()
{
this.properties.Rad = this.getInputData(0, this.properties.Rad);
var outValue = (this.properties.Rad * 180) / Math.pi;
this.setOutputData(0, outValue);
}
LiteGraph.registerNodeType("MathBasic/RadToDegree", convertRadToDegree);
// *************** ***************************
thanks
-sharif
|