Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 132,078 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,222 people online right now. Registration is fast and FREE... Join Now!




Groovy: Sin graphs

 
Reply to this topicStart new topic

Groovy: Sin graphs

litterbug_kid
post 7 Oct, 2008 - 10:00 AM
Post #1


New D.I.C Head

*
Joined: 29 Jan, 2008
Posts: 16


My Contributions


I'm trying to draw a Sin graph. I think it's something like Math.sin(x), are you meant to just sub in a value for x and execute or is there more to it?
User is offlineProfile CardPM

Go to the top of the page

William_Wilson
post 7 Oct, 2008 - 10:08 AM
Post #2


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,965



Thanked 13 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


that will give you the sine of a value, which stands to reason as it is within the Math class. You could use it to determine values, but you would need to manually draw sets of points and connect them with lines, making the points close enough together to result in a curved line.

If you know how to get the points it is simply connecting them. Have you worked with the paint, redraw methods?
User is online!Profile CardPM

Go to the top of the page

litterbug_kid
post 7 Oct, 2008 - 10:23 AM
Post #3


New D.I.C Head

*
Joined: 29 Jan, 2008
Posts: 16


My Contributions


Ohh okay. Thankyou.
I'm not sure that I have since I don't really know what you mean. I've only done pretty basic stuff like drawLine, drawArc etc etc..
User is offlineProfile CardPM

Go to the top of the page

William_Wilson
post 7 Oct, 2008 - 10:27 AM
Post #4


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,965



Thanked 13 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


drawLine would be good enough for a rough outline, just make sure you pick the values fairly close together, unless you want to get into more complicated math which you can use arcs and circles, but lines are definitely the easier way to go.
User is online!Profile CardPM

Go to the top of the page

litterbug_kid
post 7 Oct, 2008 - 10:33 AM
Post #5


New D.I.C Head

*
Joined: 29 Jan, 2008
Posts: 16


My Contributions


Thanks very much for your help! smile.gif
*gets started*
User is offlineProfile CardPM

Go to the top of the page

pbl
post 7 Oct, 2008 - 04:20 PM
Post #6


D.I.C Lover

Group Icon
Joined: 6 Mar, 2008
Posts: 2,946



Thanked 186 times

Dream Kudos: 75
My Contributions


Graphics.drawPolyline() is your friend
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 08:12AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month