A BUG !?

Hi !

I have a small problem with faces, when I create a simple face using MakePolygon (it's shaped like the character 'O') everything is ok, the code look's like this:

BRepBuilderAPI_MakePolygon pp; pp.Add( gp_Pnt( 0.0859375, 0.164062, 0)); pp.Add( gp_Pnt( 0.210938, 0.03125, 0)); pp.Add( gp_Pnt( 0.390625, -0.015625, 0)); pp.Add( gp_Pnt( 0.5625, 0.03125, 0)); pp.Add( gp_Pnt( 0.6875, 0.164062, 0)); pp.Add( gp_Pnt( 0.734375, 0.359375, 0)); pp.Add( gp_Pnt( 0.695312, 0.554688, 0)); pp.Add( gp_Pnt( 0.570312, 0.6875, 0)); pp.Add( gp_Pnt( 0.390625, 0.734375, 0)); pp.Add( gp_Pnt( 0.140625, 0.632812, 0)); pp.Add( gp_Pnt( 0.046875, 0.34375, 0)); pp.Close(); assert( pp.IsDone()); TopoDS_Wire ww = pp.Wire(); assert( !ww.IsNull()); TopoDS_Face ff = BRepBuilderAPI_MakeFace( ww);

When I triangulate this everything is ok, but if I change the polygon into another shape, this one look's like the character 'P', like this:

BRepBuilderAPI_MakePolygon pp; pp.Add( gp_Pnt( 0.953125, 0, 0)); pp.Add( gp_Pnt( 0.953125, 0.296875, 0)); pp.Add( gp_Pnt( 1.14062, 0.296875, 0)); pp.Add( gp_Pnt( 1.34375, 0.359375, 0)); pp.Add( gp_Pnt( 1.40625, 0.515625, 0)); pp.Add( gp_Pnt( 1.38281, 0.609375, 0)); pp.Add( gp_Pnt( 1.32812, 0.679688, 0)); pp.Add( gp_Pnt( 1.23438, 0.703125, 0)); pp.Add( gp_Pnt( 1.125, 0.71875, 0)); pp.Add( gp_Pnt( 0.859375, 0.71875, 0)); pp.Add( gp_Pnt( 0.859375, 0, 0)); pp.Close(); assert( pp.IsDone()); TopoDS_Wire ww = pp.Wire(); assert( !ww.IsNull()); TopoDS_Face ff = BRepBuilderAPI_MakeFace( ww);

And triangulate it, it is facing in the wrong direction (the backside of the triangles or pointing in the reverse direction as with the 'O').

And later when I add an interior wire to make the hole for the 'O' and the 'P' it goes wierd again.

The 'O' is perfect, but the 'P' is as I said facing the wrong direction and there is no hole (when shaded), but if I look at the triangulation there is a nice edge visible where the hole should be, but the hole itself is filled with triangles.

Both wires are counter clockwise so there is no difference, I have looked over the code a number of times and cannot find anything wrong with it.

Does any one have any idea of what I may be doing wrong here.

Oh, by the way, what I am trying to do here is to convert true type characters from the FreeType library into BREP shapes.

Mikael

Stephane Routelous's picture

> Oh, by the way, what I am trying to do here
> is to convert true type characters from the
> FreeType library into BREP shapes.

Hello Mikael,

I've already done that ( converting the TrueType fonts to shape with the FreeType library ) with Cascade 2.0.

But I tried with 3.0 , and it doesn't work as with 2.1.

I can try to find my code and send it to you if you want.

BTW , I don't use points , but Bezier curves for the fonts.

Stephane

Jeff's picture

Hi Stephane,

Could you please send me the code if you still have it, I am looking for such stuff.

Thanks

Jeff