For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Smooth Bspline curve

Komal's picture
Forums: 

Please, refer attached file "Curve-Smooth.bmp" where curve is NOT smooth. How can we make that curve as smooth? I have already tried using API's from link: http://www.opencascade.org/org/forum/thread_17938/ but without any effect.

theContext->SetDeviationCoefficient(0.00001);
theContext->SetDeviationAngle(theContext->DeviationAngle() / 10.0 );
theContext->SetHLRDeviationCoefficient(0.0001);
theContext->SetHLRAngle(theContext->HLRAngle() / 10.0);

Attachments: 
sergey zaritchny's picture

Hi Komal,
From your message is not clear what kind of smoothing do you mean?
The referred API is dedicated just to tune a shape presentation (what you see on the screen) without any impact on the shape itself built by Geom_BsplineCurve.
So, we may speak about two different types of "smoothness":
1) Curve Presentation (any curve on the screen is presented by set of small straight lines which highlighted on the attached picture)
2) Curve geometrical model (presented by continuity of curve: C0, C1, C2 and etc)
So, could you specify your problem more exactly.
sergey

Komal's picture

Hi Sergey,

I am expecting the curve same as attached image. Please, refer attached image. I do NOT want curve on screen to be set of small straight lines. So, i mean Curve Presentation. How can curve be shown smooth on screen?

-Komal

Attachments: 
sergey zaritchny's picture

Hi,
I would recommend'd trying the following code(it should be applied before displaying a curve):
Handle(AIS_Shape) anIO = getShapeAISFromSomewhere();
Handle(Prs3d_Drawer) aDrawer = anIO->Attributes();
aDrawer->SetTypeOfDeflection( Aspect_TOD_RELATIVE ); // just to ensure relative deflection is used
aDrawer->SetDeviationCoefficient( 1e-6 );
theContext->Display( anIO );

And play with values.
Good luck.
Sergey

Komal's picture

Thanks Sergey for immediate response.

But, I cannot see much effect. Please, refer the attached screen-shot for SetDeviationCoefficient( 1e-12 ). If i make input parameter value more than 1e-15, PC gets hang.

How can i fix the issue?

-Komal

Attachments: 
jelle's picture

Your confusion geometry approximation with anti aliasing.
A good thing that OCC can take care of that.
Standard_EXPORT void V3d_View::SetAntialiasingOn()

See doxygen: YOUR_OCC_DOCS/Visualization/html/classV3d__View.html#a125

Also, I'm not surprised that OCC gives up on 1e-15.
More than Sergey's suggested value is *definitely* overkill!

Komal's picture

Jelle,

upto some extend but NOT fully smooth. Pls, refer attached screen-shot. Can you please, advice further on this? Thanks in advance.

-Komal

Attachments: 
jelle's picture

Well, its simply not going to bet any better than this ;)
There are some artefacts in your view, so maybe its your graphics card.

Komal's picture

Thanks a lot jelle.

Finally i got what i need with function suggested by YOU.

-Komal

jelle's picture

Terrific! Happy to hear that.

Dima's picture

Hi Sergey,

Can you but can you say the answer on the second question : about curve geometrical model ?

-Dima

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.