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

0030582: Coding - avoid defining references to properties of NULL objects

Approx_SweepApproximation::Perform() now creates empty arrays.
GeomAdaptor_SurfaceOfRevolution::UTrim() - fixed No_Exception misuse.
StdPrs_ShadedShape - fixed defining an invalid reference to Poly_Triangulation::UVNodes().

BSplCLib::MovePoint() and BSplCLib::MovePointAndTangent() now take optional
weights parameter as pointer consistent to other methods like BSplCLib::BuildEval().
This commit is contained in:
kgv
2019-03-15 18:06:04 +03:00
committed by apn
parent afb3647b34
commit aff73fd598
12 changed files with 296 additions and 583 deletions

View File

@@ -1337,7 +1337,7 @@ public:
//! (3, NbPoles-2) -> the ends and the tangency are enforced
//! if Problem in BSplineBasis calculation, no change for the curve
//! and FirstIndex, LastIndex = 0
Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec2d& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const Standard_Boolean Rational, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt2d& NewPoles);
Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec2d& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt2d& NewPoles);
//! Find the new poles which allows an old point (with a
//! given u as parameter) to reach a new position
@@ -1348,7 +1348,7 @@ public:
//! (3, NbPoles-2) -> the ends and the tangency are enforced
//! if Problem in BSplineBasis calculation, no change for the curve
//! and FirstIndex, LastIndex = 0
Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const Standard_Boolean Rational, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt& NewPoles);
Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt& NewPoles);
//! This is the dimension free version of the utility
//! U is the parameter must be within the first FlatKnots and the
@@ -1366,7 +1366,7 @@ public:
//! = ...
//! Same holds for EndingCondition
//! Poles are the poles of the curve
//! Weights are the weights of the curve if Rational = Standard_True
//! Weights are the weights of the curve if not NULL
//! NewPoles are the poles of the deformed curve
//! ErrorStatus will be 0 if no error happened
//! 1 if there are not enough knots/poles
@@ -1375,7 +1375,7 @@ public:
//! If StartCondition = 1 and EndCondition = 1 then you need at least
//! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
//! have at least 2 internal knots.
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const Standard_Integer ArrayDimension, Standard_Real& Delta, Standard_Real& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Boolean Rational, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Real& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Real& NewPoles, Standard_Integer& ErrorStatus);
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const Standard_Integer ArrayDimension, Standard_Real& Delta, Standard_Real& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Real& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Real& NewPoles, Standard_Integer& ErrorStatus);
//! This is the dimension free version of the utility
//! U is the parameter must be within the first FlatKnots and the
@@ -1393,7 +1393,7 @@ public:
//! = ...
//! Same holds for EndingCondition
//! Poles are the poles of the curve
//! Weights are the weights of the curve if Rational = Standard_True
//! Weights are the weights of the curve if not NULL
//! NewPoles are the poles of the deformed curve
//! ErrorStatus will be 0 if no error happened
//! 1 if there are not enough knots/poles
@@ -1402,7 +1402,7 @@ public:
//! If StartCondition = 1 and EndCondition = 1 then you need at least
//! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
//! have at least 2 internal knots.
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec& Delta, const gp_Vec& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Boolean Rational, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt& NewPoles, Standard_Integer& ErrorStatus);
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec& Delta, const gp_Vec& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt& NewPoles, Standard_Integer& ErrorStatus);
//! This is the dimension free version of the utility
//! U is the parameter must be within the first FlatKnots and the
@@ -1420,7 +1420,7 @@ public:
//! = ...
//! Same holds for EndingCondition
//! Poles are the poles of the curve
//! Weights are the weights of the curve if Rational = Standard_True
//! Weights are the weights of the curve if not NULL
//! NewPoles are the poles of the deformed curve
//! ErrorStatus will be 0 if no error happened
//! 1 if there are not enough knots/poles
@@ -1429,7 +1429,7 @@ public:
//! If StartCondition = 1 and EndCondition = 1 then you need at least
//! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
//! have at least 2 internal knots.
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec2d& Delta, const gp_Vec2d& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Boolean Rational, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& ErrorStatus);
Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec2d& Delta, const gp_Vec2d& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& ErrorStatus);
//! given a tolerance in 3D space returns a

View File

@@ -567,11 +567,10 @@ void BSplCLib::MovePointAndTangent(const Standard_Real U,
Standard_Real &DeltaDerivatives,
const Standard_Real Tolerance,
const Standard_Integer Degree,
const Standard_Boolean Rational,
const Standard_Integer StartingCondition,
const Standard_Integer EndingCondition,
Standard_Real& Poles,
const TColStd_Array1OfReal& Weights,
const TColStd_Array1OfReal* Weights,
const TColStd_Array1OfReal& FlatKnots,
Standard_Real& NewPoles,
Standard_Integer& ErrorStatus)
@@ -603,8 +602,8 @@ void BSplCLib::MovePointAndTangent(const Standard_Real U,
ErrorStatus = 0 ;
weights_array = NULL ;
if (Rational) {
weights_array = (Standard_Real *) &Weights(Weights.Lower()) ;
if (Weights != NULL) {
weights_array = const_cast<Standard_Real*>(&Weights->First());
}
poles_array = &Poles ;
@@ -765,7 +764,7 @@ void BSplCLib::MovePointAndTangent(const Standard_Real U,
extrap_mode[0] = Degree ;
extrap_mode[1] = Degree ;
if (Rational) {
if (Weights != NULL) {
//
// evaluate in homogenised form
//

View File

@@ -1218,9 +1218,8 @@ void BSplCLib::MovePoint (const Standard_Real U,
const Standard_Integer Index1,
const Standard_Integer Index2,
const Standard_Integer Degree,
const Standard_Boolean Rational,
const Array1OfPoints& Poles,
const TColStd_Array1OfReal& Weights,
const TColStd_Array1OfReal* Weights,
const TColStd_Array1OfReal& FlatKnots,
Standard_Integer& FirstIndex,
Standard_Integer& LastIndex,
@@ -1280,8 +1279,8 @@ void BSplCLib::MovePoint (const Standard_Real U,
for (i = 1; i <= Degree+1; i++) {
ii = i + FirstNonZeroBsplineIndex - 1;
if (Rational) {
hN = Weights(ii)*BSplineBasis(1, i);
if (Weights != NULL) {
hN = Weights->Value(ii)*BSplineBasis(1, i);
D2 += hN;
}
else {
@@ -1301,7 +1300,7 @@ void BSplCLib::MovePoint (const Standard_Real U,
}
}
if (Rational) {
if (Weights != NULL) {
Coef = D2/D1;
}
else {
@@ -1345,11 +1344,10 @@ void BSplCLib::MovePointAndTangent (const Standard_Real U,
const Vector& DeltaDerivatives,
const Standard_Real Tolerance,
const Standard_Integer Degree,
const Standard_Boolean Rational,
const Standard_Integer StartingCondition,
const Standard_Integer EndingCondition,
const Array1OfPoints& Poles,
const TColStd_Array1OfReal& Weights,
const TColStd_Array1OfReal* Weights,
const TColStd_Array1OfReal& FlatKnots,
Array1OfPoints& NewPoles,
Standard_Integer & ErrorStatus)
@@ -1376,7 +1374,6 @@ void BSplCLib::MovePointAndTangent (const Standard_Real U,
delta_derivative_array[0],
Tolerance,
Degree,
Rational,
StartingCondition,
EndingCondition,
poles_array[0],