View Issue Details

IDProjectCategoryView StatusLast Update
0027565CommunityOCCT:Modeling Algorithmspublic2016-12-09 16:39
ReporterBenjaminBihler Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2015 
Product Version7.0.0 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong
DescriptionThe issue was introduced in revision e64622331f0d16e29689c51f3fff6be638af2092. Up to revision 264abd72f2508894ff6d514f2d9ff5c2443656f8 two intersections (solutions) have been reported for a given wire and edge. But now only one intersection is reported, even though there are obviously two intersections.
Steps To ReproduceI will upload two files: Curve.stp and Wire.stp. If you run the following code, you will see the number of solutions(it should be two):

#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <TopoDS.hxx>
#include <STEPControl_Reader.hxx>
#include <Precision.hxx>
#include <TopExp_Explorer.hxx>

#include <string>
#include <vector>
#include <iostream>

std::vector<TopoDS_Shape> importStep(const std::string file)
{
    std::vector<TopoDS_Shape> shapes;

    STEPControl_Reader reader;

    IFSelect_ReturnStatus status = reader.ReadFile(file.c_str());

    if (status == IFSelect_RetDone)
    {
        //Interface_TraceFile::SetDefault();
        bool failsonly = false;
        reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);

        int rootsNumber = reader.NbRootsForTransfer();
        reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);
        for (Standard_Integer rootIndex = 1; rootIndex <= rootsNumber; rootIndex++)
        {
            //bool ok =
            reader.TransferRoot(rootIndex);
            int shapesNumber = reader.NbShapes();
            if (shapesNumber > 0)
            {
                for (int shapeIndex = 1; shapeIndex <= shapesNumber; shapeIndex++)
                {
                    TopoDS_Shape shape = reader.Shape(shapeIndex);

                    shapes.push_back(shape);
                }
            }
        }
    }
    else
    {
        throw "Could not read in file.";
    }

    return shapes;
}

int main(int, char**)
{
    std::vector<TopoDS_Shape> shapes = importStep("Curve.stp");
    TopoDS_Edge curve1;

    for (const auto& shape : shapes)
    {
        std::cout << "Searching edges." << std::endl;

        for (TopExp_Explorer edgeExplorer(shape, TopAbs_EDGE, TopAbs_WIRE);
                edgeExplorer.More(); edgeExplorer.Next())
        {
            std::cout << "Edge found." << std::endl;
            curve1 = TopoDS::Edge(edgeExplorer.Current());
        }
    }

    shapes = importStep("Wire.stp");
    TopoDS_Wire curve2;

    for (const auto& shape : shapes)
    {
        std::cout << "Searching wires." << std::endl;

        for (TopExp_Explorer wireExplorer(shape, TopAbs_WIRE); wireExplorer.More();
                wireExplorer.Next())
        {
            std::cout << "Wire found." << std::endl;

            curve2 = TopoDS::Wire(wireExplorer.Current());
        }
    }

    std::cout << "Curve 1 is null: " << curve1.IsNull() << std::endl;
    std::cout << "Curve 2 is null: " << curve2.IsNull() << std::endl;

    BRepExtrema_DistShapeShape extremaShape(curve2, curve1, 1.0,
            Extrema_ExtFlag_MIN);

    extremaShape.Perform();

    if (!extremaShape.IsDone())
    {
        std::cerr << "Computation has failed." << std::endl;
    }

    std::cout << "There are " << extremaShape.NbSolution() << " solutions."
            << std::endl;

    return 0;
}

# Test bugs moddata_3 bug27565
TagsNo tags attached.
Test case numberbugs moddata_3 bug27565

Attached Files

  • Curve.stp (157,370 bytes)
  • Wire.stp (180,450 bytes)
  • bug27565.brep (203,676 bytes)

Activities

BenjaminBihler

2016-06-02 19:13

developer  

Curve.stp (157,370 bytes)

BenjaminBihler

2016-06-02 19:13

developer  

Wire.stp (180,450 bytes)

abv

2016-06-02 19:25

manager   ~0054654

Benjamin, please note that Extrema does not seek for intersections but for extremum, actually for the point of minimal distance. It can be quite expected for it to find single point, even if two objects have several extremums.

Alexander, could you please have a look?

BenjaminBihler

2016-06-02 19:33

developer   ~0054655

Andrey, thanks for your hint. But if I use a large deflection value (like 1.0 in my example), doesn't that mean that I should get all local distance minima that are within a 1.0 surrounding of the global minimum?

aml

2016-06-03 20:06

developer  

bug27565.brep (203,676 bytes)

git

2016-06-03 20:29

administrator   ~0054704

Branch CR27565 has been created by aml.

SHA-1: 548aa6ceb0bd314bc0dc53a3b746fd1d44c4147f


Detailed log of new commits:

Author: aml
Date: Fri Jun 3 20:08:00 2016 +0300

    0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong
    
    Incorrect tolerance management is fixed.

git

2016-06-03 20:30

administrator   ~0054705

Branch CR27565 has been updated forcibly by aml.

SHA-1: 71223613f4e46817f33a69910d398e598407e557

aml

2016-06-03 20:37

developer   ~0054706

Dear msv,
I confirm the problem. The problem was inside of duplicates handling algorithm. Method "Upper" was used instead of "Last" ("Lower" instead of "First") in computation of a scale coefficient.

Please check current state of the CR27565 branch.

msv

2016-06-04 01:06

developer   ~0054707

Fix is OK. Remark is to the test. It is better to extend functionality of the command distmini instead of adding a new QA command.

git

2016-06-06 10:07

administrator   ~0054710

Branch CR27565 has been updated forcibly by aml.

SHA-1: 673725507c65191774b2a470c3c1b3b198220e02

aml

2016-06-06 10:09

developer   ~0054711

Dear msv,
Please check current state of the CR27565 branch.

msv

2016-06-06 15:59

developer   ~0054734

Reviewed.

apv

2016-06-08 15:10

tester   ~0054802

Last edited: 2016-06-08 15:10

Dear BugMaster,

Branch CR27565 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 673725507c65191774b2a470c3c1b3b198220e02

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MacOS: 0 (0 on master)
products component:
   Linux: 72
   Windows: 4
   MacOS: 1153

Regressions/Differences:
Not detected

Testing cases:
bugs moddata_3 bug27565 - OK
http://occt-tests/CR27565-master-OCCT/Debian70-64/bugs/moddata_3/bug27565.html
http://occt-tests/CR27565-master-OCCT/Windows-64-VC10/bugs/moddata_3/bug27565.html

Testing on Linux:
Total MEMORY difference: 89903262 / 88754430 [+1.29%]
Total CPU difference: 19741.00000000013 / 19850.559999999932 [-0.55%]

Testing on Windows:
Total MEMORY difference: 55951520 / 55967213 [-0.03%]
Total CPU difference: 18347.776813198805 / 18470.736801398853 [-0.67%]

git

2016-06-17 12:14

administrator   ~0055149

Branch CR27565 has been deleted by inv.

SHA-1: 673725507c65191774b2a470c3c1b3b198220e02

Related Changesets

occt: master f84bf635

2016-06-03 17:08:00

aml


Committer: bugmaster Details Diff
0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong

Incorrect tolerance management is fixed.
Test case is added.
Affected Issues
0027565
mod - src/BRepTest/BRepTest_ExtremaCommands.cxx Diff File
mod - src/Extrema/Extrema_GenExtCC.gxx Diff File
add - tests/bugs/moddata_3/bug27565 Diff File

Issue History

Date Modified Username Field Change
2016-06-02 19:13 BenjaminBihler New Issue
2016-06-02 19:13 BenjaminBihler Assigned To => msv
2016-06-02 19:13 BenjaminBihler File Added: Curve.stp
2016-06-02 19:13 BenjaminBihler File Added: Wire.stp
2016-06-02 19:21 abv Assigned To msv => aml
2016-06-02 19:21 abv Status new => assigned
2016-06-02 19:25 abv Note Added: 0054654
2016-06-02 19:33 BenjaminBihler Note Added: 0054655
2016-06-03 20:06 aml File Added: bug27565.brep
2016-06-03 20:29 git Note Added: 0054704
2016-06-03 20:30 git Note Added: 0054705
2016-06-03 20:37 aml Note Added: 0054706
2016-06-03 20:37 aml Assigned To aml => msv
2016-06-03 20:37 aml Status assigned => resolved
2016-06-03 20:37 aml Steps to Reproduce Updated
2016-06-04 01:06 msv Note Added: 0054707
2016-06-04 01:06 msv Assigned To msv => aml
2016-06-04 01:06 msv Status resolved => assigned
2016-06-06 10:07 git Note Added: 0054710
2016-06-06 10:09 aml Note Added: 0054711
2016-06-06 10:09 aml Assigned To aml => msv
2016-06-06 10:09 aml Status assigned => resolved
2016-06-06 15:59 msv Note Added: 0054734
2016-06-06 15:59 msv Assigned To msv => bugmaster
2016-06-06 15:59 msv Status resolved => reviewed
2016-06-06 16:06 apv Assigned To bugmaster => apv
2016-06-08 14:28 apv Test case number => bugs moddata_3 bug27565
2016-06-08 15:10 apv Note Added: 0054802
2016-06-08 15:10 apv Assigned To apv => bugmaster
2016-06-08 15:10 apv Status reviewed => tested
2016-06-08 15:10 apv Note Edited: 0054802
2016-06-10 13:12 bugmaster Changeset attached => occt master f84bf635
2016-06-10 13:12 bugmaster Status tested => verified
2016-06-10 13:12 bugmaster Resolution open => fixed
2016-06-17 12:14 git Note Added: 0055149
2016-12-09 16:30 aiv Status verified => closed
2016-12-09 16:39 aiv Fixed in Version => 7.1.0