Thu, 11/22/2001 - 13:13
Hi !
I installed Open Cascade 3.1 to see if that would help but I still have the same problem, I create a BRepPrimAPI_Box shape and then I explore the faces, I get a Geom_Surface from the face and try to use D0() to evaluate a point but I only get crap so if some one could point out what I am doing wrong I would be most grateful.
In the example below the variables contain: u1=-2.0e+100 u2=2.0e+100 v1=-2.0e+100 v2=2.0e+100, these values look a bit odd to me, but if I triangulate the box it is correct.
When I use D0( u1, v1, pt), I get pt.x=0.0 pt.y=-2.0e+100 pt.z=2.0e+100, x is correct by y and z is way wrong.
When I use D0( 0´, 0), I get the correct result pt.x.y.z=0.0.
If I change the shape from a box to a sphere everything works fine....
I get the same result with 3.0 and 3.1 so I guess I am doing something wrong but what ?
shape = BRepPrimAPI_MakeBox( 1, 1, 1); TopExp_Explorer ex; TopTools_MapOfShape map; for( ex.Init( shape, TopAbs_FACE); ex.More(); ex.Next()) // Iterate over all faces { const TopoDS_Shape& shp = ex.Current(); TopLoc_Location loc; assert( shp.ShapeType() == TopAbs_FACE); TopoDS_Face face = TopoDS::Face( shp); if( map.Add( face)) { const Handle(Geom_Surface)& surf = BRep_Tool::Surface( face); double u1, u2, v1, v2; surf->Bounds( u1, u2, v1, v2); gp_Pnt px; surf->D0( u1, v1, px); // 0,-2e100,2e100 surf->D0( 0.0, 0.0, px); // 0,0,0 ok! } }
Thu, 11/22/2001 - 16:19
Hi Mikael
From what I see, the underlying surface is an infinite plane, that's why you've got infinite boundaries (u,v). You need to retrieve the trimming boundary using something like BRepTools::UVBounds or some other way.
Good Luck. Francois