View Issue Details

IDProjectCategoryView StatusLast Update
0023820CommunityOCCT:Modeling Algorithmspublic2023-03-19 18:54
Reportersneeraj Assigned Tosmoskvin 
PriorityhighSeveritymajor 
Status closedResolutionfixed 
Product Version6.5.4 
Target Version7.7.0Fixed in Version7.6.2 
Summary0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
DescriptionWrong result of projection algorithm ["BrepAlgo_NormalProjection” and “ProjLib_CompProjectedCurve”] when a polygon geometry is projected on a set of multiple faces [TopoDS_Compound of the multiple TopoDS_Face].

The polygon geometry is given by set of ordered points in 3D space. It is required to find the projection of this polygon on to the given set of connected faces in normal direction.

Edges are constructed using the points of polygon and BrepAlgo_NormalProjection is used to project on the TopoDS_Compound of the multiple TopoDS_Face entities.

Internally, ProjLib_CompProjectedCurve::Init() is called, in which the step size for identifying the projection points in the edges is constant. Because of this some of the smaller faces in the TopoDS_Compound get missed out.

The fix for the defect is proposed to use the parametric space of the edges for identifying the step size.
Steps To ReproducePlease refer the uploaded document NormalProjection_Defect.pdf
TagsNo tags attached.
Test case numberbugs/modalg_5/bug23820_2, bug23820_1

Attached Files

  • NormalProjection_Defect.pdf (246,941 bytes)
  • NormalProjection_DefectTestSourceCode.zip (187,206 bytes)
  • Proj_D_2.png (24,268 bytes)
  • Proj_D_-1.png (23,947 bytes)
  • bug23820_non_planar.brep (96,375 bytes)

Activities

sneeraj

2013-03-07 14:48

developer  

NormalProjection_Defect.pdf (246,941 bytes)

sneeraj

2013-03-07 16:10

developer  

NormalProjection_DefectTestSourceCode.zip (187,206 bytes)

sneeraj

2013-03-07 19:23

developer   ~0023635

code committed to brnach CR23820. Branch pushed to remote repo.

sneeraj

2013-03-07 19:28

developer   ~0023636

http://git.dev.opencascade.org/gitweb/?p=occt.git;a=shortlog;h=refs/heads/CR23820

jgv

2013-03-12 17:13

developer   ~0023682

Dear sneeraj,

Concerning your contribution on the isssue 23820:

In ProjLib_CompProjectedCurve.cxx:

1. Why do you think that the value of <SearchStep> depending on first derivative of curve in its first point is better than current one? In your version I see:

SearchStep = Min(10*MinStep, 0.1/VD1);

I think that you really mean 0.1*VD1, not 0.1/VD1. But nevertheless, the step is also constant along the curve and can become too small if the derivative in first point is small.

2. The approach for avoiding of undesirable results by "try-catch" is not good in the loop of iterations: it is better to analyze the reasons of failure and do something depending on the situation, without call of methods leading to exceptions. It also applies to your changes in BRepAlgo_NormalProjection.cxx.

sneeraj

2013-03-18 20:04

developer   ~0023785

Dear jgv,

Please find my response below:

[Answer 1]
1. The steps 0.01 and 0.1 are arbitrary
2. If the line segment is long, then it is possible that containment will be missed (as it happens here).
3. If we consider the parametric distance covered and relate it to the tangent length.
E.g.

    u' = u + delta(u)

delta(u) is chosen here per unit length in object space (some factor: 0.1/0.01)/ (dc/du).

Of course, this is also not correct way as well, the better way is to

1. Find extrema (Use ExtremaDS)
2. Use extreme points (inside/outside) as a start point to create curve segments.

What do you suggest?

[Answer 2]
I agree with you on try-catch. It should be analyzed further. I will request you not to consider it.

Regards,
Neeraj

git

2022-02-15 13:50

administrator   ~0106905

Branch CR23820 has been updated forcibly by AndreyLA.

SHA-1: 6aea6c1565214014daac9fea08dd3872a167e6af

git

2022-02-16 09:20

administrator   ~0106914

Branch CR23820 has been updated forcibly by azv.

SHA-1: a75cc0b3bdebca846f69a97f5515b57a624165b1

git

2022-02-16 10:26

administrator   ~0106916

Branch CR23820 has been updated by AndreyLA.

SHA-1: 3d3bb578a0b5d0d07cfae2de42a0f27a4887fd98


Detailed log of new commits:

Author: Andrei LATYSHEV
Date: Wed Feb 16 10:26:22 2022 +0300

    Merge branch 'CR23820' of ssh://git.dev.opencascade.org/occt into CR23820_1

Author: abv
Date: Thu Mar 14 07:45:25 2013 +0400

    Added test case for exception on non-planar face

Author: sneeraj
Date: Thu Mar 7 20:49:23 2013 +0530

    0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces

AndreyLA

2022-03-05 11:23

developer   ~0107192

Last edited: 2022-03-05 12:50

The actual result of projection algorithm on the attached model is correct.
In general case this algorithm has three parameters:
1. the projected shape S
2. the shape P to project on
3. the maximum distance D between S and its projection S'
The output shapes are stored in compound R

The example of DRAW command:
 nproject R S P -d D


It works in the following way: each edge of S is projected on each face of P and
if the projection output (edge or vertex) is not empty it is added into resulting compound R.
One edge may produce several projection entities (they can be disconnected) if P has several faces.
The parameter D of this operation is maximum distance threshold that is equal to -1 by default or is set by user.
The value D = -1 (or a negative number in general) indicates that all the projected entities are to be included into result.
If D is a positive number then all the projection shapes with distance Dprj > D from the corresponding edges of S are filtered
and are not included into result.

Here is an explanation for the attached case. Each edge E of S (wire of 4 edges) is projected
on each face F of P (shell that consists of 7 faces). If the normal from any point on a 3D curve of E to current face F exists
the projection shape E' can be built and then E' is added to the compound R. The distance from E to E' does not matter
because the default value of D = -1 is used in this case. This means that completely all E' are added into R. This output may
contradict with intuition but it is caused by the properties of input data (its fragmentation and complexity).
Call of the function is the following:
 nproject R S P

Related picture is Proj_D_-1.png

The solution for this case and other similar cases is to vary the parameter D to find out some fitted value D* to get the expected result.
For example, the value of the maximum distance D* = 2 leads to a simple and clear result for the current model.
The improved call is:
 nproject R S P -d 2

Related picture is Proj_D_2.png

AndreyLA

2022-03-05 12:51

developer   ~0107193

Proj_D_2.png (24,268 bytes)
Proj_D_-1.png (23,947 bytes)

AndreyLA

2022-03-05 14:54

developer   ~0107196

Please add the last attached model into the list of .brep models to maintain tests compatibility

AndreyLA

2022-03-05 14:55

developer   ~0107197

bug23820_non_planar.brep (96,375 bytes)

git

2022-03-05 15:28

administrator   ~0107198

Branch CR23820_2 has been created by AndreyLA.

SHA-1: ab91189a3db575220d5db88869bcd135d7719cbb


Detailed log of new commits:

Author: Andrei LATYSHEV
Date: Sat Mar 5 15:28:11 2022 +0300

    0028320: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
    
    The result of projection algorithm was not clear for user.
    The explanation is added into the bug description (notes section) and the tests are added to verify the correctness of the projection algorithm's work.

azv

2022-03-14 11:37

administrator   ~0107273

The shape has been added to the data repository.

git

2022-03-14 17:42

administrator   ~0107283

Branch CR23820_2 has been updated forcibly by AndreyLA.

SHA-1: 013237463ade9c5c79de46336ff9c62a654be4ee

azv

2022-03-16 17:39

administrator   ~0107308

@AndreyLA, please update the commit message. It should contain the information about the commit instead of the steps of bug investigation.

git

2022-03-17 10:22

administrator   ~0107317

Branch CR23820_2 has been updated by AndreyLA.

SHA-1: e95c8214f4bda9746994ce88c316544969c6b616


Detailed log of new commits:

Author: Andrei LATYSHEV
Date: Thu Mar 17 10:21:54 2022 +0300

    Merge branch 'CR23820_2' of ssh://git.dev.opencascade.org/occt into CR23820_2

Author: Andrei LATYSHEV
Date: Sat Mar 5 15:28:11 2022 +0300

    0028320: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
    
    The tests are added to verify the correctness of the projection algorithm's work in two cases.

git

2022-03-17 13:19

administrator   ~0107320

Branch CR23820_2 has been updated by AndreyLA.

SHA-1: b1bb9062973aa0801a19fdb7f0cc9f4ee852cba6


Detailed log of new commits:

Author: Andrei LATYSHEV
Date: Thu Mar 17 13:19:32 2022 +0300

    Merge branch 'CR23820_2' of ssh://git.dev.opencascade.org/occt into CR23820_2

Author: Andrei LATYSHEV
Date: Sat Mar 5 15:28:11 2022 +0300

    0028320: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
    
    The tests are added to verify the correctness of the projection algorithm's work in two cases.

git

2022-03-17 13:57

administrator   ~0107322

Branch CR23820_2 has been deleted by AndreyLA.

SHA-1: b1bb9062973aa0801a19fdb7f0cc9f4ee852cba6

git

2022-03-17 14:30

administrator   ~0107328

Branch CR23820_2 has been created by AndreyLA.

SHA-1: acce2c1448254a2e57cc940dc479a795dcc3f5f0


No new revisions were added by this update.

git

2022-03-17 15:10

administrator   ~0107329

Branch CR23820_2 has been updated by AndreyLA.

SHA-1: b8ec1feadcd5b533635f0465927f3f564f29846b


Detailed log of new commits:

Author: Andrei LATYSHEV
Date: Thu Mar 17 15:10:01 2022 +0300

    0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
    
    The tests are added to verify the correctness of the projection algorithm's work in two cases.

azv

2022-03-18 21:47

administrator   ~0107354

@AndreyLA, please, set issue status resolved when you request code review.

azv

2022-03-18 21:52

administrator   ~0107355

Branches to process:
OCCT: CR23820_2
Products: NOT

smoskvin

2022-03-27 10:45

administrator   ~0107434

Combination -
OCCT branch : IR-2022-03-25
master SHA - e4753a7d1658331a79025964d1c55f2a6d999c6c
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2022-03-25 SHA - 303106116fcb5c01a598ea01cc5174a45aae8f18
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18507.51000000038 / 18488.570000000385 [+0.10%]
Products
Total CPU difference: 11703.320000000122 / 11709.530000000132 [-0.05%]
Windows-64-VC14:
OCCT
Total CPU difference: 20451.96875 / 20413.53125 [+0.19%]
Products
Total CPU difference: 13191.96875 / 13181.65625 [+0.08%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2022-04-02 19:34

administrator   ~0107559

Branch CR23820 has been deleted by mnt.

SHA-1: 3d3bb578a0b5d0d07cfae2de42a0f27a4887fd98

git

2022-04-02 19:34

administrator   ~0107560

Branch CR23820_2 has been deleted by mnt.

SHA-1: b8ec1feadcd5b533635f0465927f3f564f29846b

Related Changesets

occt: master 3425e83f

2022-03-17 15:10:01

AndreiLA


Committer: smoskvin Details Diff
0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces

The tests are added to verify the correctness of the projection algorithm's work in two cases.
Affected Issues
0023820
add - tests/bugs/modalg_5/bug23820_1 Diff File
add - tests/bugs/modalg_5/bug23820_2 Diff File

Issue History

Date Modified Username Field Change
2013-03-07 14:46 sneeraj New Issue
2013-03-07 14:46 sneeraj Assigned To => jgv
2013-03-07 14:48 sneeraj Priority normal => high
2013-03-07 14:48 sneeraj Severity minor => major
2013-03-07 14:48 sneeraj Reproducibility have not tried => always
2013-03-07 14:48 sneeraj Product Version => 6.5.4
2013-03-07 14:48 sneeraj Target Version => 6.6.0
2013-03-07 14:48 sneeraj Description Updated
2013-03-07 14:48 sneeraj Steps to Reproduce Updated
2013-03-07 14:48 sneeraj File Added: NormalProjection_Defect.pdf
2013-03-07 16:10 sneeraj File Added: NormalProjection_DefectTestSourceCode.zip
2013-03-07 16:17 sneeraj Assigned To jgv => sneeraj
2013-03-07 19:23 sneeraj Note Added: 0023635
2013-03-07 19:23 sneeraj Status new => resolved
2013-03-07 19:28 sneeraj Note Added: 0023636
2013-03-07 19:30 sneeraj Assigned To sneeraj => jgv
2013-03-12 17:13 jgv Note Added: 0023682
2013-03-12 17:13 jgv Status resolved => assigned
2013-03-12 17:14 jgv Assigned To jgv => sneeraj
2013-03-18 20:04 sneeraj Note Added: 0023785
2013-03-18 20:04 sneeraj Assigned To sneeraj =>
2013-03-18 20:05 sneeraj Assigned To => jgv
2013-04-19 16:19 abv Assigned To jgv => ifv
2013-04-19 16:19 abv Target Version 6.6.0 => 6.7.0
2013-12-21 10:21 abv Target Version 6.7.0 => 6.7.1
2014-04-04 18:19 abv Target Version 6.7.1 => 6.8.0
2014-09-26 10:29 abv Target Version 6.8.0 => 7.1.0
2016-10-28 11:54 msv Target Version 7.1.0 => 7.2.0
2017-07-21 11:34 msv Target Version 7.2.0 => 7.3.0
2017-12-05 17:09 msv Target Version 7.3.0 => 7.4.0
2019-08-12 16:44 msv Target Version 7.4.0 => 7.5.0
2020-09-14 22:55 msv Target Version 7.5.0 => 7.6.0
2021-08-29 18:52 msv Target Version 7.6.0 => 7.7.0
2022-02-14 16:28 azv Assigned To ifv => AndreyLA
2022-02-15 13:50 git Note Added: 0106905
2022-02-16 09:20 git Note Added: 0106914
2022-02-16 10:26 git Note Added: 0106916
2022-03-05 11:23 AndreyLA Note Added: 0107192
2022-03-05 11:23 AndreyLA File Added: Projection_D_-1.png
2022-03-05 11:23 AndreyLA File Added: Projection_D_2.png
2022-03-05 12:32 AndreyLA Note Edited: 0107192
2022-03-05 12:50 AndreyLA File Deleted: Projection_D_-1.png
2022-03-05 12:50 AndreyLA File Deleted: Projection_D_2.png
2022-03-05 12:50 AndreyLA Note Edited: 0107192
2022-03-05 12:51 AndreyLA Note Added: 0107193
2022-03-05 12:51 AndreyLA File Added: Proj_D_2.png
2022-03-05 12:51 AndreyLA File Added: Proj_D_-1.png
2022-03-05 14:52 AndreyLA Assigned To AndreyLA => sneeraj
2022-03-05 14:54 AndreyLA Assigned To sneeraj => bugmaster
2022-03-05 14:54 AndreyLA Status assigned => feedback
2022-03-05 14:54 AndreyLA Note Added: 0107196
2022-03-05 14:55 AndreyLA Note Added: 0107197
2022-03-05 14:55 AndreyLA File Added: bug23820_non_planar.brep
2022-03-05 15:28 git Note Added: 0107198
2022-03-11 23:05 azv Assigned To bugmaster => azv
2022-03-14 11:37 azv Assigned To azv => AndreyLA
2022-03-14 11:37 azv Status feedback => assigned
2022-03-14 11:37 azv Note Added: 0107273
2022-03-14 17:42 git Note Added: 0107283
2022-03-16 17:39 azv Note Added: 0107308
2022-03-17 10:22 git Note Added: 0107317
2022-03-17 13:19 git Note Added: 0107320
2022-03-17 13:57 git Note Added: 0107322
2022-03-17 14:30 git Note Added: 0107328
2022-03-17 15:10 git Note Added: 0107329
2022-03-18 14:31 AndreyLA Assigned To AndreyLA => azv
2022-03-18 21:47 azv Status assigned => resolved
2022-03-18 21:47 azv Steps to Reproduce Updated
2022-03-18 21:47 azv Note Added: 0107354
2022-03-18 21:52 azv Assigned To azv => bugmaster
2022-03-18 21:52 azv Status resolved => reviewed
2022-03-18 21:52 azv Note Added: 0107355
2022-03-27 10:45 smoskvin Status reviewed => tested
2022-03-27 10:45 smoskvin Note Added: 0107434
2022-03-27 10:47 smoskvin Test case number => bugs/modalg_5/bug23820_2, bug23820_1
2022-03-27 12:32 smoskvin Changeset attached => occt master 3425e83f
2022-03-27 12:32 smoskvin Assigned To bugmaster => smoskvin
2022-03-27 12:32 smoskvin Status tested => verified
2022-03-27 12:32 smoskvin Resolution open => fixed
2022-04-02 19:34 git Note Added: 0107559
2022-04-02 19:34 git Note Added: 0107560
2023-03-19 18:54 vglukhik Status verified => closed
2023-03-19 18:54 vglukhik Fixed in Version => 7.6.2