Originally Posted by

**wizard_hu_**
Those other threads are right. Sine and cosine are trigonometric functions (

http://en.wikipedia.org/wiki/Trigonometric_functions), particularly useful for coordinate geometry. And you actually do need the resulting coordinates of geometric transformations.

In short: when you want x and y to traverse around a circle with radius r, you can use

Code:

x = r * cos (a)
y = r * sin (a)

where a is an angle, running from 0 to 2*pi (most computing environments expect you to provide angles in radians,

http://en.wikipedia.org/wiki/Radian)

For expressing 100% as a full circle

Code:

a = p / 100 * 2 * pi = p * pi /50

can be used, where p is a percentage.

Thanks for the reply....

but its not displaying with respect to percentage given.

see my code:

Code:

**TInt p = 50; // percentage**
TReal src = (p * 360) / 100;
RDebug::Print(_L("---> src = %f"), src);
TInt r = 155;
TReal result;
Math::Cos(**result**, src);
** TInt x = r * result;**
RDebug::Print(_L("result X = %d"), result);
RDebug::Print(_L("x = %d"), x);
Math::Sin (**result**, src);
**TInt y = r * result;**
RDebug::Print(_L("result Y = %d"), result);
RDebug::Print(_L("y = %d"), y);
// draw a pie slice centered in the rectangle
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetBrushColor(KRgbRed);
TRect ellipseRect=Rect(); // for arcs and ellipse
ellipseRect.SetWidth(250);
ellipseRect.SetHeight(250);
ellipseRect.Shrink(10,10); // set size so inside the border rectangle
//TRect rect;
TPoint screenCenterPoint=ellipseRect.Center(); // the center of the screen
// set up a pair of construction points for arc and pie slice drawing
TPoint constructionPoint1(210,125); // outside the construction ellipse
TPoint constructionPoint2(y,x); // inside the construction ellipse
TSize size(250,250);
gc.DrawRoundRect(ellipseRect,size);
//gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2);
// draw the other portion of the elliptical disc
gc.SetBrushColor(KRgbGreen);
gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2);