View Issue Details

IDProjectCategoryView StatusLast Update
0029562CommunityOCCT:Modeling Algorithmspublic2018-03-10 21:41
Reportersraymond Assigned Tomsv 
PrioritynormalSeveritymajor 
Status newResolutionopen 
PlatformWindowsOSVC++ 2015 
Product VersionUnscheduled 
Target VersionUnscheduled 
Summary0029562: GeomAPI_Interpolate modify const Handle< TColStd_HArray1OfBoolean > &TangentFlags
DescriptionIn class GeomAPI_Interpolate, during the interpolation process TangentFlags is modified, witch is an issue when the application has to keep TangentFlags information for a further use.

A copy of the array should be used. That's what I did in my application
Steps To Reproduce    // void GeomAPI_Interpolate :: Load (const TColgp_Array1OfVec &Tangents, const Handle< TColStd_HArray1OfBoolean > &TangentFlags, const Standard_Boolean Scale=Standard_True)
    // seems to alterate tangent flags
    int nControlPoints=10;
    handle< TColStd_HArray1OfBoolean > TangentFlags = new TColStd_HArray1OfBoolean(1,nControlPoints);
    TangentFlags->Init(Standard_False);
    TColgp_Array1OfVec Tangents(1,nControlPoints);
    Tangents.Init(gp_Vec(1,0,0));
    handle< TColgp_HArray1OfPnt > Points = new TColgp_HArray1OfPnt(1,nControlPoints);
    Points->SetValue(1,gp_Pnt(0,6,0));
    Points->SetValue(2,gp_Pnt(2,4,0));
    Points->SetValue(3,gp_Pnt(3,8,0));
    Points->SetValue(4,gp_Pnt(7,4,0));
    Points->SetValue(5,gp_Pnt(10,5,0));
    Points->SetValue(6,gp_Pnt(11,1,0));
    Points->SetValue(7,gp_Pnt(13,3,0));
    Points->SetValue(8,gp_Pnt(17,6,0));
    Points->SetValue(9,gp_Pnt(18,3,0));
    Points->SetValue(10,gp_Pnt(20,2,0));

    cout << "Before GeomAPI_Interpolate.Load " << endl;
    for(int i=1 ; i <= nControlPoints ;i++){
        cout << TangentFlags->Value(i) << " ";
    }
    cout << endl;

    GeomAPI_Interpolate interp(Points,false,1e-3);
    interp.Load(Tangents,TangentFlags,true);
    cout << "After GeomAPI_Interpolate.Load " << endl;
    for(int i=1 ; i <= nControlPoints ;i++){
        cout << TangentFlags->Value(i) << " ";
    }
    cout << endl;
    interp.Perform();
    cout << "After GeomAPI_Interpolate.Perform " << endl;
    for(int i=1 ; i <= nControlPoints ;i++){
        cout << TangentFlags->Value(i) << " ";
    }
    cout << endl;
    handle<Geom_Curve> theCurve;
    theCurve = interp.Curve();

//796 BuildTangents(myPoints->Array1(),
//797 myTangents->ChangeArray1(),
//798 myTangentFlags->ChangeArray1(), <-discart const
//799 myParameters->Array1()) ;
// From line 202 of GeomAPI_Interpolate.cxx
// if (!TangentFlags.Value(1)) {
// point_array = (Standard_Real *) &PointsArray.Value(PointsArray.Lower()) ;
// parameter_array =
// (Standard_Real *) &ParametersArray.Value(1) ;
// TangentFlags.SetValue(1,Standard_True) ; <- modification
// PLib::EvalLagrange(ParametersArray.Value(1),
// 1,
// degree,
// 3,
// point_array[0],
// parameter_array[0],
// eval_result[0][0]) ;
// for (ii = 1 ; ii <= 3 ; ii++) {
// a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
// }
// TangentsArray.SetValue(1,a_vector) ;
// }
// if (! TangentFlags.Value(TangentFlags.Upper())) {
// point_array =
// (Standard_Real *) &PointsArray.Value(PointsArray.Upper() - degree) ;
// TangentFlags.SetValue(TangentFlags.Upper(),Standard_True) ; <- modification
// parameter_array =
// (Standard_Real *) &ParametersArray.Value(ParametersArray.Upper() - degree) ;
// PLib::EvalLagrange(ParametersArray.Value(ParametersArray.Upper()),
// 1,
// degree,
// 3,
// point_array[0],
// parameter_array[0],
// eval_result[0][0]) ;
// for (ii = 1 ; ii <= 3 ; ii++) {
// a_vector.SetCoord(ii,eval_result[1][ii-1]) ;
// }
// TangentsArray.SetValue(TangentsArray.Upper(),a_vector) ;
// }
TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2018-03-10 21:41 sraymond New Issue
2018-03-10 21:41 sraymond Assigned To => msv