freelanceprogrammers.org Forum Index » C

Problem with Pieslice


View user's profile Post To page top
arifali_007 Posted: Tue Jul 08, 2003 5:27 pm


Joined: 07 Jul 2003

Posts: 14
Problem with Pieslice
hi suman
thanx for replying , here i`m giving code once again i`m doing
the same what you told but i guess problem is with this lib function
itself . i`m usning turboc ++ 3.0 compiler


------------------ Pieslice.c--------------
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int drawpie(int i)
{
/* request auto detection */
// circle(10,10,200);
setfillstyle(2,5);
pieslice(320,240,i,i+90,100); //when i=290 it works unexpected
getch();
cleardevice();
return 0;
}
main()
{
int i;
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "h:\tc\bgi");
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s
", grapherrormsg(errorcode));
getch();
exit(1); /* terminate with an error code */
}

for(i=20;i<450;i+=90)
drawpie(i);
}

/*
i`m not very sure but i think problem is
When i =290 then i+90 =380 ,
now what pieslice does is it apply mod 380%360=20
and after applying mod to both starting angle and ending angle
whichever is smaller it makes that one starting angle and otherone
ending angle .

plz suggest what could be done . is there any other third party
graphics library which can be used here ???
*/
Reply with quote
Send private message
View user's profile Post To page top
ar_frenz Posted: Wed Jul 09, 2003 10:06 pm


Joined: 05 Jul 2003

Posts: 8
Problem with Pieslice
> hi
> don`t look for an alternative which does this look for a sol.-
> i advise to follow a do it u`r self kind of strategy
> Also if u want to learn c use a better compiler don`t user Tc use
gcc though
> slow it`s standareds compliant
> and i think u`r ques was abt c++.
> so jus check and give vars independently
> like
> i don`t work on windoze so have no idea abt params for the func.
>
> if( i+290 > 360)
> ang=360-i+290
> pieslice(params);
> or draw 2 arcs of same color wirhout an edge if u can`t do it
directly
> HTH
> -suman

ya suman ,
even i feel Tc is not a very good compiler many time it
throw some exception and come out from the tc editor . but i have
started i`ll try to implemente ur suggestion otherwise i wil always
start from 0 degree angle nothing else could be done i guess .

/* new members can see

http://groups.yahoo.com/group/Programmers-Town/messages

*/
Reply with quote
Send private message
View user's profile Post To page top
suman_karumuri Posted: Fri Jul 11, 2003 2:09 am


Joined: 08 Jul 2003

Posts: 6
Problem with Pieslice
On Tue July 8 2003 17:57, arifali_007 wrote:
> hi suman
> thanx for replying , here i`m giving code once again i`m doing
> the same what you told but i guess problem is with this lib function
> itself . i`m usning turboc ++ 3.0 compiler
>
>
> ------------------ Pieslice.c--------------
> #include <graphics.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <conio.h>
>
> int drawpie(int i)
> {
> /* request auto detection */
> // circle(10,10,200);
> setfillstyle(2,5);
> pieslice(320,240,i,i+90,100); //when i=290 it works unexpected
> getch();
> cleardevice();
> return 0;
> }
> main()
> {
> int i;
> int gdriver = DETECT, gmode, errorcode;
> initgraph(&gdriver, &gmode, "h:\tc\bgi");
> errorcode = graphresult();
> if (errorcode != grOk) /* an error occurred */
> {
> printf("Graphics error: %s
", grapherrormsg(errorcode));
> getch();
> exit(1); /* terminate with an error code */
> }
>
> for(i=20;i<450;i+=90)
> drawpie(i);
> }
>
> /*
> i`m not very sure but i think problem is
> When i =290 then i+90 =380 ,
> now what pieslice does is it apply mod 380%360=20
> and after applying mod to both starting angle and ending angle
> whichever is smaller it makes that one starting angle and otherone
> ending angle .
>
> plz suggest what could be done . is there any other third party
> graphics library which can be used here ???
> */
hi
don`t look for an alternative which does this look for a sol.-
i advise to follow a do it u`r self kind of strategy
Also if u want to learn c use a better compiler don`t user Tc use gcc though
slow it`s standareds compliant
and i think u`r ques was abt c++.
so jus check and give vars independently
like
i don`t work on windoze so have no idea abt params for the func.

if( i+290 > 360)
ang=360-i+290
pieslice(params);
or draw 2 arcs of same color wirhout an edge if u can`t do it directly
HTH
-suman
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help