Another small question/bug FastDiscrete

I'm trying to triangulate a Shape with FastDiscrete. The Discrete version works good:

Bnd_Box * r = new Bnd_Box () ; // to be saved anyway
BRepBndLib::Add (this->Shape(),* r);
Handle (BRepMesh_FastDiscret) mesh = new BRepMesh_FastDiscret(0.25,Shape (),*r,0.1,true,true,false,false);
The function shape returns a TopoDS_Shape& from an Handle.
VisualC++ 7.1 stops me with an Exception:
HEAP[xxx.exe]: Heap missing last entry in committed range near e23bd28

I'm missing something? Maybe I'm wrong with the bounding box?
I'm getting the same thing in release and debug mode, and even if add the surface after the constructor.


Roman Lygin's picture

Hi Thomas,

From you code and description it's not clear what might be causing a problem. What do you mean by "returns a TopoDS_Shape& from a Handle" - please provide a code snippet. At which line is exception raised ?

Of couse, in any case you shape (returned by your Shape()) method should be non-null and repsresent some surface/solid shape.


QbProg's picture

Ok, sorry for that.
The shape I'm using is a valid shape (not null, etc...) since I use it for custom visualization / sampling before I call the triangulation routine. I've got it into a
TopoDS_HShape Entity;
and I read it from the IGES reader.

The I do the following steps:
const Standard_Real a = 0.1; // any value
Bnd_Box * r = new Bnd_Box () ;
BRepBndLib::Add (this->Shape(),* r);
Handle (BRepMesh_FastDiscret) mesh = new BRepMesh_FastDiscret(1,a,*r);//,true,true,false,false);
mesh->Add (TopoDS::Face(Entity.Shape ()))

The program stops on the last line (.ADD) with the error :
HEAP[xxx.exe]: Heap missing last entry in committed range near e23bd28
If I use the other constructor (specifying the Shape directly) I've got the same problem.
If you want I can send you the IGES file with the surface!

The strange thing is that everything works with the "Discrete" algo but not with the "FastDiscrete".


Patrik Mueller's picture

Hi Thomas,

are you sure Entity is a TopoDS_Face?



QbProg's picture

Ok, I've removed the TopoDS::Face (Entity) cast and it worked, but for two times and with "big" precision. I used
Angle = 3.14 (i.e.)
Precision = 1
After two times (tested with the same surface) it stopped to work.
(with the same parameters)

I'm going mad! :)