PDA

View Full Version : Trignometric functions in Qt/Embedded



grsandeep85
20th July 2009, 13:45
Hi All,

I have two lineedits X & Y to which i am giving some values to perform the cosine and sine calculations and store the result in result lineedit, but if i execute the code in host its giving correct result but it port the application int target board (S3C2410) i am getting wrong result. Is there any method to implent the sine and cosine function in Qt/Embedded. here is my code and please help us.

wholeangle = En - St;

qDebug ( "wholeangle : %4.3lf",wholeangle);

angle = 360/Hol;

qDebug ( "angle : %4.3lf",angle);





qDebug("Hole:%d",Hole);

holeslineEdit->setText(QString::number(Hole,10 ));



cirangle =((angle * Hole) + St);

xangle = cirangle * 3.141592653 / 180;

qDebug("xangle:%lf",xangle);

xcordinate = (cos(xangle));

qDebug("xcordinate:%lf",xcordinate);

Xco = (xcordinate * Rad);

qDebug ( "Xco : %4.3lf",Xco);

xcordlineEdit->setText(QString::number(Xco, 'F', decimals_mm ) );





yangle = cirangle * 3.141592653 / 180;

qDebug("yangle:%lf",yangle);

ycordinate = (sin(yangle));

qDebug("ycordinate:%lf",ycordinate);

Yco = (ycordinate * Rad);

qDebug ( "Yco : %4.3lf",Yco);

ycordlineEdit->setText(QString::number(Yco, 'F', decimals_mm ) );