Distance gp_Pnt and gp_Ax1

Hello,

I was wondering how I can easily find the shortest distance between an axis gp_Ax1 and a point gp_Pnt ? There's no function ".Distance()" in either that can take the other as parameter.

Thanks a lot,
Roy

Alexander Luger's picture

Hello,

how about thePoint.Distance(theAx1.Location())?

Regards,
Alex

Roy Spades's picture

The distance between theAx1.Location() and thePoint will not necessarily be the shortest distance between theAx1 and thePoint.
It'll depend on which point in space exactly theAx1.Location() corresponds to.

Danut Stanciu's picture

Hi,
Try that:

Geom_Line gmLine=GC_MakeLine(gpAx1);
gp_Lin lin=gmLine.Lin();
Standard_Real dist=lin.Distance(gpPnt);

Roy Spades's picture

Seems good, thanks!