MantisBT - Community
View Issue Details
0032253Community[OCCT] OCCT:Meshpublic2021-03-27 21:362021-04-14 20:25
drazmyslovich 
bugmaster 
normalmajor 
closedwon't fix 
[OCCT] 7.4.0 
[OCCT] 7.6.0* 
0032253: Mesh - The refactored Mesher fails to mesh correctly scaled (planar) faces
This is a regression of the refactored Mesher introduced in 7.4.0 release. The refactored mesher incorrectly meshes the scaled faces.

Check the images and the model attached.
XOpen failed_scaling.xbf a
vinit
XDisplay a -dispMode 1
No tags attached.
related to 0027457assigned ifv Open CASCADE Modeling - Raise exception if scaled transformation is used for shape location 
child of 0026106closed bugmaster Open CASCADE BRepMesh - revision of data model 
? failed_scaling.xbf (27,471) 2021-03-27 21:36
https://tracker.dev.opencascade.org/
png Expected.PNG (53,354) 2021-03-27 21:39
https://tracker.dev.opencascade.org/
png Current_master.PNG (46,867) 2021-03-27 21:41
https://tracker.dev.opencascade.org/
patch 0001-0032253-Fix-the-incorrect-parameters-for-end-points-.patch (1,901) 2021-04-05 12:04
https://tracker.dev.opencascade.org/
patch 0001-0032253-Mesh-The-refactored-Mesher-fails-to-mesh-cor.patch (1,776) 2021-04-05 12:06
https://tracker.dev.opencascade.org/
patch 0002-0032253-Mesh-The-refactored-Mesher-fails-to-mesh-cor.patch (1,263) 2021-04-05 12:06
https://tracker.dev.opencascade.org/
Issue History
2021-03-27 21:36drazmyslovichNew Issue
2021-03-27 21:36drazmyslovichAssigned To => oan
2021-03-27 21:36drazmyslovichFile Added: failed_scaling.xbf
2021-03-27 21:39drazmyslovichFile Added: Expected.PNG
2021-03-27 21:41drazmyslovichFile Added: Current_master.PNG
2021-03-27 21:42gitNote Added: 0099793
2021-03-27 21:42kgvRelationship addedchild of 0026106
2021-03-27 21:45drazmyslovichNote Added: 0099794
2021-03-27 21:45drazmyslovichStatusnew => resolved
2021-03-27 21:46drazmyslovichNote Edited: 0099794bug_revision_view_page.php?bugnote_id=99794#r24833
2021-03-27 22:38msvRelationship addedrelated to 0027457
2021-03-27 22:45msvNote Added: 0099797
2021-03-27 22:46msvAssigned Tooan => drazmyslovich
2021-03-27 22:46msvStatusresolved => feedback
2021-03-29 11:57drazmyslovichNote Added: 0099807
2021-03-29 11:57drazmyslovichAssigned Todrazmyslovich => msv
2021-03-29 12:05msvNote Added: 0099808
2021-03-29 12:06msvNote Added: 0099809
2021-03-29 12:06msvAssigned Tomsv => bugmaster
2021-03-29 12:06msvResolutionopen => won't fix
2021-03-29 12:29kgvNote Added: 0099811
2021-03-29 12:29kgvAssigned Tobugmaster => oan
2021-03-29 12:29kgvStatusfeedback => resolved
2021-03-29 12:29kgvSummaryThe refactored Mesher fails to mesh correctly scaled (planar) faces => Mesh - The refactored Mesher fails to mesh correctly scaled (planar) faces
2021-03-29 15:05oanNote Added: 0099818
2021-03-30 12:10drazmyslovichNote Added: 0099859
2021-04-01 17:32gitNote Added: 0099960
2021-04-01 18:40gitNote Added: 0099962
2021-04-01 20:03gitNote Added: 0099972
2021-04-02 11:46gitNote Added: 0099982
2021-04-02 14:13gitNote Added: 0099990
2021-04-02 16:00oanNote Added: 0100002
2021-04-02 16:02oanNote Added: 0100003
2021-04-02 16:03oanAssigned Tooan => msv
2021-04-02 16:42msvNote Added: 0100004
2021-04-02 16:54oanNote Added: 0100005
2021-04-02 16:57msvNote Added: 0100007
2021-04-02 16:57msvAssigned Tomsv => kgv
2021-04-02 16:57msvStatusresolved => feedback
2021-04-02 17:07kgvNote Added: 0100009
2021-04-02 17:08kgvNote Edited: 0100009bug_revision_view_page.php?bugnote_id=100009#r24970
2021-04-05 09:58kgvAssigned Tokgv => msv
2021-04-05 10:39msvNote Added: 0100099
2021-04-05 10:39msvAssigned Tomsv => bugmaster
2021-04-05 12:04kgvFile Added: 0001-0032253-Fix-the-incorrect-parameters-for-end-points-.patch
2021-04-05 12:06kgvFile Added: 0001-0032253-Mesh-The-refactored-Mesher-fails-to-mesh-cor.patch
2021-04-05 12:06kgvFile Added: 0002-0032253-Mesh-The-refactored-Mesher-fails-to-mesh-cor.patch
2021-04-06 09:47drazmyslovichNote Added: 0100112
2021-04-07 16:01bugmasterStatusfeedback => closed
2021-04-14 20:25gitNote Added: 0100300

Notes
(0099793)
git   
2021-03-27 21:42   
Branch CR0032253 has been created by drazmyslovich.

SHA-1: 35df88a593acbf196981c3a85b96c533a868708a


Detailed log of new commits:

Author: Dzmitry Razmyslovich
Date: Sat Mar 27 19:38:16 2021 +0100

    0032253: Fix the incorrect parameters for end points - get parameters directly from curve instead of relying on the parameter provider
(0099794)
drazmyslovich   
2021-03-27 21:45   
(edited on: 2021-03-27 21:46)
Hello, Oleg.

I am not sure if the fix I propose is the best one. Most probably, it is better to fix the parameter provider to gracefully handle the scaled (at least) planes. As far as I understand, currently for planes the parameters provider just projects a point on plane without taking the scaling into account which results in an error.

My fix demonstrates where the problem is located and fixes the problem in my particular case, therefore I haven't investigated it further.

Regards,
Dima

(0099797)
msv   
2021-03-27 22:45   
Hello Dmitry,

Please see the bug 0027457. We are going to forbid storing a location with scale factor in shapes. Instead, when one wants to scale a shape he should use the algorithm BRepBuilderAPI_Transform that will modify the geometry.

Even if your current patch fixes this particular problem with a scaled shape, you may face the same-cause problem in many other OCCT algorithms.

So, please think about using BRepBuilderAPI_Transform instead of patching OCCT codes against this issue.

Regards,
Mikhail
(0099807)
drazmyslovich   
2021-03-29 11:57   
Hello, Mikhail,

thank you very much for providing this valuable information. We will adapt our code to have no scaling in the transformation matrices.

Do you also plan in the context of 0027457 to add some compatibility code for 'old' native occ files, which contain shapes with scaling transforms? Or should we develop such compatibility code ourselves? Our customers have definitely tons of projects with such xbf files.

Regards,
Dima
(0099808)
msv   
2021-03-29 12:05   
I will pass this wish into that ticket. We will try to consider it.
(0099809)
msv   
2021-03-29 12:06   
Dear bugmaster, please close this bug.
(0099811)
kgv   
2021-03-29 12:29   
Oleg,

could you please take a look onto proposed patch and comment if it looks reasonable / should be moved to another location?

I would prefer integrating a fix into BRepMesh if it would not require dramatic rewriting, as preventing scale factor in TopLoc_Location by 0027457 could take much time and we do not have yet elaborated when and how it will be raised.
(0099818)
oan   
2021-03-29 15:05   
DC,

Patch looks appropriate for this particular issue.
As I can see, in general case there are only two points for each edge in this case and modification works pretty well.

However, personally, I am concerned about scaled non-planar cases, i.e. NURBS when more than two points exist for each edge.

Dima, do you have any use cases of such shapes?
(0099859)
drazmyslovich   
2021-03-30 12:10   
I will check and either find such a model or ask to create one.
(0099960)
git   
2021-04-01 17:32   
Branch CR32253 has been created by oan.

SHA-1: 41f9783949a9a3037e582cc943d342068d226237


Detailed log of new commits:

Author: oan
Date: Wed Mar 31 14:54:00 2021 +0300

    0032253: Mesh - The refactored Mesher fails to mesh correctly scaled (planar) faces
    
    IMeshTools_ShapeExplorer: process face without any transformation
(0099962)
git   
2021-04-01 18:40   
Branch CR32253 has been updated forcibly by oan.

SHA-1: f181545a11e1486c9842f8fed11fe3daaafbacd5
(0099972)
git   
2021-04-01 20:03   
Branch CR32253 has been updated forcibly by oan.

SHA-1: 6c403f08f06dc5adcd57bade3c77b3af4d0a0295
(0099982)
git   
2021-04-02 11:46   
Branch CR32253 has been updated by oan.

SHA-1: c5bb75b75460cde8dfb5e027a081aa344a85b3be


Detailed log of new commits:

Author: oan
Date: Fri Apr 2 11:46:35 2021 +0300

    0032253: Mesh - The refactored Mesher fails to mesh correctly scaled (planar) faces
    
    IMeshTools_ShapeExplorer: use transformation without scale factor

(0099990)
git   
2021-04-02 14:13   
Branch CR32253_base has been created by oan.

SHA-1: 6c403f08f06dc5adcd57bade3c77b3af4d0a0295


No new revisions were added by this update.
(0100002)
oan   
2021-04-02 16:00   
Hello Dima,

I have checked your patch and added two alternative variants to fix the problem on common level (see commits in CR32253_base and CR32253).

However, all of them contain regressions due to which they could not be integrated yet.

The most stable is CR0032253 - leads mostly to absence of some triangles in the mesh along the frontier edges.

CR32253_base - it contains mostly async edges problem when points related to shared edges do not coincide on adjacent faces. In some specific cases where face has huge gaps between ends of the edges, triangulation could be absent.

CR32253 - produces the most number of regressions of the same nature as previous one.
(0100003)
oan   
2021-04-02 16:02   
Mikhail,

could you please have a look at the testing results for the aforementioned changes:

CR0032253:
http://vm-jenkins-test-12.nnov.opencascade.com:8080/view/master-CR0032253-OAN/view/COMPARE/ [^]

CR32253_base:
http://vm-jenkins-test-12.nnov.opencascade.com:8080/view/master-CR32253_base_OAN/view/COMPARE/ [^]

CR32253:
http://vm-jenkins-test-12.nnov.opencascade.com:8080/view/master-CR32253-OAN/view/COMPARE/ [^]
(0100004)
msv   
2021-04-02 16:42   
According to the test results, none of the proposed patches passed the tests.
(0100005)
oan   
2021-04-02 16:54   
Yes, what do you think about further steps, should we wait for the patch 0027457 as a common solution or, maybe, some ideas regarding finalization of this one?
(0100007)
msv   
2021-04-02 16:57   
So, I again propose to close this bug.
(0100009)
kgv   
2021-04-02 17:07   
(edited on: 2021-04-02 17:08)
> So, I again propose to close this bug.
OK, if solving the issue requires unjustified efforts for use case, that we would like to disallow at all, then it looks unreasonable pushing it forward.

(0100099)
msv   
2021-04-05 10:39   
Dear bugmaster, please close this bug.
(0100112)
drazmyslovich   
2021-04-06 09:47   
Dear Mikhail, Oleg and kgv,

thanks a lot for looking into the issue, considering my fix and proposing other fixes. We will then fix the issue on our end avoiding the scaled shapes to be produced.

Regards,
Dima
(0100300)
git   
2021-04-14 20:25   
Branch CR32253_base has been deleted by oan.

SHA-1: 6c403f08f06dc5adcd57bade3c77b3af4d0a0295