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

BURRELL Benjamin Benjamin.Burrell at Tenix.com
Tue Mar 16 01:22:34 EST 2004


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.




More information about the vtkusers mailing list