MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027565Community[OCCT] OCCT:Modeling Algorithmspublic2016-06-02 19:132016-12-09 16:39
ReporterBenjaminBihler 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformWindowsOSVC++ 2015OS Version64 bit
Product Version[OCCT] 7.0.0 
Target Version[OCCT] 7.1.0Fixed in Version[OCCT] 7.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? file icon Curve.stp (157,370 bytes) 2016-06-02 19:13
? file icon Wire.stp (180,450 bytes) 2016-06-02 19:13
? file icon bug27565.brep (203,676 bytes) 2016-06-03 20:06

- Relationships

-  Notes
(0054654)
abv (manager)
2016-06-02 19:25

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?
(0054655)
BenjaminBihler (developer)
2016-06-02 19:33

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?
(0054704)
git (administrator)
2016-06-03 20:29

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.
(0054705)
git (administrator)
2016-06-03 20:30

Branch CR27565 has been updated forcibly by aml.

SHA-1: 71223613f4e46817f33a69910d398e598407e557
(0054706)
aml (developer)
2016-06-03 20:37

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.
(0054707)
msv (developer)
2016-06-04 01:06

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.
(0054710)
git (administrator)
2016-06-06 10:07

Branch CR27565 has been updated forcibly by aml.

SHA-1: 673725507c65191774b2a470c3c1b3b198220e02
(0054711)
aml (developer)
2016-06-06 10:09

Dear msv,
Please check current state of the CR27565 branch.
(0054734)
msv (developer)
2016-06-06 15:59

Reviewed.
(0054802)
apv (tester)
2016-06-08 15:10
edited on: 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%]

(0055149)
git (administrator)
2016-06-17 12:14

Branch CR27565 has been deleted by inv.

SHA-1: 673725507c65191774b2a470c3c1b3b198220e02

- Related Changesets
occt: master f84bf635
Timestamp: 2016-06-03 17:08:00
Author: 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.
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:20 abv Relationship added child of 0027493
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 View Revisions
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 View Revisions
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-02 09:53 msv Relationship added related to 0028182
2016-12-09 16:30 user533 Status verified => closed
2016-12-09 16:39 user533 Fixed in Version => 7.1.0


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker