This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Sine wave Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Sine wave" Watch "Sine wave" New topic
Author

Sine wave

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Hi, I'm trying to draw a sine wave, with a thickness of about 3.

When I draw it, the curve never comes out smooth, even with antialiasing turned on.

I've tried drawing lots of line segments, using ovals, and also polygons. but none of them come out smooth...
You can always see like a ladder effect along the curve close up.

Can anyone help me do this? Thanks very much.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10747
    
    9

How about showing us some code.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Ok then..


Its a bit messy, hope that helps>
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Nevermind, I just used a cubic bezier curve, makes it look better, so I don't need the sinewave now. Thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44515
    
  34
Does a Bezier curve match a sine wave? Show us how.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Its close enough
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sine wave
 
It's not a secret anymore!