MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031848Community[OCCT] OCCT:Visualizationpublic2020-10-13 13:302020-10-17 13:31
ReporterVico Liang 
Assigned Tobugmaster 
PrioritynormalSeverityblock 
StatusverifiedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 7.5.0 
Target Version[OCCT] 7.5.0Fixed in Version 
Summary0031848: [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input vector has zero norm"
DescriptionCreate a sphere, and then move mouse to the pole points(south or north) will trigger exception "gp_Dir() - input vector has zero norm".

After digging into code, the issue occurs in below function:

gp_Vec (aPnts[aNearestEdgeIdx1], aPnts[aNearestEdgeIdx2]) is a zero vector, which can't be converted to a direction.

Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
                                                         const gp_Pnt& thePnt2,
                                                         const gp_Pnt& thePnt3,
                                                         Select3D_TypeOfSensitivity theSensType,
                                                         const SelectMgr_ViewClipRange& theClipRange,
                                                         
SelectBasics_PickResult& thePickResult) const
{

    // BUG: line 716 throw exception: "gp_Dir() - input vector has zero norm"
    // line 716
    if (myViewRayDir.IsParallel (gp_Vec (aPnts[aNearestEdgeIdx1], aPnts[aNearestEdgeIdx2]), Precision::Angular()))
    
{
      aNearestEdgeIdx2 = aNearestEdgeIdx1 == 0 ? 2 : aNearestEdgeIdx1 - 1;
    }

}

inline gp_Dir::gp_Dir (const gp_Vec& V)
{
  const gp_XYZ& XYZ = V.XYZ();
  Standard_Real X = XYZ.X();
  Standard_Real Y = XYZ.Y();
  Standard_Real Z = XYZ.Z();
  Standard_Real D = sqrt(X * X + Y * Y + Z * Z);
  Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "gp_Dir() - input vector has zero 
norm");
  coord.SetX(X / D);
  coord.SetY(Y / D);
  coord.SetZ(Z / D);
}


There is just occur on version 7.5.0 BETA.
TagsNo tags attached.
Test case numberNot required
Attached Files? file icon sphere.brep (73,864 bytes) 2020-10-13 15:59

- Relationships

-  Notes
(0095928)
kgv (developer)
2020-10-13 13:50
edited on: 2020-10-13 13:50

Vico, while I see the location of the issue, I'm unable to reproduce it with generated sphere.

Could you please attach the sample triangulated model?

(0095929)
git (administrator)
2020-10-13 14:17

Branch CR31848 has been created by kgv.

SHA-1: 930f6e77e645db33a772209e869344a84a00f762


Detailed log of new commits:

Author: kgv
Date: Tue Oct 13 14:20:18 2020 +0300

    0031848: [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input vector has zero norm"
    
    SelectMgr_RectangularFrustum::Overlaps() - added zero magnitude check.
(0095932)
Vico Liang (developer)
2020-10-13 14:36
edited on: 2020-10-13 14:37

This issue just occurs on ios release version. It works well on debug. I'm also curious about this issue. The triangulation generated from Prs3d_ToolCylinder and Prs3d_ToolSphere have the issue. I think there might be relation with the triangulation generated.

(0095934)
Vico Liang (developer)
2020-10-13 15:31

I use Select3D_SensitiveTriangulation which build from Prs3d_ToolCylinder and Prs3d_ToolSphere. There must be something changed, since this works well in previous version occt.
(0095935)
Vico Liang (developer)
2020-10-13 16:00

I have attached the sphere.brep. Please have a try.
(0095936)
git (administrator)
2020-10-13 16:07

Branch CR31848 has been updated forcibly by kgv.

SHA-1: 2cc3c0285df5a9bc2901cbb1441a996cb75c3dd0
(0095937)
kgv (developer)
2020-10-13 16:13

Vico, if problem is well-reproducible in your environment - could you please verify that patch in CR31848 fixes the issue?

If it happens only in Release builds for iOS, I'm afraid it wouldn't be easy reproducing the same on desktop, as there might be some bias from specific floating point CPU features affecting results. Although it could be possible generating a synthetic data reproducing just specific error.
(0095938)
Vico Liang (developer)
2020-10-13 16:26

I have updated the patch. It works now.
I can see there is a triangle with two coincident vertices from debug trace. But it just occurs on ios.
(0095942)
kgv (developer)
2020-10-13 18:59

Patch is ready for review
- OCCT branch: CR31848.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31848-master-KGV [^]
(0095947)
osa (developer)
2020-10-14 09:14

The patch was reviewed without remarks
(0096032)
bugmaster (administrator)
2020-10-17 13:22

Combination -
OCCT branch : IR-2020-10-16
master SHA - ae9f4b64cacf0df612944b3694a3bdfa5f1f29cf
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-10-16 SHA - fcb5abe005e152f7f923f4cf6c02acb07c027cdc
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: 18027.820000000127 / 18057.130000000117 [-0.16%]
Products
Total CPU difference: 12174.330000000093 / 12182.170000000115 [-0.06%]
Windows-64-VC14:
OCCT
Total CPU difference: 19740.03125 / 19746.828125 [-0.03%]
Products
Total CPU difference: 13564.71875 / 13586.625 [-0.16%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

- Related Changesets
occt: master 6eeb528c
Timestamp: 2020-10-13 11:20:18
Author: kgv
Committer: bugmaster
Details ] Diff ]
0031848: [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input vector has zero norm"

SelectMgr_RectangularFrustum::Overlaps() - added zero magnitude check.

Commands vsphere,vcylinder,vtorus have been corrected to provide missing parameters defining number of stacks and slices.
mod - src/SelectMgr/SelectMgr_RectangularFrustum.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2020-10-13 13:30 Vico Liang New Issue
2020-10-13 13:30 Vico Liang Assigned To => kgv
2020-10-13 13:31 Vico Liang Severity minor => block
2020-10-13 13:31 Vico Liang Target Version 7.6.0* => 7.5.0
2020-10-13 13:31 Vico Liang Description Updated View Revisions
2020-10-13 13:38 kgv Product Version => 7.5.0
2020-10-13 13:38 kgv Summary [REGRESSION] - MoveTo will trigger exception: "gp_Dir() - input vector has zero norm" => [REGRESSION] Visualization - MoveTo triggers exception "gp_Dir() - input vector has zero norm"
2020-10-13 13:38 kgv Description Updated View Revisions
2020-10-13 13:40 kgv Relationship added child of 0031412
2020-10-13 13:40 kgv Summary [REGRESSION] Visualization - MoveTo triggers exception "gp_Dir() - input vector has zero norm" => [REGRESSION] Visualization - MoveTo() triggers exception "gp_Dir() - input vector has zero norm"
2020-10-13 13:50 kgv Note Added: 0095928
2020-10-13 13:50 kgv Note Edited: 0095928 View Revisions
2020-10-13 14:17 git Note Added: 0095929
2020-10-13 14:36 Vico Liang Note Added: 0095932
2020-10-13 14:37 Vico Liang Note Edited: 0095932 View Revisions
2020-10-13 15:31 Vico Liang Note Added: 0095934
2020-10-13 15:59 Vico Liang File Added: sphere.brep
2020-10-13 16:00 Vico Liang Note Added: 0095935
2020-10-13 16:07 git Note Added: 0095936
2020-10-13 16:13 kgv Note Added: 0095937
2020-10-13 16:26 Vico Liang Note Added: 0095938
2020-10-13 18:59 kgv Note Added: 0095942
2020-10-13 18:59 kgv Assigned To kgv => osa
2020-10-13 18:59 kgv Status new => resolved
2020-10-14 09:14 osa Note Added: 0095947
2020-10-14 09:14 osa Assigned To osa => bugmaster
2020-10-14 09:14 osa Status resolved => reviewed
2020-10-17 13:22 bugmaster Note Added: 0096032
2020-10-17 13:22 bugmaster Status reviewed => tested
2020-10-17 13:28 bugmaster Test case number => Not required
2020-10-17 13:31 bugmaster Changeset attached => occt master 6eeb528c
2020-10-17 13:31 bugmaster Status tested => verified
2020-10-17 13:31 bugmaster Resolution open => fixed


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker