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

CR23683: Geom_BSplineSurface incorrectly determines continuity for periodic cases

Add a checking into files Geom_OffsetSurface.cxx, Geom_OffsetCurve.cxx, Geom2d_OffsetCurve.cxx , which try to make continuity of bspline surfaces and curves more than C0 to build offset.
Delete duplicate code and checkings
Prevent change of offset curve / surface when exception is raised due to attempt to set new C0 basis curve / surface
Added new QA command OCC23683. Added test case bugs/moddata_3/bug23683
This commit is contained in:
Roman Lygin
2013-04-17 15:26:49 +04:00
parent 973f1c39ac
commit 06be28a4f1
10 changed files with 221 additions and 207 deletions

View File

@@ -104,7 +104,7 @@ package BSplCLib
-- . Curves and Surfaces for Computer Aided Geometric Design,
-- a practical guide Gerald Farin
uses TColStd, gp, TColgp, math
uses TColStd, gp, TColgp, math, GeomAbs
is
@@ -353,6 +353,15 @@ is
-- Analyses the distribution of multiplicities between
-- the knot FromK1 and the Knot ToK2.
KnotAnalysis (Degree : Integer;
Periodic : Boolean;
CKnots : Array1OfReal from TColStd;
CMults : Array1OfInteger from TColStd;
KnotForm : out BSplKnotDistribution from GeomAbs;
MaxKnotMult: out Integer);
---Purpose: Analyzes the array of knots.
-- Returns the form and the maximum knot multiplicity.
Reparametrize (U1, U2 : Real;
Knots : in out Array1OfReal from TColStd);
---Purpose:

View File

@@ -649,6 +649,62 @@ BSplCLib_MultDistribution BSplCLib::MultForm
return MForm;
}
//=======================================================================
//function : KnotAnalysis
//purpose :
//=======================================================================
void BSplCLib::KnotAnalysis (const Standard_Integer Degree,
const Standard_Boolean Periodic,
const TColStd_Array1OfReal& CKnots,
const TColStd_Array1OfInteger& CMults,
GeomAbs_BSplKnotDistribution& KnotForm,
Standard_Integer& MaxKnotMult)
{
KnotForm = GeomAbs_NonUniform;
BSplCLib_KnotDistribution KSet =
BSplCLib::KnotForm (CKnots, 1, CKnots.Length());
if (KSet == BSplCLib_Uniform) {
BSplCLib_MultDistribution MSet =
BSplCLib::MultForm (CMults, 1, CMults.Length());
switch (MSet) {
case BSplCLib_NonConstant :
break;
case BSplCLib_Constant :
if (CKnots.Length() == 2) {
KnotForm = GeomAbs_PiecewiseBezier;
}
else {
if (CMults (1) == 1) KnotForm = GeomAbs_Uniform;
}
break;
case BSplCLib_QuasiConstant :
if (CMults (1) == Degree + 1) {
Standard_Real M = CMults (2);
if (M == Degree ) KnotForm = GeomAbs_PiecewiseBezier;
else if (M == 1) KnotForm = GeomAbs_QuasiUniform;
}
break;
}
}
Standard_Integer FirstKM =
Periodic ? CKnots.Lower() : BSplCLib::FirstUKnotIndex (Degree,CMults);
Standard_Integer LastKM =
Periodic ? CKnots.Upper() : BSplCLib::LastUKnotIndex (Degree,CMults);
MaxKnotMult = 0;
if (LastKM - FirstKM != 1) {
Standard_Integer Multi;
for (Standard_Integer i = FirstKM + 1; i < LastKM; i++) {
Multi = CMults (i);
MaxKnotMult = Max (MaxKnotMult, Multi);
}
}
}
//=======================================================================
//function : Reparametrize
//purpose :