MantisBT - Open CASCADE
View Issue Details
0029203Open CASCADE[OCCT] OCCT:Modeling Algorithmspublic2017-10-11 11:262019-07-18 18:34
nbv 
 
lowminor 
feedbackopen 
 
[OCCT] Unscheduled 
0029203: Ambiguous behavior of Point-Face-classification algorithms: shall it return ON-status?
See Steps To Reproduce.

Script 1.
Different algorithms return different results.

b2dclassifx DRAW-command uses "polygonal"-classifier (based on CSLib_Class2d).
b2dclassify uses "ray"-classifier (based on BRepClass_Intersector).

Wrong ON-status is returned by the reason of poor algorithm of IntRes2d_Position computation in BRepClass_Intersector class. Correct status is OUT.

Script 2.

3D-representation of the given point is in the wire of the given face.

      Draw[]> explode ff w
      # ff_1
      Draw[]> mksurf ss ff
      Draw[]> sval ss 1.6881493482012555 3.9044196877163997 xx yy zz
      Draw[]> vertex vv xx yy zz
      Draw[]> distmini dd ff_1 vv; dval dd_val
      # 3.039106595854385e-008 < Tolerance (1.0e-7)

However, distance point-curve in 2D-space is quite big.

      Draw[]> v2d
      Draw[]> pcurve ff
      Draw[]> 2dfit
      Draw[]> 2dproj ff_7 1.6881493482012555 3.9044196877163997
      #ext_1 ext_2 ext_3
      Draw[36]> length ext_1
      # 5.9317418539273143e-006

On the current MASTER, status OUT is returned. After the fix for issue #28211, status ON will be returned.
testgrid bug29203*

Test cases are attached to this issue.
SCRIPT # 1

The problem has been detected while fixing the bug #0028211 when debugging "de iges_1 O4" test case.

SCRIPT # 2

The problem has been detected while fixing the bug #0028211 when debugging "bugs modalg_6 bug27341_304" test case.
No tags attached.
related to 0029421feedback msv Make face classifier algorithm stable and robust 
related to 0030365resolved msv Create tool to compute deviation between any 2D-curve and some its segment 
? bug29203_transface.bin (85,016) 2017-10-11 11:33
https://tracker.dev.opencascade.org/
? bug29203_toron.bin (5,773) 2017-10-19 18:06
https://tracker.dev.opencascade.org/
? bug29203_1 (1,027) 2018-01-12 14:57
https://tracker.dev.opencascade.org/
? bug29203_2 (1,107) 2018-01-12 14:57
https://tracker.dev.opencascade.org/
patch 0002-0029203-Ambiguous-behavior-of-Point-Face-classificat.patch (103,844) 2018-01-22 13:27
https://tracker.dev.opencascade.org/
Issue History
2017-10-11 11:26nbvNew Issue
2017-10-11 11:26nbvAssigned To => msv
2017-10-11 11:26nbvFile Added: bug28211_transface.bin
2017-10-11 11:27nbvNote Added: 0071332
2017-10-11 11:27nbvPrioritynormal => low
2017-10-11 11:29nbvRelationship addedrelated to 0028211
2017-10-11 11:33nbvFile Deleted: bug28211_transface.bin
2017-10-11 11:33nbvFile Added: bug29203_transface.bin
2017-10-11 11:34nbvFile Added: bug29203
2017-10-11 11:35nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17864#r17864
2017-10-11 11:35nbvNote Added: 0071333
2017-10-19 17:27nbvNote Added: 0071647
2017-10-19 18:01nbvSummaryDifferent Point-Face-classification algorithms return different results => Ambiguous behavior of Point-Face-classification algorithms: shall it return ON-status?
2017-10-19 18:01nbvDescription Updatedbug_revision_view_page.php?rev_id=17963#r17963
2017-10-19 18:01nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17964#r17964
2017-10-19 18:01nbvAdditional Information Updatedbug_revision_view_page.php?rev_id=17966#r17966
2017-10-19 18:02nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17967#r17967
2017-10-19 18:05nbvNote Added: 0071648
2017-10-19 18:06nbvFile Added: bug29203_toron.bin
2017-10-19 18:42nbvNote Edited: 0071647bug_revision_view_page.php?bugnote_id=71647#r17969
2017-10-20 16:40msvNote Added: 0071667
2017-11-07 10:06nbvDescription Updatedbug_revision_view_page.php?rev_id=18070#r18070
2018-01-12 14:23nbvFile Deleted: bug29203
2018-01-12 14:27nbvFile Added: bug29203_1
2018-01-12 14:27nbvFile Added: bug29203_2
2018-01-12 14:28nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18458#r18458
2018-01-12 14:57nbvFile Deleted: bug29203_1
2018-01-12 14:57nbvFile Deleted: bug29203_2
2018-01-12 14:57nbvFile Added: bug29203_1
2018-01-12 14:57nbvFile Added: bug29203_2
2018-01-12 15:58nbvRelationship addedrelated to 0029421
2018-01-12 15:58nbvRelationship deletedrelated to 0028211
2018-01-22 13:27nbvFile Added: 0002-0029203-Ambiguous-behavior-of-Point-Face-classificat.patch
2018-01-22 13:27nbvAssigned Tomsv => nbv
2018-01-22 13:27nbvStatusnew => feedback
2018-01-22 13:31nbvNote Added: 0073555
2018-11-12 16:52nbvRelationship addedrelated to 0030365
2019-02-14 12:01bugmasterProjectInternal => Open CASCADE
2019-07-18 18:34msvAssigned Tonbv =>
2019-07-18 18:34msvTarget Version7.4.0 => Unscheduled

Notes
(0071332)
nbv   
2017-10-11 11:27   
Fix for the issue #0028211 will not solve the problem.
(0071333)
nbv   
2017-10-11 11:35   
Test case has already been created and attached (see bug29203 file)
(0071647)
nbv   
2017-10-19 17:27   
(edited on: 2017-10-19 18:42)
In order to fix, we shall make the following steps:

1. Provide all edges on faces sent to the classification algorithm being same-parameter. It touches not only source files in test cases but intermediate results of the algorithms. It can lead to obtain huge tolerance of the edge(s). So, the face will be invalid (see #0023731).

2. Change the algorithm in BRepClass_Intersector::Perform(...) method in order to make it work with 3D-tolerance of the considered edge (not with external 3D-tolerance). Maybe, after this solution will be implemented, the external tolerance will be rejected from classifier algorithm. Currently, it is impossible to be done by the reason explained in item 1.

3. Improve the algorithm of computation of deflection between discrete polygon and source curve (see method BRepTopAdaptor_FClass2d::Init()). Currently, the computed deflection is equal to the length of projection of middle-point of arc to the chord. New algorithm can be based on GCPnts_DistFunction2d class or can use simple iteration formula (obtained if we apply Newton-algorithm to GCPnts_DistFunction2d function):

                    U(n+1)=U(n)-(C'(Un).Crossed(D))/(C''(U(n)).Crossed(D))

where C' and C'' are 1st and 2nd derivative of the curve, obtained in the point U(n), D - direction of the segment of the polygon.

Please note that this formula is satisfied for 2D-space only. For 3D-algorithm it will look more complexly.

----------------

Other steps must be defined dependently on regressions.

(0071648)
nbv   
2017-10-19 18:05   
I.e. after the fix, behavior "de iges_1 O4" and "bugs modalg_6 bug27341_*" test cases will be probably changed.
(0071667)
msv   
2017-10-20 16:40   
Concerning item 2 of the proposal, we have to leave the old behavior, so that the algorithm could work in two modes: 1) old mode when input global 3D tolerance is used for all edges, 2) new mode when each edge uses its own tolerance.
(0073555)
nbv   
2018-01-22 13:31   
Git-patch in the file " 0002-0029203-Ambiguous-behavior-of-Point-Face-classificat.patch" fixes described problem. However, it is based on "0001-0028211-Modeling-Algorithms-Boolean-fuse-operation-p.patch" (see message 0029421:0073554), which cannot be integrated at present.