MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0028131Community[OCCT] OCCT:Modeling Algorithmspublic2016-11-20 09:532017-09-29 16:29
Reporterdevocctgp 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 7.0.0 
Target Version[OCCT] 7.2.0Fixed in Version[OCCT] 7.2.0 
Summary0028131: BRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve
DescriptionBRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve,
it throw can't calculate D0 Normal

tested in 7.1.0 beta and 7.0.0
Steps To Reproducetest bugs modalg_7 bug28131

<code>
        double offset_thick = 2;
    double height = 8.5;
    gp_Pnt JiZhunXian2_v0 = gp_Pnt(-17.6, 0.0, 0.0);
    gp_Pnt JiZhunXian2_v1 = gp_Pnt(0, 32.8, 0.0);

    // 草绘3 - 基础外侧轮廓线
    TColgp_Array1OfPnt outer_e_bzr_geom_v(1, 4);
    {
        outer_e_bzr_geom_v(1) = JiZhunXian2_v0;
        outer_e_bzr_geom_v(4) = JiZhunXian2_v1;

        Standard_Real ratio1 = 5.4 / 13.2;
        outer_e_bzr_geom_v(2) = gp_Pnt(outer_e_bzr_geom_v(1).X(), ratio1*outer_e_bzr_geom_v(4).Y(), 0);
        Standard_Real ratio2 = 6.0 / 6.8;
        outer_e_bzr_geom_v(3) = gp_Pnt(ratio2*outer_e_bzr_geom_v(1).X(), outer_e_bzr_geom_v(4).Y(), 0);
    }

    Handle(Geom_BezierCurve) outer_e_bzr_geom = new Geom_BezierCurve(outer_e_bzr_geom_v);
    Handle(Geom_BSplineCurve) outer_e_bsp_geom = GeomConvert::CurveToBSplineCurve(outer_e_bzr_geom);
    TopoDS_Edge outer_e = BRepBuilderAPI_MakeEdge(outer_e_bsp_geom);

    Handle(Geom_BSplineCurve) curve1;
    {
        Handle(TColgp_HArray1OfPnt2d) harray = new TColgp_HArray1OfPnt2d(1, 2); // sizing harray
        harray->SetValue(1, gp_Pnt2d(-JiZhunXian2_v1.Y(), 0));
        harray->SetValue(2, gp_Pnt2d(0, height + height / 2));

        Geom2dAPI_Interpolate anInterpolation(harray, Standard_False, 1e-6);

        gp_Vec2d vtangent1(0, 1);
        gp_Vec2d vtangent2(1, 0);
        anInterpolation.Load(vtangent1, vtangent2);
        anInterpolation.Perform();

        Handle(Geom2d_BSplineCurve) c = anInterpolation.Curve();

        gp_Pln pln(gp_Ax3(gp_Pnt(), gp_Dir(1, 0, 0), gp_Dir(0, -1, 0)));

        Handle(Geom_BSplineCurve) c3d = Handle(Geom_BSplineCurve)::DownCast(GeomAPI::To3d(c, pln));
        curve1 = c3d;
    }

    Handle(Geom_BSplineCurve) curve2;
    {
        Handle(TColgp_HArray1OfPnt2d) harray = new TColgp_HArray1OfPnt2d(1, 3); // sizing harray
        harray->SetValue(1, gp_Pnt2d(-JiZhunXian2_v0.X(), 0));
        harray->SetValue(2, gp_Pnt2d(-JiZhunXian2_v0.X() - 2.6, height));
        harray->SetValue(3, gp_Pnt2d(0, height + height / 2));

        Geom2dAPI_Interpolate anInterpolation(harray, Standard_False, 1e-6);
        anInterpolation.Perform();

        Handle(Geom2d_BSplineCurve) c = anInterpolation.Curve();
        gp_Pln pln(gp_Ax3(gp_Pnt(), gp_Dir(0, -1, 0), gp_Dir(-1, 0, 0)));
        Handle(Geom_BSplineCurve) c3d = Handle(Geom_BSplineCurve)::DownCast(GeomAPI::To3d(c, pln));
        curve2 = c3d;
    }

    //////////////////////////////////////
    GeomFill_BSplineCurves fill2;
    fill2.Init(outer_e_bsp_geom, curve1, curve2, GeomFill_CoonsStyle);

    const Handle(Geom_BSplineSurface)& surf_geom = fill2.Surface();

    TopoDS_Shape filled_face = BRepBuilderAPI_MakeFace(surf_geom, 0);

    ///////////////////////////////////////////////////////////////////////
    TopoDS_Solid first_solid;
    {
        BRepOffset_MakeOffset myOffsetShape(filled_face, -offset_thick, 1e-4,
            BRepOffset_Skin, //Mode
            Standard_False, //Intersection
            Standard_False, //SelfInter
            GeomAbs_Intersection, //Join
            Standard_True, //Thickening
            Standard_False //RemoveIntEdges
            ); //RemoveInvalidFaces
        first_solid = TopoDS::Solid(myOffsetShape.Shape());
    }
</code>
TagsNo tags attached.
Test case numberbugs modalg_7 bug28131
Attached Filespng file icon offseterror.png (229,681 bytes) 2016-11-20 09:53
? file icon bug28131.brep (2,010 bytes) 2017-02-03 10:58

- Relationships
related to 0025730closedmsv Community result of MakeThickSolid aborts the BOPCheck in Geom_OffsetSurface::SetD0 
related to 0029060assignedmsv Open CASCADE BRepOffset_MakeOffset produces invalid shape in test bugs modalg_7 bug28131 

-  Notes
(0069748)
git (administrator)
2017-08-22 15:05

Branch CR28131 has been created by abv.

SHA-1: bc78da5d824bc15a05b0e1643a0f0eb98d05fffc


Detailed log of new commits:

Author: abv
Date: Tue Aug 22 15:05:00 2017 +0300

    0028131: BRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve
    
    Handling of degenerated points (with all derivatives zero) in GeomEvaluator_OffsetSurface is improved by iterative movement towards middle of the surface (extension of one-step approach implemented earlier in #28112).
    
    Test bugs modalg_7 bug28131 added
(0069761)
git (administrator)
2017-08-22 19:15

Branch CR28131 has been updated forcibly by abv.

SHA-1: 9b9b91ea0ac86a8f18cae99ccab5bafe7cdf4028
(0069770)
git (administrator)
2017-08-23 11:15

Branch CR28131_1 has been created by abv.

SHA-1: 2650a424a0aea200b90ac90595e5f00144d0d2d5


Detailed log of new commits:

Author: abv
Date: Tue Aug 22 15:05:00 2017 +0300

    0028131: BRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve
    
    Handling of degenerated points (with all derivatives zero) in GeomEvaluator_OffsetSurface is improved by iterative movement towards middle of the surface (extension of one-step approach implemented earlier in #28112).
    
    Test bugs modalg_7 bug28131 added
    
    TODO removed in test bugs modalg_7 bug25730 (the problem seems to be fixed by this change)
(0069795)
abv (manager)
2017-08-23 15:47

Fix pushed to CR28131_1, please review. Tests have passed, see Jenkins job CR28131-master-abv.

The implemented approach is extension of the fix made previously for #28112:
- if calculation of normal fails at some point, we move iteratively from this point towards parametric center of the surface;
- first step is taken equal to Precision::PConfusion();
- and each next step is taken twice greater than previous one;
- this is continued until either we get to point where normal can be computed, or pass across the center of the surface (in this case calculation fails).
(0069801)
msv (developer)
2017-08-23 18:22

tests/bugs/modalg_7/bug28131
- Please add checking of the result shapes with "checkprops -s" (check surface area).

src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx
- 31: derivetive => derivative
- Shifting to the center will give rotation of normal on surfaces like a cone.

We need to consider different causes of normal computation failure:

a) One of derivatives is null. In this case we must shift along the iso-line with non-null derivative.

b) Derivatives are parallel. In this case we can shift along any iso-line.

For the case (b) I propose to shift along the iso-line with the greatest derivative magnitude. Accepting this, we can generalize solution taking the greatest derivative for the case (a), too.
In such way, we will get rid of calculating Sqrt.
Derivative is accessible after the previous call to CalculateDx.
(0069812)
git (administrator)
2017-08-24 10:23

Branch CR28131_1 has been updated by abv.

SHA-1: b0a514cb9a785385444e33349f39740eac059477


Detailed log of new commits:

Author: abv
Date: Thu Aug 24 10:22:57 2017 +0300

    # corrections according to review remarks

(0069814)
abv (manager)
2017-08-24 10:39

I have pushed correction in the same branch, please review again. Note that I kept the code generic, in the hope that it can help also in more complex cases, hence it still uses Sqrt; the only change is that if one of U or V directions is singular, we do not shift in that direction.

The result seems to be more correct than before.

However I recognized that simple offset algorithm does not handle situation when degenerated edge becomes non-degenerated on offset; separate issue #29044 is created for that.

There are also questions to be investigated:

- In the seemingly similar situation with conical surface converted to NURBS normal at apex is computed without tricks made for #28112 and 0028131; this is likely due to usage of osculating surfaces within offset evaluator. Perhaps relevant code can be improved to handle also cases found in #28112 and 0028131.

- Standard offset algorithm produces invalid shape; see test bugs modalg bug28131 (fixshape is used to fix the shape, and result is high tolerance). Note that such problem does not appear on cone.
(0069837)
msv (developer)
2017-08-24 14:28

I have no more remarks.
Probably we need to analyze why standard offset algorithm produces invalid shape on test bugs modalg bug28131.
(0069861)
abv (manager)
2017-08-25 06:43
edited on: 2017-08-25 07:04

Just for the record, I have tried to disable creation of osculating surface objects in offset classes. This caused the following tests to fail:

bugs modalg_5 bug25406_1 bug25406_2
offset simple A02 A05 A09 A12 D02
offset with_intersect_20 H1
offset with_intersect_80 H1 K8

Another note is that in case of offsetting conical face (see #29044), osculating surface is not actually used -- in this case, normal in apex point os computed using higher order derivatives.

(0069889)
git (administrator)
2017-08-25 16:13

Branch CR28131_2 has been created by abv.

SHA-1: 1a4fed1b0487a6b7b6518e14e982cb7985e3605e


Detailed log of new commits:

Author: abv
Date: Tue Aug 22 15:05:00 2017 +0300

    0028131: BRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve
    
    Handling of degenerated points (with all derivatives zero) in GeomEvaluator_OffsetSurface is improved by iterative movement towards middle of the surface (extension of one-step approach implemented earlier in #28112).
    
    Test bugs modalg_7 bug28131 added
    
    TODO removed in test bugs modalg_7 bug25730 (the problem seems to be fixed by this change)
(0069966)
git (administrator)
2017-08-28 10:23

Branch CR28131_2 has been updated forcibly by abv.

SHA-1: fbc1cd16e5995af57d98103a0c051b46633692de
(0069967)
abv (manager)
2017-08-28 10:31

Please consider branch CR28131_2 for integration; tests have passed -- see Jenkins job CR28131-master-abv
(0069972)
bugmaster (administrator)
2017-08-28 12:16

Combination -
OCCT branch : CR28131_2 - SHA-1: fbc1cd16e5995af57d98103a0c051b46633692de
Products branch : master
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.

http://jenkins-test-10.nnov.opencascade.com/view/CR28131-master-abv/ [^]

Number of compiler warnings:

OCCT :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

Products :
Linux: 4 (4 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:

Windows:
OCCT
Total CPU difference: 17330.010689098726 / 17295.75286949859 [+0.20%]
Producst
Total CPU difference: 7688.758886599963 / 7720.302288799964 [-0.41%]

Linux:
OCCT
Total CPU difference: 19451.89000000023 / 19456.560000000376 [-0.02%]
Products
Total CPU difference: 7703.40000000009 / 7725.120000000072 [-0.28%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

New test case is OK
(0070178)
git (administrator)
2017-09-04 18:20

Branch CR28131 has been deleted by kgv.

SHA-1: 9b9b91ea0ac86a8f18cae99ccab5bafe7cdf4028
(0070179)
git (administrator)
2017-09-04 18:20

Branch CR28131_1 has been deleted by kgv.

SHA-1: b0a514cb9a785385444e33349f39740eac059477
(0070180)
git (administrator)
2017-09-04 18:20

Branch CR28131_2 has been deleted by kgv.

SHA-1: fbc1cd16e5995af57d98103a0c051b46633692de

- Related Changesets
occt: master 2a9be0e2
Timestamp: 2017-08-22 12:05:00
Author: abv
Committer: bugmaster
Details ] Diff ]
0028131: BRepOffset_MakeOffset can't create offset with a face which created by filling 3 bsplinecurve

Handling of degenerated points (with all derivatives zero) in GeomEvaluator_OffsetSurface is improved by iterative movement towards middle of the surface (extension of one-step approach implemented earlier in #28112).
mod - src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx Diff ] File ]
mod - src/QABugs/QABugs_20.cxx Diff ] File ]
mod - tests/bugs/modalg_7/bug25730 Diff ] File ]
add - tests/bugs/modalg_7/bug28131 Diff ] File ]

- Issue History
Date Modified Username Field Change
2016-11-20 09:53 devocctgp New Issue
2016-11-20 09:53 devocctgp Assigned To => msv
2016-11-20 09:53 devocctgp File Added: offseterror.png
2016-11-21 09:11 msv Relationship added related to 0028112
2016-11-21 09:11 msv Assigned To msv => aml
2016-11-21 09:11 msv Status new => assigned
2016-11-21 09:11 msv Target Version 7.1.0 => 7.2.0
2016-11-21 09:12 msv Product Version => 7.0.0
2017-01-24 09:54 msv Assigned To aml => azv
2017-02-03 10:58 azv File Added: bug28131.brep
2017-07-21 11:22 msv Target Version 7.2.0 => 7.3.0
2017-08-02 11:40 azv Relationship added related to 0028968
2017-08-22 15:05 git Note Added: 0069748
2017-08-22 18:16 abv Relationship added related to 0025730
2017-08-22 19:15 git Note Added: 0069761
2017-08-23 11:15 git Note Added: 0069770
2017-08-23 15:47 abv Note Added: 0069795
2017-08-23 15:47 abv Assigned To azv => msv
2017-08-23 15:47 abv Status assigned => resolved
2017-08-23 15:47 abv Steps to Reproduce Updated View Revisions
2017-08-23 18:22 msv Note Added: 0069801
2017-08-23 18:23 msv Assigned To msv => abv
2017-08-23 18:23 msv Status resolved => assigned
2017-08-24 08:36 abv Target Version 7.3.0 => 7.2.0
2017-08-24 10:20 abv Relationship added related to 0029044
2017-08-24 10:23 git Note Added: 0069812
2017-08-24 10:39 abv Note Added: 0069814
2017-08-24 10:39 abv Assigned To abv => msv
2017-08-24 10:39 abv Status assigned => resolved
2017-08-24 14:28 msv Note Added: 0069837
2017-08-25 06:43 abv Note Added: 0069861
2017-08-25 07:04 abv Note Edited: 0069861 View Revisions
2017-08-25 16:13 git Note Added: 0069889
2017-08-28 10:14 msv Relationship added related to 0029060
2017-08-28 10:23 git Note Added: 0069966
2017-08-28 10:31 abv Note Added: 0069967
2017-08-28 10:31 abv Assigned To msv => bugmaster
2017-08-28 10:31 abv Status resolved => reviewed
2017-08-28 11:53 bugmaster Test case number => bugs modalg_7 bug28131
2017-08-28 12:16 bugmaster Note Added: 0069972
2017-08-28 12:16 bugmaster Status reviewed => tested
2017-08-31 18:37 bugmaster Changeset attached => occt master 2a9be0e2
2017-08-31 18:37 bugmaster Status tested => verified
2017-08-31 18:37 bugmaster Resolution open => fixed
2017-09-04 18:20 git Note Added: 0070178
2017-09-04 18:20 git Note Added: 0070179
2017-09-04 18:20 git Note Added: 0070180
2017-09-29 16:17 user533 Fixed in Version => 7.2.0
2017-09-29 16:29 user533 Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker