View Issue Details

IDProjectCategoryView StatusLast Update
0031261Open CASCADEOCCT:Modeling Datapublic2023-08-01 15:06
Reportersnn Assigned Tomsv 
PrioritynormalSeverityminor 
Status newResolutionopen 
Target VersionUnscheduled 
Summary0031261: Modeling Data - Unable to find a closest point on the face section
DescriptionTakes place in the following situation:
1. A face with geometry is crossed by plane
2. It is needed to find a point on the cross-section closest to the specified point
A code fragment is provided.
The attached archive contains shapes of interest (in binary and text formats). Shape names correlate with names from the code fragment.

Steps To ReproduceBRepAlgoAPI_Section mkSection(mindface, toolplane, Standard_False);
mkSection.Approximation(Standard_True);
mkSection.ComputePCurveOn1(Standard_False);
mkSection.ComputePCurveOn2(Standard_False);
mkSection.Build();
if (mkSection.IsDone())
{
  const TopoDS_Shape& section = mkSection.Shape();

  // Find an edge containing the ponsurf-point.
  double mind2(DBL_MAX);
  TopExp_Explorer expl(section, TopAbs_EDGE);
  for (; expl.More(); expl.Next())
  {
    const TopoDS_Edge& edge = TopoDS::Edge(expl.Current());

    double f, l;
    const Handle(Geom_Curve)& curve = BRep_Tool::Curve(edge, f, l);
    if (!curve.IsNull())
    {
      GeomAdaptor_Curve adaptor(curve, f, l);
      Extrema_ExtPC extrema(pontris, adaptor, Precision::Confusion());
      if (extrema.IsDone())
      {
        bool isminfound(false);
        for (int i = 1; i <= extrema.NbExt() && !isminfound; i++)
        {
          if (extrema.IsMin(i))
          {
            double d2 = extrema.SquareDistance(i);
            if (d2 < mind2)
            {
                mind2 = d2;
                isminfound = true;
                sectionedge = edge;
                ponsurf = extrema.Point(i).Value();
            }
          }
        }
      }
    }
  }
  if (mind2 == DBL_MAX)
  {
    // Shapes were saved here
    std::cout << "mind2 == DBL_MAX" << std::endl;
  }
}
TagsNo tags attached.
Test case number

Attached Files

  • shapes.zip (15,078 bytes)

Activities

snn

2019-12-23 12:58

reporter  

shapes.zip (15,078 bytes)

Issue History

Date Modified Username Field Change
2019-12-23 12:58 snn New Issue
2019-12-23 12:58 snn Assigned To => msv
2019-12-23 12:58 snn File Added: shapes.zip
2020-09-15 12:42 msv Target Version 7.5.0 => 7.6.0
2020-09-15 12:42 msv Summary Unable to find a closest point on the face section => Modeling Data - Unable to find a closest point on the face section
2021-08-29 18:53 msv Target Version 7.6.0 => 7.7.0
2022-10-24 10:43 szy Target Version 7.7.0 => 7.8.0
2023-08-01 15:06 dpasukhi Target Version 7.8.0 => Unscheduled