Maximum distance between two edges

Hi All,
How to calculate the maximum distance between two edges.
Thanks in advance
Bye
Vikas

Stephane Routelous's picture

check BRepExtrema_DistShapeShape ("generic" algo for distance shape-shape) or BRepExtrema_ExtCC ("specific" algo for distance Edge-Edge)

HTH,

Stephane

Stephane Routelous's picture

oops, sorry, BRepExtream gives the minimum and not the maximum distance.

Perhaps if you search in the Extrema package, you will find something.

Dmitry Khabi's picture

The same question:
http://www.opencascade.org/org/forum/thread_4914/
May be is there anywhere the right function, or its was really forgotten to implement the max function?

Roman Lygin's picture

Hi Dmitry,

BRepExtrema_ExtCC is supposed to find extremum distances (min and max).

---
opencascade.blogspot.com - blog on Open CASCADE

Dmitry Khabi's picture

Hi Roman,
I have seen the functions and I have used it (BRepExtrema_ExtCF).
It#s really work, but not allways. The extremum was not found by some of the shapes.

I use the class in this way:

for each aFaceShape:

TopoDS_Edge aEdge = createEdgeOY(1000.0);
BRepExtrema_ExtCF aExtremer3(aEdge,aFaceShape);
if(aExtremer1.IsDone())
{
double aCurrent;
aNumberOfSolution = aExtremer3.NbExt();
for(int aNBIndex=1;aNBIndex<=aNumberOfSolution;aNBIndex++)
{
aCurrent = aExtremer3.Value(aNBIndex);
if(aMaxSetDisplayMode(1);
aVShape->SetColor(Quantity_NameOfColor::Quantity_NOC_CHOCOLATE);
aDebugAIS_Interactive_Context->Display(aVShape, true);
}
}

I see a lot of CHOCOLATE ;)

Dmitry Khabi's picture

the code:
for each aFaceShape:

TopoDS_Edge aEdge = createEdgeOY(1000.0);
BRepExtrema_ExtCF aExtremer3(aEdge,aFaceShape);
if(aExtremer1.IsDone())
{
double aCurrent;
aNumberOfSolution = aExtremer3.NbExt();
for(int aNBIndex=1;aNBIndex<=aNumberOfSolution;aNBIndex++)
{
aCurrent = aExtremer3.Value(aNBIndex);
if(aMaxSetDisplayMode(1);
aVShape->SetColor(Quantity_NameOfColor::Quantity_NOC_CHOCOLATE);
theDebugContext->m_Context->Display(aVShape, true);
}
}
I see a lot of CHOCOLATE ;)

Dmitry Khabi's picture

But this works for the same shapes:
TopoDS_Face aFaceShape = TopoDS::Face(aFacesMap(i));

BRepExtrema_DistShapeShape aExtremer1(aFaceShape,aPlane1);
aExtremer1.Perform();
if(theExtremer.IsDone())
{
aCurrentDist =theExtremer.Value();
}

Daniel Park's picture

Sorry to dig up this old thread from 2008, but I am experiencing the same issue when trying to find the extrema between two edges in 2014...

* BRepExtrema_DistShapeShape returns a minimum distance for all edges I am trying to compare.
* BRepExtrema_ExtCC.NbExt() is often 0 for a comparison, whereas DistShapeShape returns a minimum distance perfectly fine for the same edges. I.e. ExtCC does not perform well, even the minimum is not found by it in many cases.

My test case was easy: two rectangles next to each other and all edges of one rectangle are checked for their extremas to the other rectangle's edges:
+---+ +----+
| | | |
| | | |
+---+ +----+

Here is the output of the checking for one edge with the four edges of the second rectangle:

CheckShell# 0
Compare for Edge# 1
CompareShell# 1
CompareEdge# 1
ShapeShape: min 106.415
ExtCC: Found 1 Extremas
ExtCC: IsParallel: 1
ExtCC: Extremum: 106.415
CompareEdge# 2
ShapeShape: min 106.415
Found 0 Extremas
IsParallel: 0
CompareEdge# 3
ShapeShape: min 160.039
Found 1 Extremas
IsParallel: 1
Extremum: 160.039
CompareEdge# 4
ShapeShape: min 106.415
Found 0 Extremas
IsParallel: 0

It seems only to compute when the edges are parallel and ExtCC does not perform very robust...