Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Shape factory
Shape gallery
What's new
System requirements
Download Center
Public license
Getting started
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
Home / Developer Corner / Forums / Usage issues / Bug in Extrema_ExtPC

Bug in Extrema_ExtPC

Bug in Extrema_ExtPC
Steph 2012/12/19 20: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<=iNbExtremaPoints ;++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.
You have to be logged in to download the attached file
Steph 2012/12/19 20: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.
Hennig 2012/12/19 20: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
Steph 2012/12/21 15: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.

Latest news
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map