View Issue Details

IDProjectCategoryView StatusLast Update
0031848CommunityOCCT:Visualizationpublic2020-12-02 17:13
ReporterVico Liang Assigned Tobugmaster  
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version7.5.0 
Target Version7.5.0Fixed in Version7.5.0 
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

  • sphere.brep (73,864 bytes)

Activities

kgv

2020-10-13 13:50

developer   ~0095928

Last edited: 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?

git

2020-10-13 14:17

administrator   ~0095929

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.

Vico Liang

2020-10-13 14:36

developer   ~0095932

Last edited: 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.

Vico Liang

2020-10-13 15:31

developer   ~0095934

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.

Vico Liang

2020-10-13 15:59

developer  

sphere.brep (73,864 bytes)

Vico Liang

2020-10-13 16:00

developer   ~0095935

I have attached the sphere.brep. Please have a try.

git

2020-10-13 16:07

administrator   ~0095936

Branch CR31848 has been updated forcibly by kgv.

SHA-1: 2cc3c0285df5a9bc2901cbb1441a996cb75c3dd0

kgv

2020-10-13 16:13

developer   ~0095937

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.

Vico Liang

2020-10-13 16:26

developer   ~0095938

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.

kgv

2020-10-13 18:59

developer   ~0095942

Patch is ready for review
- OCCT branch: CR31848.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31848-master-KGV

osa

2020-10-14 09:14

developer   ~0095947

The patch was reviewed without remarks

bugmaster

2020-10-17 13:22

administrator   ~0096032

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

git

2020-10-24 12:41

administrator   ~0096226

Branch CR31848 has been deleted by inv.

SHA-1: 2cc3c0285df5a9bc2901cbb1441a996cb75c3dd0

Related Changesets

occt: master 6eeb528c

2020-10-13 11:20:18

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.
Affected Issues
0031848
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
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
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
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
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
2020-10-24 12:41 git Note Added: 0096226
2020-12-02 16:22 emo Fixed in Version => 7.5.0
2020-12-02 17:13 emo Status verified => closed