Forum archiveIssue archiveOther usage issues

Archived discussion

About Distance between a plant and a line

Other usage issuesFri, 09/10/2010 - 06:302 replies

Browse this forum
QuestionAuthor

hi everyone £¬
i want to compute the distance between a plant and a line

/////////////////////////
gp_Ax1 axis = GetAxis(aface1);
gp_Lin line1=gp_Lin(axis);
TopLoc_Location loc;
Handle(Geom_Surface) theSurf2 = BRep_Tool::Surface(aface2, loc);
GeomAdaptor_Surface theAdaptSurf2(theSurf2);
gp_Pln thePln2 = theAdaptSurf2.Plane();
Standard_Real distance = thePln2.Distance(line1);
return distance;
/////////////////////////////

the proble is £¬the distance always return 0 £¡£¡

who can help me£¿
what is the problem£¿

thank you very much£¡

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi,
Problems can be different.
Try to locate it.
1) visualize both (or dump coordinates of both) to check that they are not coincident
2) if you are friendly with Draw environment use, please, command , which reports distance between shapes. Or check the command implementation and use obtained knowledge in your own example.
Good luck
Commenter-1

02Author

Sergey£¬
thank you for your advice.

i solved the problem

////////
gp_Ax1 axis = GetAxis(aface1);
//gp_Lin line1=gp_Lin(axis);
gp_Pnt point1=axis.Location();
TopLoc_Location loc;
Handle(Geom_Surface) theSurf2 = BRep_Tool::Surface(aface2, loc);
GeomAdaptor_Surface theAdaptSurf2(theSurf2);
gp_Pln thePln2 = theAdaptSurf2.Plane();
Standard_Real distance = thePln2.Distance(point1);
return distance;
////////////////////

thanks a lot