Help pleeeeeeeeeese

I used GeomAPI_IntCS to compute intersection on 10000 lines with one face successfully but the performance was so slow. I read on other thread that using IntCurvesFace_ShapeIntersector will be more quicker but I do not know how to use it. Also, I can not find any example about it. Please help me to use IntCurvesFace_ShapeIntersector by any simple example.

geometric's picture

please any example how to use IntCurvesFace_ShapeIntersector?

Bearloga's picture

What is the problem with this class? It have usual methods Load, Perform, IsDone, then use the methods NbPnt, Pnt, UParameter, VParameter, WParameter to get the result.

geometric's picture

Thanks Bearloga for your response.

I have problem loading one surface and lines to this class. Would you please tell me how to load that?

Thanks in advance.

Bearloga's picture

Organize a loop on lines, and call Perform in loop:

TopoDS_Face aFace = ...;
gp_Lin lins[] = ...;
int nblin = ...;
IntCurvesFace_ShapeIntersector shint;
shint.Load(sh, tol);
for (int i=1; i < nblin; ++i)
{
shint.Perform(lins[i], -RealLast(), RealLast());
if (!shint.IsDone()) continue;
for (int j=1; j <= shint.NbPnt(); ++j)
{
const gp_Pnt& aPnt = shint.Pnt(j);
// ... and so on
}
}

geometric's picture

Thanks soooooooooo much Mr Bearloga. That is great. It works fine now.
One thing I could not understand in shint.Load(sh, tol); and nothing in documentation about it. Would you please explain what is tol please?

Thank you very much.

Bearloga's picture

See doc on the class IntCurvesFace_Intersector, there the meaning of tolerance is explained.

geometric's picture

In the doc it said:

----------------------------------------------------------
The Tolerance is used to determine if the
first point of the segment is near the face. In
that case, the parameter of the intersection point
on the line can be a negative value (greater than -Tol).
----------------------------------------------------------

I suppose the first point of the segment is not only near the surface but also always on the surface itself (if my assumption that the first point of the segment= first intersection) so Tol is not required. What I am missing here please?
By the way does IntCurvesFace_Intersector and IntCurvesFace_ShapeIntersector are similar?

Thanks very much
Marei

Bearloga's picture

You cannot be 100% sure that two double values are totally equal (except the case when one of them is a product of assignment operation from another), therefore your intersection point lies on the face with some tolerance. By the way, intersection point itself is computed by approximation (with b-spline surfaces at least).
If you looked at the source code you could see that IntCurvesFace_ShapeIntersector uses IntCurvesFace_Intersector as an external tool. The first one works on the whole shape, while the second one accepts only one face.

geometric's picture

Am I right for the following assumptions:
- is it the distance value between the approximated intersection value and face.
- if I se it to 0 (zero) or less it should lie on the face.
- reasonably 1 is okay.

Thanks very much

Bearloga's picture

I looked in the code of Intersector and found that doc is false, indeed Tol is used when invoking classifier of an intersection point in the boundaries of the face (it is a value that used by classifier to decide whether a 2d point lies on a curve of boundary or not). So I think the best you can use is Precision::Confusion() for that.

geometric's picture

By that, my big troubles fixed.
This so much Mr Bearloga.

geometric's picture

By that, my big troubles fixed.
Thanks so much Mr Bearloga.