Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to draw a circle by using sine and cosine???
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
8749236




PostPosted: Thu Feb 03, 2011 8:25 pm   Post subject: How to draw a circle by using sine and cosine???

What is it you are trying to achieve?
i was trying to draw a circle by not using drawoval...

What is the problem you are having?
how do i make a program to draw a circle by using sine and cosine???


Describe what you have tried to solve this problem
i have tryied to put the sin or cos functiion in X coordinate of drawlin function, but it is not working...

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:

for i : 1 .. 100

    %drawline (i, round (cos (i / 25 * 5) * 100) + 200, i + 1, round (cos ((i+1) / 25 * 5) * 100) + 200, black)
    drawline (round (sin (i / 25 * 4)), i, round (sin ((i + 1 * 4) / 25)), i + 1, black)

    delay (0)
    % cls
end for


Please specify what version of Turing you are using
Turing 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Feb 03, 2011 8:38 pm   Post subject: Re: How to draw a circle by using sine and cosine???

8749236 @ Thu Feb 03, 2011 8:25 pm wrote:

... by using sine and cosine ...

.. i have tryied to put the sin or cos ...


The problem is that of Math and understanding what sine and cosine are.

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
TerranceN




PostPosted: Thu Feb 03, 2011 8:40 pm   Post subject: RE:How to draw a circle by using sine and cosine???

Just a word of warning, you might want cosd and sind instead, cause cos and sin use radians, while cosd and sind use degrees.

I would suggest looking at this. You might first want to just use sin(i) and cos(i) to keep it simple, and Draw.Dot to make sure each of your points is actually on the circle. Also, you should multiply those x and y values by 50 or 100 cause a 1pixel circle would be hard to see.
8749236




PostPosted: Fri Feb 04, 2011 10:29 am   Post subject: RE:How to draw a circle by using sine and cosine???

i got it.. thank you guys Very Happy
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: