[vtkusers] RE: vtkSphereSource - Working correctly?

Per Dalgas Jakobsen pdj at maridan.dk
Wed Dec 10 03:45:49 EST 2003


Hi,

I have some trouble getting the vtkSphereSource to do what I want.
The code is basically this:
--------
vtkSphereSource *sector = vtkSphereSource::New();
#define HALF_HORIZ_VIEW 30
#define HALF_VERT_VIEW 30
sector->SetStartPhi(90 - HALF_HORIZ_VIEW);
sector->SetEndPhi(90 + HALF_HORIZ_VIEW);
sector->SetStartTheta(90 - HALF_VERT_VIEW);
sector->SetEndTheta(90 + HALF_VERT_VIEW);
--------

I would have expected a sector which had a 60 degree 
horizontal opening angle, and a 60 degree vertical opening angle.
I do not believe that is what I get.
I made this picture with 4 planes to illustrate the +/- 30 
degree angles horizontally and vertically.
http://knaldgas.dk/vtk/sector.jpg - Source for this: 
http://knaldgas.dk/vtk/sector.cpp (C++ Builder 6 code)

As can be seen, at two of the four sides, the sector is 
actually going beyond these angles.
Am I missing something here?

Any idea of how I get it to display the way I want it to?
The actual problem is to make a semitransparent sector: 
Horizontal and vertical opening angles and a range.
Can you possibly add a lightsource that is origined at the 
sphere center and bounded by the angles and range?

Best regards
Per




More information about the vtkusers mailing list