 
  Wed, 12/19/2012 - 23:02
Hi, I'm encountering some computing problems with the class Extrema_ExtPC.
I use it to compute the projection of a point over a TopoDS_Wire.
I need the point but also the parameter of the projected point on the wire.
The way i use it is the next :
-------------------------------------------------------------------------------
TopoDS_Wire originalWire --> "CURV2_P_Wire.brep"
BRepAdaptor_CompCurve wireAdaptor(originalWire);
Extrema_ExtPC extremaPoint(point,wireAdaptor,1E-1);
if ( extremaPoint.IsDone() && extremaPoint.NbExt() > 0 )
{
  const Standard_Integer iNbExtremaPoints = extremaPoint.NbExt();
  for (Standard_Integer i=1;i
  {
    bool  bIsMin                              = extremaPoint.IsMin(i);
    const Extrema_POnCurv&  currentPOnCurv    = extremaPoint.Point(i);
    const gp_Pnt&           currentPoint      = currentPOnCurv.Value();
    const Standard_Real&    currentParameter  = currentPOnCurv.Parameter();
    const Standard_Real&    currentDistance   = currentPoint.Distance(point);
  }
}
-------------------------------------------------------------------------------
In this case the algorithm find 3 solutions :
Point 1 : IsMin=true;  point=(1000.0,1000.0,0.0); param=0.0; distance=501.99
Point 2 : IsMin=false; point=(1986.98,1170.38,0.0); param=1.79; distance=1041.0
Point 3 : IsMin=false; point=(1000.0,1500.0,0.0); param=4.0; distance=1.99
The point 3 is the correct point and i expect this point to answer true to the IsMin method.
But it is not the case.
Moreover thanks to the distance it is easy to view that there is a problem.
Thanks to say if you can reproduce this case. Moreover if someone can explain me what represent the tolerance parameter. With the default constructor value 1E-10 in this case found only one solution (point 2 !!)
Thanks you.
 
        
Wed, 12/19/2012 - 23:05
Sorry i forgot to put the point : const gp_Pnt point(999.99,1501.99,0.0);
So i expect to get as nearest point the (1000.0,1500.0,0) point.
Wed, 12/19/2012 - 23:26
hey steph,
i cant tell you something about the parameter, but this would interest me too... somebody an idear?
what i can tell you is that the function IsMin do not answer true, when your distance is the minimum... it answers True when your Extremafunction is a Minimum and not a Maximum. And of course there can be only one absolute minimum but more than one local minimum between your point and the curve. Thats why i check all distances to get the absolute minimum.
greetings paul
Fri, 12/21/2012 - 18:17
Thanks Paul for the answer. I understand better.
However if i have found a better way to compute the projection. In my case i'm not interested in getting all the extrema but only the projection to the nearest point over a wire.
So i use ShapeAnalysis_Curve::Project.
I've encountered some strange case of bad computing but increasing brutally the precision value (last parameter of the project method) it works in all the cases. So it work but i don't understand the precision parameter.
Thanks.