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

GeomPlate_MakeApprox crashes on Windows 7 (x64)

Dietmar Kieslinger's picture
Forums: 

Hi all!
I moved from Windows XP 64 bit to Windows 7 64 bit. On the new system the application crashes inside GeomPlate_MakeApprox ctor while it was running fine on Windows XP.

My current setup is:
OS: Windows 7 Enterprise, 6.1.7601 ServicePack 1.0
OCC: 6.5.1
compiler: VC10
build: OCC (and all other libs) built from source as x64 debug

Basically OCC seems to work. I can start the application; displaying points and lines works fine. When I try to fit a NURBS surface to a point cloud (nothing fancy, more or less copy-and-paste from the examples...) the constructor of GeomPlate_MakeApprox crashes. Stack trace attached below.

The actual reason for the crash is in macrgfl_ (AdvApp2Var_SysBase.cxx) where an array index (ioff) is calculated as 58412015, which seems to be out of bound. Although I think the root cause is somewhere upsteam. (E.g. iadt=-310073424 which also looks strange for an index.)

The code may not be optimal but it works (with identical input parameters) on Windows XP 64 bit.

> Does anyone use GeomPlate_MakeApprox successfully on Windows 7 x64?
> Any ideas how to solve this issue?

Many thanks, Dietmar

**** code snippet
...
Standard_Integer Degree = 3;
Standard_Integer NbPtsOnCur = 10;
Standard_Integer NbIter = 3;
Standard_Integer Order = 0;
Standard_Integer MaxSeg = 9;
Standard_Integer MaxDegree = 5;
Standard_Real anApproxTol = 0.001;
Standard_Real aConstrTol = Precision::Confusion();

// define object BuildPlateSurface
GeomPlate_BuildPlateSurface BPSurf(Degree, NbPtsOnCur, NbIter);
// add point constraints to GeomPlate_BuildPlateSurface object
for(int i(0); i BPSurf.Add(new GeomPlate_PointConstraint(
gp_Pnt(cloudPoints[i].getPoint().x, cloudPoints[i].getPoint().y, cloudPoints[i].getPoint().z),
Order, aConstrTol));
BPSurf.Perform();
// make PlateSurface
Handle(GeomPlate_Surface) plateSurf;
// Handle(Geom_Surface) aSurf; is memeber now
if(BPSurf.IsDone())
{
plateSurf = BPSurf.Surface();
// define parameter approximation
Standard_Real dmax(Max(0.01, 10*BPSurf.G0Error()));
// make approximation
GeomPlate_MakeApprox approx(plateSurf, anApproxTol, MaxSeg, MaxDegree, dmax);
...

**** stack trace
> TKGeomBase.dll!macrgfl_(long * iadfld, long * iadflf, int * iphase, int * iznuti) Zeile 926 + 0x16 Bytes C++
TKGeomBase.dll!AdvApp2Var_SysBase::mcrrqst_(int * iunit, int * isize, double * t, long * iofset, int * iercod) Zeile 3324 C++
TKGeomBase.dll!AdvApp2Var_ApproxF2var::mma2fnc_(int * ndimen, int * nbsesp, int * ndimse, double * uvfonc, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* foncnp, double * tconst, int * isofav, int * nbroot, double * rootlg, int * iordre, int * ideriv, int * ndgjac, int * nbcrmx, int * ncflim, double * epsapr, int * ncoeff, double * courbe, int * nbcrbe, double * somtab, double * diftab, double * contr1, double * contr2, double * tabdec, double * errmax, double * errmoy, int * iercod) Zeile 6775 C++
TKGeomBase.dll!AdvApp2Var_Iso::MakeApprox(const AdvApp2Var_Context & Conditions, const double U0, const double U1, const double V0, const double V1, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* const & Func, AdvApp2Var_Node & NodeBegin, AdvApp2Var_Node & NodeEnd) Zeile 275 C++
TKGeomBase.dll!AdvApp2Var_ApproxAFunc2Var::ComputeConstraints(const AdvApprox_Cutting & UChoice, const AdvApprox_Cutting & VChoice, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* const & Func, const AdvApp2Var_Criterion & Crit) Zeile 661 C++
TKGeomBase.dll!AdvApp2Var_ApproxAFunc2Var::ComputePatches(const AdvApprox_Cutting & UChoice, const AdvApprox_Cutting & VChoice, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* const & Func, const AdvApp2Var_Criterion & Crit) Zeile 449 C++
TKGeomBase.dll!AdvApp2Var_ApproxAFunc2Var::Perform(const AdvApprox_Cutting & UChoice, const AdvApprox_Cutting & VChoice, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* const & Func, const AdvApp2Var_Criterion & Crit) Zeile 332 C++
TKGeomBase.dll!AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(const int Num1DSS, const int Num2DSS, const int Num3DSS, const Handle_TColStd_HArray1OfReal & OneDTol, const Handle_TColStd_HArray1OfReal & TwoDTol, const Handle_TColStd_HArray1OfReal & ThreeDTol, const Handle_TColStd_HArray2OfReal & OneDTolFr, const Handle_TColStd_HArray2OfReal & TwoDTolFr, const Handle_TColStd_HArray2OfReal & ThreeDTolFr, const double FirstInU, const double LastInU, const double FirstInV, const double LastInV, GeomAbs_IsoType FavorIso, GeomAbs_Shape ContInU, GeomAbs_Shape ContInV, const int PrecisCode, const int MaxDegInU, const int MaxDegInV, const int MaxPatch, void (int *, double *, double *, int *, double *, int *, double *, int *, int *, double *, int *)* const & Func, const AdvApp2Var_Criterion & Crit, AdvApprox_Cutting & UChoice, AdvApprox_Cutting & VChoice) Zeile 161 C++
TKGeomAlgo.dll!GeomPlate_MakeApprox::GeomPlate_MakeApprox(const Handle_GeomPlate_Surface & SurfPlate, const double Tol3d, const int Nbmax, const int dgmax, const double dmax, const int CritOrder, GeomAbs_Shape Continuity, const double EnlargeCoeff) Zeile 401 + 0x14a Bytes C++

Thomas Paviot's picture

Hi Detmar,

I think this issue is related to the Roman's post http://www.opencascade.org/org/forum/thread_22101/.

Thomas

Roman Lygin's picture

Exactly so.
Almost exact same stack.
Thanks for a catch Detmar and Thomas.

Dietmar Kieslinger's picture

Good point. Yes it seems to be the same issue.
Interesting that those pointer conversion problems obviously do not affect Windows XP 64 bit. (The other thread mentions that neither linux nor Mac OS 64 bit are affected - probably for the same reason.)
This sounds like chances for an easy user-side fix are low...

Thomas Paviot's picture

Hi Dietmar,

There was a problem with the source code formatting. Could you please insert the source code of your example as an attachement so that issue can be reproduced?

Thomas

Dietmar Kieslinger's picture

Attached.
Btw, I can I edit my own posts? I couldn't find the edit button...

Attachments: