[vtkusers] How to draw a 'nice', anti-aliased circles, lines?

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Mar 16 11:16:39 EST 2004


Benjamin,

	Try playing with the AAFrames factor in vtkRenderWindow. Set it to 9 
for example.

HTH
Mathieu

BURRELL Benjamin wrote:
> Hi,
> 
> I am trying to draw simple lines and circles (not colour filled circles but outlines of circles) with different line widths.
> As far as I can see there is only vtkImageCanvasSource2D that can be used to easily draw circles/line this using DrawCircle(400, 400, 350) and DrawSegment(10,10,200,200) methods.
> The problem is you have no control over the line thickness as far as I can see and the lines that are produced are quite ugly, very jagged, not smooth.
> I have tried using a vtkImageGaussianSmooth object but this just makes the lines fuzzy and dull. Also using
>   this->renWin = vtkWin32OpenGLRenderWindow::New();
>   this->renWin->PointSmoothingOn();
>   this->renWin->LineSmoothingOn();
>   this->renWin->PolygonSmoothingOn();
> 
> doesn't seem to help when using the vtkImageCanvasSource2D object.
> 
> Is there a better way?
> 
> Also when I look at this 2D canvas in a 3D space, when looking from low angles to the lines, the lines become dull, how do you make it that at any viewing angle the lines stay bright?
> 
>  
> 
> My code so far is like this:
> 
>     this->canvas->SetScalarTypeToUnsignedChar();
>     this->canvas->SetNumberOfScalarComponents(3);
>     this->canvas->SetExtent(0, 1000, 0, 1000, 0, 0);
>     this->canvas->SetDefaultZ(0);
>    
>     this->canvas->SetDrawColor(0,0,255);
>     this->canvas->DrawCircle(400, 400, 25);
>     this->canvas->SetDrawColor(255,0,0);
>     this->canvas->DrawCircle(400, 400, 150);
>     this->canvas->DrawCircle(400, 400, 250);
>     this->canvas->DrawCircle(400, 400, 350);
> 
>     this->canvas->DrawSegment(10,10,200,200);
> 
>     this->circleActor->SetInput(canvas);
>     this->ren->AddActor(this->circleActor);
> 
> 
> 
> This just draws a few red circles and a line.
> 
> 
> 
> Regards,
> Benjamin Burrell.
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 






More information about the vtkusers mailing list