SetDeviationCoefficient Issue/Question?

In the code snippet below I create an AIS_InteractiveContext and make a call to SetDeviationCoefficient(0.0001) with the intent of making the edges of my objects very smooth. Notice the argument is ten times smaller than the default. I don't get a good result -- see the attached screen shot and notice that the selection outline around the object is very smooth but the tesselation is not and this creates a jagged edge on the shape. I've used SetDeviationCoefficient call before with success but somehow I've run aground this time. Changing the value of SetDeviationCoefficient change the smoothness of the outer curve but have no effect on the fill. The 3D shape is a simple extrusion, it is shown in an orthograpic view to best demonstrate the problem -- see the top area of the blue object. Any suggestions?
Thanks,
Tim

try { //Grab portable OCC graphic device
myGraphicDevice = new Graphic3d_WNTGraphicDevice; }
catch(Standard_Failure) {
AfxMessageBox("Fatal Error During Graphic Initialization"); }

//Cast the portable device to Windows device
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = myGraphicDevice;

//Create a scene (viewer) in the portable graphic device
myViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D","");
myViewer->SetDefaultViewSize(2000.0);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
myViewer->SetRectangularGridValues(0,0,50,50,0);
myViewer->SetRectangularGridGraphicValues(1500.0,1500.0,0.0);

//Create an interaction context for the scene
myAISContext = new AIS_InteractiveContext(myViewer);
myAISContext->EraseAll(Standard_False);
myAISContext->SetDisplayMode(AIS_Shaded);
myAISContext->SetDeviationCoefficient(0.0001); //Make the curves on shapes smoother!

Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd());

//Define view and assign to window
myOrthograpicView = new V3d_OrthographicView(myViewer);
myOrthograpicView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped())
aWNTWindow->Map();
myOrthograpicView->SetAntialiasingOn();
myOrthograpicView->SetPlaneOff(); //Set clipping plane off

myViewer->SetViewOff(myOrthograpicView);

myPerspectiveView = new V3d_PerspectiveView(myViewer);
myPerspectiveView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped())
aWNTWindow->Map();
myPerspectiveView->SetAntialiasingOn();
myPerspectiveView->SetPlaneOff(); //Set clipping plane off

myViewMode = VIEW_PERSPECTIVE;
myView = myPerspectiveView;
myViewer->SetViewOn(myPerspectiveView);

tmay's picture

Nevermind. Here is the code that solved the problem.

myAISContext->SetDeviationCoefficient(0.00001); //Make the curves on shapes smoother!
myAISContext->SetDeviationAngle(myAISContext->DeviationAngle() / 10.0 );
myAISContext->SetHLRDeviationCoefficient(0.0001);
myAISContext->SetHLRAngle(myAISContext->HLRAngle() / 10.0);

I may play with the arguments a but I needed to call SetDeviationAngle() as well as SetDeviationCoefficient(). This was not clear to me from the docs ;)

Tim

tmay's picture

Update. In fact all I really needed was:
//Create an interaction context for the scene
myAISContext = new AIS_InteractiveContext(myViewer);
myAISContext->EraseAll(Standard_False);
myAISContext->SetDisplayMode(AIS_Shaded);
myAISContext->SetDeviationCoefficient(0.00001); //Make the curves on shapes smoother!
myAISContext->SetHLRAngle(myAISContext->HLRAngle() / 10.0);

Warning: This may be asking too much of some graphics hardware as it will result in a much finer grain tesselation and all those little polys will eat memory and GPU like crazy.

Tim