BRep_Tool::Parameters for Surfaces does not work, need help, PLZ

Hello @ll,

my problem is the following...

i have a Bezier Surface, and a need to get access to the parameters, and i use the BRep_Tool-method for that, but everytime i get an exception, when i try to access via vertex on a uv... my code...

TColgp_Array2OfPnt array(1,4,1,4);
Handle(Geom_BezierSurface) bezsurface = new Geom_BezierSurface(array);
BRepBuilderAPI_MakeFace makeface(bezsurface);
TopoDS_Face facing = makeface.Face();

TopoDS_Vertex p= BRepBuilderAPI_MakeVertex(gp_Pnt(0,0,0));
gp_Pnt2d paramUV = BRep_Tool::Parameters(p,facing); // ...

Whats wrong? I tried so many ways, i also add an wire to my face, with the (0,0,0)-Pnt ... in my opinion the problem is in the Vertex p, cause all methods besides Parameters and Parameter works.

i hope you guys can help me, because it drives me mad!

Dean's picture

Hi David,
I looked the OCC Document, and found the following methods.
if you are using the first method, you have used a wrong type. if you are using the second method, you have missed a Edge. I hope this helps you, in addition, BRep_Tool::Parameter returns Standard_Real not gp_Pnt2d type. (From OCC 5.0 Document)


Standard_Real Parameter (const TopoDS_Vertex& V,
const TopoDS_Edge& E);

Standard_Real Parameter (const TopoDS_Vertex& V,
const TopoDS_Edge& E,
const TopoDS_Face& F);

Standard_Real Parameter (const TopoDS_Vertex& V,
const TopoDS_Edge& E,
const Handle(Geom_Surface)& S,
const TopLoc_Location& L);

Dean's picture

oops! sorry, answered the wrong question, please ignore it.

DavidB's picture


i handled with the BRep_Tool::Parameters-code, now i know, the method does not know the edges and poles, i mean, it does know the uv's (0,0), (1,0), (0,1), (1,1), - how can i check for vertices between (0,0) and (1,0) (for example)... how can i tell him to compare with the poles from my original beziersurface controllpoints, ...

the idea is, i want to change the Paramters from my beziersurface and want to approximate new controllpoints with the gauss least square method from OCC, therefore i need this Parameters-Method, i hope, someone can help

François Lauzon's picture

You could either use GeomAPI_ProjectPointOnSurf and project the point on the Geom_BezierSurface, or use BRepExtrema_ExtPF and project a vertex on your bezier face. You will be able to get the UV coordinate as a result.

For your information, BRep_Tool won't project a point on a face for you, it is used to extract information about the topology already defined on your object, have a look at the pdf documentation for more information.

Good Luck,

DavidB's picture

Thanks a lot Francois.