-
December 31st, 2006, 05:41 AM
#1
How to make lines smooth
Does anyone know an algorithm to smooth lines and curves drawn with a free hand tool? Like in all professional graphics applications, when drawing with a pen, lines and curves are automatically adjusted to look better.
I searched the Internet and couldn't find anything so I figured I ask here before I start experimenting on my own. How to determine from a set of X Y coordinates given by a MouseMove event what the user intended to draw ie. a single line, a set of lines, a circle etc.
Thanks in advance
-
December 31st, 2006, 08:45 AM
#2
Re: How to make lines smooth
I think the technique is called "Antialiasing". You can do a google search for antialiasing algorithms.
If there is no love sun won't shine
-
December 31st, 2006, 09:38 AM
#3
Re: How to make lines smooth
No, I don't think it is antialiasing. It is a bit more complex than that. Try drawing a circle with the pen in MS Paint for example and one in Flash and see how the one drawn in Flash is automaticaly adjusted so it has no visible angles.
I don't know if there is a specific term for this. It is not just the color blending of antialiasing, the points that define a curve or a line for example are automatically adjusted to achieve a round, smooth shape rather than a jagged one. Antialiasing is done on top of this.
-
December 31st, 2006, 10:06 AM
#4
Re: How to make lines smooth
As I understand there is a particular equation for a curve you want to generate. Thus the coordinates of the points are calculated using this equation. If you alter the equation you will have a completely new curve with different coordinates.
The question is are you trying to find out the best fit equation for a curve for a given range of parameters ? or are you trying to smooth out the already formed curve equation? The latter is called anti-aliasing. I thought you wanted the latter.
For a circle it is the same equation whether used by MS-PAINT or Flash. For the smoothness they definitely use anti-aliasing.
If there is no love sun won't shine
-
December 31st, 2006, 11:48 AM
#5
Re: How to make lines smooth
I want to use a similar algorithm for a similar (graphics) application. So yes, the result is a different curve, a smoother one. This is not antialiasing. I said a circle drawn with a pen tool, free-hand, not an ellipse tool.
I'm sorry if I can't explain better as I see you didn't understand what I wanted to know. I'm waiting for other ideas, no offense but I don't want to keep arguing with you about antialiasing
-
January 1st, 2007, 11:09 AM
#6
Re: How to make lines smooth
I hope you Know VB6..
on This thread there's some VB6 code and a lot of discussion covering this topic...
Hope this helps...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
January 2nd, 2007, 07:27 AM
#7
Re: How to make lines smooth
Originally Posted by riscutiavlad
How to determine from a set of X Y coordinates given by a MouseMove event what the user intended to draw ie. a single line, a set of lines, a circle etc.
This can be called antialiasing if your intention is not to find the best fit curve (a regular curve) for the curve beign drawn but to make the curve appear to be a smooth (regular) curve. This is called curve fitting or more specifically interpolation. Image processing requires both antialiasing and curve fitting to enhance the display of a high resolution image in a low resolution display technology. go here for a demo.
Originally Posted by riscutiavlad
Try drawing a circle with the pen in MS Paint for example and one in Flash and see how the one drawn in Flash is automaticaly adjusted so it has no visible angles.
Flash's approach is vector graphics as opposed to ms paint's approach (raster). Thus, Flash tries to think in terms of basic polygons from lines to complex curves.
Last edited by kumaresh_ana; January 2nd, 2007 at 07:47 AM.
-
January 25th, 2007, 12:41 PM
#8
Re: How to make lines smooth
you might want to google "bezier curves". it is the mathematics
behind the curve smoothing functionality in paint and many graphics
routines.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|