1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028594: Geom2dAPI_Interpolate generated curve is not the same as proe

Boolean flag "Scale" has been added for methods "Load" in "Geom2dAPI_Interpolate" class
This commit is contained in:
imn
2017-03-29 18:28:33 +03:00
committed by bugmaster
parent 2d0621bf94
commit 353e6fa0cf
4 changed files with 111 additions and 14 deletions

View File

@@ -405,7 +405,8 @@ myTangentRequest(Standard_False)
void Geom2dAPI_Interpolate::Load(
const TColgp_Array1OfVec2d& Tangents,
const Handle(TColStd_HArray1OfBoolean)& TangentFlagsPtr)
const Handle(TColStd_HArray1OfBoolean)& TangentFlagsPtr,
const Standard_Boolean Scale)
{
Standard_Boolean result ;
@@ -426,10 +427,12 @@ void Geom2dAPI_Interpolate::Load(
for (ii = Tangents.Lower() ; ii <= Tangents.Upper() ; ii++ ) {
myTangents->SetValue(ii,Tangents.Value(ii)) ;
}
ScaleTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
TangentFlagsPtr->Array1(),
myParameters->Array1()) ;
if (Scale) {
ScaleTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
TangentFlagsPtr->Array1(),
myParameters->Array1()) ;
}
}
else {
throw Standard_ConstructionError();
@@ -444,7 +447,8 @@ void Geom2dAPI_Interpolate::Load(
//=======================================================================
void Geom2dAPI_Interpolate::Load(const gp_Vec2d& InitialTangent,
const gp_Vec2d& FinalTangent)
const gp_Vec2d& FinalTangent,
const Standard_Boolean Scale)
{
Standard_Boolean result ;
myTangentRequest = Standard_True ;
@@ -459,10 +463,12 @@ void Geom2dAPI_Interpolate::Load(const gp_Vec2d& InitialTangent,
if (!result) {
throw Standard_ConstructionError();
}
ScaleTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->Array1(),
myParameters->Array1()) ;
if (Scale) {
ScaleTangents(myPoints->Array1(),
myTangents->ChangeArray1(),
myTangentFlags->Array1(),
myParameters->Array1()) ;
}
}
//=======================================================================

View File

@@ -56,14 +56,19 @@ public:
//! It is also used to check if the tangent vector is not too small.
//! There should be at least 2 points
//! if PeriodicFlag is True then the curve will be periodic.
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance);
//! if PeriodicFlag is True then the curve will be periodic
//! Warning:
//! There should be as many parameters as there are points
//! except if PeriodicFlag is True : then there should be one more
//! parameter to close the curve
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, const Handle(TColStd_HArray1OfReal)& Parameters, const Standard_Boolean PeriodicFlag, const Standard_Real Tolerance);
Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points,
const Handle(TColStd_HArray1OfReal)& Parameters,
const Standard_Boolean PeriodicFlag,
const Standard_Real Tolerance);
//! Assigns this constrained BSpline curve to be
//! tangential to vectors InitialTangent and FinalTangent
@@ -71,7 +76,11 @@ public:
//! the first and last points of the table of
//! points through which the curve passes, as
//! defined at the time of initialization).
Standard_EXPORT void Load (const gp_Vec2d& InitialTangent, const gp_Vec2d& FinalTangent);
//! <Scale> - boolean flag defining whether tangent vectors are to
//! be scaled according to derivatives of lagrange interpolation.
Standard_EXPORT void Load(const gp_Vec2d& InitialTangent,
const gp_Vec2d& FinalTangent,
const Standard_Boolean Scale = Standard_True);
//! Assigns this constrained BSpline curve to be
//! tangential to vectors defined in the table Tangents,
@@ -82,7 +91,11 @@ public:
//! the flag given in the parallel table
//! TangentFlags is true: only these vectors
//! are set as tangency constraints.
Standard_EXPORT void Load (const TColgp_Array1OfVec2d& Tangents, const Handle(TColStd_HArray1OfBoolean)& TangentFlags);
//! <Scale> - boolean flag defining whether tangent vectors are to
//! be scaled according to derivatives of lagrange interpolation.
Standard_EXPORT void Load(const TColgp_Array1OfVec2d& Tangents,
const Handle(TColStd_HArray1OfBoolean)& TangentFlags,
const Standard_Boolean Scale = Standard_True);
//! Clears all tangency constraints on this
//! constrained BSpline curve (as initialized by the function Load).