Increase smoothness of drawn curves

Hello,

I am trying to save a canvas with some small graphics elements on it (e.g. circles, curves, lines) and would like these to be in high enough resolution to see small details (e.g. lines lying tangent to a circle). When I generate the attached image, I see that, for example, circles are approximated by polygons with n-sides depending on how much of the canvas they take up. Using png and a large canvas size shrinks the pixel size but the smaller circles are still drawn as a octagons.

Is there a way to force curves to be drawn with greater smoothness?

Similarly, is there a way to get lines thinner than width=1 or functionally achieve lines that are as arbitrarily thin relative to other lines as we want?

Thanks


Please read tips for efficient and successful posting and posting code

ROOT Version: v6-14-00
Platform: macOS 10.12.6
Compiler: Apple LLVM version 9.0.0 (clang-900.0.39.2)
HitExtractionVisualized_BOL1A05.pdf (28.1 KB)

How to you draw the circles ? can you post an example macro ?

I draw them with Draw().
Here is a minimal example macro:

void test() {
    TCanvas* c1 = new TCanvas("c1","",400,400);
    TEllipse circ1(0.5,0.5,0.01,0.01);
    circ1.Draw();
    c1->SaveAs("Circle.pdf");
}

The number of points used to draw ellipses is computed at painting time as you can see here. One solution would be to increase that number of make it adjustable by users but that will not be an immediate solution for you. An other possibility for you would be to create a small function drawing circle based on TPolyLine. That way you will have the full control on the number of points used to draw the circle.

Thanks. I will look into TPolyLine. It still seems I will run into the issue of the lines being too thick in PDF format as the line width has a minimum at 1 regardless of how small the circle gets (e.g. set the radius to 0.001 in my macro above).

Is there a way to get lines thinner than width=1 or functionally achieve lines that are as arbitrarily thin relative to the size of the circle when saved as a PDF?

I can switch to saving as png and making the canvas size large but then things start to look very pixelated and the file size gets much larger.

Thanks

To scale down the basic line width for PS and PDF use:

gStyle->SetLineScalePS(...);
1 Like