point-curve extremum; projective surface overlaps

Hello everybody, I have two problems that are likely simple to be solved.

1. How do I find point on a Geom_Curve that is the closest one to a given gp_Pnt? The difference form projection is obviously that it is perpendicular whereas I do not care about direction with regards to the curve.

2. How to find out if two (planar and parallel) faces intersect in projection in direction perpendicular to their planes? The obvious solution of making translation to a common plane, then using BRepAlgoAPI_Section is _very_ slow (and floods cerr btw). Intersection of boundary curves (Geom_Curves) works well but does not handle the case when one surface is _inside_ another (or is there a way to say if a point lies on a TopoDS_Face?). I only need boolean answer, if the section exists or not.

Thanks for any suggestions. This forum is very helpful [btw, could it be fixed so that indented text appears as preformatted? left-aligned code is not very readable...]. Vaclav

Vaclav Smilauer's picture

It seems both problems (the first one for sure) are solved by BRepExtrema (it took a while to find a hint in forum as the classes are not mentioned in HTML documentation).

Rob Bachrach's picture

You are right about BRepExtrema. You might also want to look at
BRepClass. It will tell you if a point is inside a face.

Fabio Napodano's picture

there is something about such functions on modalg.pdf in the doc/hlp OCC subfolder