interference detection between two lines

Hi experts,

I would like to "scan" or maybe a better word is "investigate" a line which I have displayed in an OCC environment (ultimately as TopoDS_Shape). The purpose is to detect the extreme points on the line in x, y and z direction (i.e. the smallest dimension of an enclosing box that is aligned with the x,y,z axis).

Since I know the plane in which the line is that I want to investigate, one idea is to create a straight line and move this one along the plane in increments. At each increment checking for interference between this test-line and the wire I am investigating.

Is this the most efficient manner to do this? If yes, what class can I use to determine interference between shapes. If not what is the best method?

Any help much appreciated.

Kind regards

RT

Rob Bachrach's picture

Unless I misunderstand your question, you can just use the bounding box library. The following code was found elsewhere on this forum:

Bnd_Box bounds;
BRepBndLib::Add(myShape, bounds);
bounds.SetGap(0.0);
Standard_Real fXMin, fYMin, fZMin, fXMax, fYMax, fZMax;
m_boxBound.Get(fXMin, fYMin, fZMin, fXMax, fYMax, fZMax)

Paul Jimenez's picture

What's what you really want to achieve? If you want to find the coordinates of a box that will perfectly enclose your line, and which is also aligned with the XYZ coordinates, all you have to do is extract the min and max values of x, y and z for the two points of the line.

If you are interested in some sort of collision detection, you better check the algorithms for bounding boxes in OCC as suggested. I'm not sure if such functionality is implemented, but that would be a good starting point.