Skip to content

Conversation

@AtheneNoctuaPt
Copy link
Collaborator

Minor refactoring of RelocatePCurvesToNewUorigin(). RelocatePCurvesToNewUorigin() can no longer stuck in infinite loop if it found the edge that is not present in theVEmap. Test bug_gh544 is added to check the fix.

…de-SAS#544

Minor refactoring of RelocatePCurvesToNewUorigin().
RelocatePCurvesToNewUorigin() can no longer stuck in infinite loop if it found the edge that is not present in theVEmap.
Test bug_gh544 is added to check the fix.
@AtheneNoctuaPt AtheneNoctuaPt requested review from a team and dpasukhi May 21, 2025 13:28
@AtheneNoctuaPt AtheneNoctuaPt self-assigned this May 21, 2025
@AtheneNoctuaPt AtheneNoctuaPt added 2. Bug Something isn't working 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... labels May 21, 2025
@AtheneNoctuaPt AtheneNoctuaPt linked an issue May 21, 2025 that may be closed by this pull request
@dpasukhi dpasukhi changed the title Infinite loop when Simplifying Fuse operation, CPU to 100% #544 Modeling - Infinite loop when Simplifying Fuse operation, CPU to 100% May 21, 2025
@dpasukhi dpasukhi requested a review from Copilot May 21, 2025 13:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the function RelocatePCurvesToNewUorigin() to prevent an infinite loop when the edge is missing from the vertex‐to‐edge map, and it adds a test to verify the fix.

  • Updated RemoveEdgeFromMap() with improved documentation and iteration style.
  • Introduced getCurveParams() to consolidate curve parameter extraction based on edge orientation.
  • Refactored RelocatePCurvesToNewUorigin() to use clearer variable names and break conditions to avoid infinite loops.
Files not reviewed (1)
  • tests/bugs/modalg_8/bug_gh544: Language not supported
Comments suppressed due to low confidence (2)

src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx:569

  • Consider extracting the repeated logic for obtaining and creating a trimmed curve from an edge into a helper function to reduce code duplication between the starting edge and subsequent edges.
Handle(Geom2d_Curve) CurPCurve = BRep_Tool::CurveOnSurface(aCurrentEdge, theRefFace, anEdgeStartParam, anEdgeEndParam);

src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx:625

  • [nitpick] Consider adding an inline comment explaining the rationale behind checking both the direct tolerance and the period-offset tolerance to improve clarity for future maintenance.
if (!(Abs(anOffset) < theCoordTol || Abs(Abs(anOffset) - thePeriod) < theCoordTol))

@dpasukhi dpasukhi requested a review from Copilot May 21, 2025 14:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an infinite loop issue in the Simplify Fuse operation by refactoring the RelocatePCurvesToNewUorigin() function and improving edge removal from the vertex‑to‑edge map.

  • Refactors RemoveEdgeFromMap() to use clearer documentation and updated parameter names.
  • Introduces a new helper function, getCurveParams(), to simplify retrieval of curve parameter endpoints.
  • Adjusts loop logic in RelocatePCurvesToNewUorigin() to prevent infinite loops when an edge is absent in the map.
Files not reviewed (1)
  • tests/bugs/modalg_8/bug_gh544: Language not supported
Comments suppressed due to low confidence (1)

src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx:289

  • Consider renaming the calling variable from 'theVEmap' to 'theVertexToEdges' in RelocatePCurvesToNewUorigin() to maintain consistency with the updated parameter name in RemoveEdgeFromMap().
static bool RemoveEdgeFromMap(const TopoDS_Edge& theEdge, TopTools_IndexedDataMapOfShapeListOfShape& theVertexToEdges)

@dpasukhi dpasukhi added this to the Release 7.9.2 milestone May 21, 2025
@github-project-automation github-project-automation bot moved this from Todo to Integration in Maintenance May 21, 2025
@dpasukhi dpasukhi merged commit 7ed396b into Open-Cascade-SAS:IR May 22, 2025
66 of 68 checks passed
@github-project-automation github-project-automation bot moved this from Integration to Done in Maintenance May 22, 2025
dpasukhi pushed a commit that referenced this pull request Sep 6, 2025
…557

Minor refactoring of RelocatePCurvesToNewUorigin().
RelocatePCurvesToNewUorigin() can no longer stuck in infinite loop if it found the edge that is not present in theVEmap.
Test bug_gh544 is added to check the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Infinite loop when Simplifying Fuse operation, CPU to 100%

2 participants