Java School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a Java Expert!

Join 300,475 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,746 people online right now. Registration is fast and FREE... Join Now!




Groovy: Sin graphs

 

Groovy: Sin graphs

litterbug_kid

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

New D.I.C Head
*

Joined: 29 Jan, 2008
Posts: 44


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
+Quote Post


William_Wilson

RE: Groovy: Sin Graphs

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

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,631



Thanked: 88 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 offlineProfile CardPM
+Quote Post

litterbug_kid

RE: Groovy: Sin Graphs

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

New D.I.C Head
*

Joined: 29 Jan, 2008
Posts: 44


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
+Quote Post

William_Wilson

RE: Groovy: Sin Graphs

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

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,631



Thanked: 88 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 offlineProfile CardPM
+Quote Post

litterbug_kid

RE: Groovy: Sin Graphs

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

New D.I.C Head
*

Joined: 29 Jan, 2008
Posts: 44


My Contributions
Thanks very much for your help! smile.gif
*gets started*
User is offlineProfile CardPM
+Quote Post

pbl

RE: Groovy: Sin Graphs

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

Java Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 9,537



Thanked: 1126 times
Dream Kudos: 450
My Contributions
Graphics.drawPolyline() is your friend
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 03:12AM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month