Hi Author,
Read Foundation Classes User's Guide. There is a chapter dedicated to exception handling explaining details.
You have to protect against exception with catch(Standard_Failure) or with descendants of Standard_Failure for more specific cases. However you should also/rather verify user's input before passing them into OCC algorithms.
To compare gp_Pnt use gp_Pnt::IsEqual():
if (!pA.IsEqual (pB, Precision::Confusion()) {
//create a segment
...
}
In general, never compare floating point numbers for absolute equality, rather use some tolerance/precision (e.g. if (abs (a-b) < myEpsilon) ...). In OCC use Precision methods:
for 3D space use Precision::Confusion(), for 2D parametric space - Precision::PConfusion(), for instance:
if (abs (myParameter1 - myParameter2) > Precision::PConfusion()) {...}
Hope this helps.
Commenter-1
---
opencascade.blogspot.com - blog on Open CASCADE