1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0032557: Modeling Data - Use of BRepBuilderAPI_NurbsConvert create 2d p-curves with gaps

GeomConvert/GeomConvert_1.cxx - method CheckAndSegment is added to adjust surface periodic boundaries
bug32557 - test is updated by new cases
This commit is contained in:
ifv 2021-10-04 14:48:03 +03:00
parent 5b756182c2
commit 9923f08703
3 changed files with 35 additions and 5 deletions

View File

@ -504,10 +504,9 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
}
aMinDist *= aMinDist;
//Old domain
Standard_Real t = 0.5 * (f2d + l2d);
gp_Pnt2d aPf = C2d->Value(t);
gp_Pnt2d aPf = C2d->Value(f2d);
//New domain
gp_Pnt2d aNewPf = Curve2d->Value(t);
gp_Pnt2d aNewPf = Curve2d->Value(f2d);
gp_Vec2d aT(aNewPf, aPf);
if (aT.SquareMagnitude() > aMinDist)
{

View File

@ -383,6 +383,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
//
//For cylinders, cones, spheres, toruses
const Standard_Boolean isUClosed = Abs((ULast - UFirst) - 2. * M_PI) <= Precision::PConfusion();
const Standard_Real eps = 100. * Epsilon(2. * M_PI);
//
if (Surf->IsKind(STANDARD_TYPE(Geom_Plane))) {
TColgp_Array2OfPnt Poles (1, 2, 1, 2);
@ -415,6 +416,11 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
if (isUClosed) {
Convert_CylinderToBSplineSurface Convert (Cyl, VFirst, VLast);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbUKnots();
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
{
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else {
Convert_CylinderToBSplineSurface
@ -431,6 +437,11 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
if (isUClosed) {
Convert_ConeToBSplineSurface Convert (Co, VFirst, VLast);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbUKnots();
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
{
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else {
Convert_ConeToBSplineSurface
@ -450,6 +461,11 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
//Convert_SphereToBSplineSurface Convert (Sph, UFirst, ULast);
Convert_SphereToBSplineSurface Convert (Sph, VFirst, VLast, Standard_False);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbUKnots();
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
{
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else {
Convert_SphereToBSplineSurface
@ -468,10 +484,20 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
Convert_TorusToBSplineSurface Convert (Tr, VFirst, VLast,
Standard_False);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbUKnots();
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
{
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else if (Strim->IsVClosed()) {
Convert_TorusToBSplineSurface Convert (Tr, UFirst, ULast);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbVKnots();
if (Abs(TheSurface->VKnot(1) - VFirst) > eps || Abs(TheSurface->VKnot(aNbK) - VLast) > eps)
{
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else {
Convert_TorusToBSplineSurface
@ -575,7 +601,6 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
2 , C->Degree(),
periodic, C->IsPeriodic());
}

View File

@ -4,7 +4,13 @@ puts "==========================================================="
puts ""
restore [locate_data_file bug32557.brep] f
nurbsconvert bf f
checkmaxtol bf -ref 1.1e-7
restore [locate_data_file bug32557_1.brep] f
nurbsconvert bf f
checkmaxtol bf -ref 1.1e-5
restore [locate_data_file bug32557_2.brep] f
nurbsconvert bf f
checkmaxtol bf -ref 0.0002570