X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 12 Jul 2006 02:14 PM by  anon
Drawing smooth antialiased lines
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
12 Jul 2006 02:14 PM
    Can anyone please advise me how to draw high quality, possibly antialised lines in the plot ? All of the curves or lines plotted under angle come out jagged. It seems like the line or curve drawing algorithm is not very good or I may be missing some parameter that makes the smoothing possible. Is there a code example sowhere ? Thanks, Alex

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Jul 2006 02:14 PM
    The line or curve drawing algorithms come from the system and/or video card graphics libraries that IDL's drawing commands interface with. IDL does not have any built-in ANTIALIAS methods or keywords. I believe there is some hardware which performs (either by default or it can be configured to perform) antialiasing on the line drawing commands they receive. And I believe that the OpenGL libraries that IDL Object Graphics interfaces with may be more likely to antialias (or may, in general, produce better line quality) than IDL Direct Graphics. IDL Object Graphics already incorporates antialiasing in its rendering of text objects, not yet available in IDL Direct Graphics. Finally, I should mention that the high resolution of printer devices, like IDL's 'PS' PostScript devices, generally produces very smooth line-rendering quality, when the render method of the scene in IDL is "vector", not "bitmap" (but this is only relevant for paper output). Antialiasing is a very tricky and computationally expensive business. Pixels just on and just outside the border of the line that the basic line-drawing functions calculate are evaluated to see how their divergent colors might be blended in order to camouflage pixel borders along the path of a line. IDL DOES have a software example of how antialiasing can be accomplished. The example is in the IDL DEMO program, named 'Object World' under 'Surfaces and 3D Graphics'. I would recommend emptying the default scene with the 'Delete' button and hitting the 'Show Grid' button on the 'Options' menu, so it is set to "Off". Use the 'Add' button to add a 'Plot' object. Then observe the behavior of the 'Options->Anti-Alias' button. The code for that example is in 'd_objworld.pro' in IDL's '/examples/demo/demosrc/' directory. I have never studied this closely, but I can see from the behavior of the display and a quick look at the source code that the program is moving the plot around (presumably 1 pixel in the direction of every neighbor), taking a snapshot of the scene after every move, then [I believe] averaging the color values of all the snapshots together. (There might be some weighted averaging of the intermediate values going on; I'm not sure.) Hope that helps. James Jones

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Jul 2006 02:14 PM
    Alex, I have recently uploaded a set of routines for producing antialiased plots. They should come online soon -- probably today or tomorrow. They are called plotsmooth.pro, oplotsmooth.pro, contoursmooth.pro, shade_surfsmooth.pro, surfacesmooth.pro, velovectsmooth.pro, and xyoutssmooth.pro. You should be able to implement them just like the non-smooth version. -Tobin
    You are not authorized to post a reply.