Wireframe

Hello all.
I'm new user OCC and I can not solve my problem...

I try to quickly draw wireframe (hundreds of thousands of edges) in 3D.
I assembled TopoDS_Edge fast enough and I put them in array

std::vector listEdges;

but how can I now draw this filed quickly enough?

My first attempt (simplified):

Handle(AIS_Shape) aAIS;

for(unsigned int i=0; i {
aAIS = new AIS_Shape(listEdges[i]);
...
}

Here arises a large number of AIS_Shape and for example rotation is very slow.

My second attempt (simplified):

Handle(AIS_Shape) aAIS;
BRepBuilderAPI_MakeWire wire;

for(unsigned int i=0; i {
wire.Add(listEdges[i]);
}

aAIS = new AIS_Shape(wire);

Here is a good result and (e.g.) rotation as well, but building a wire (wire.Add(...)) takes a long time ...

I would like to ask:
How to effectively draw the edges of my field??

Thank you

Martin Kovacik

EricThompson's picture

Instead of adding all the edges to a wire, try adding them to a compound:

TopoDS_Compound compoundShape;
BRep_Builder compoundBuilder;
compoundBuilder.MakeCompound( compoundShape );
for(unsigned int i=0; i < listEdges.size(); i++)
{
compoundBuilder.Add(listEdges[i]);
}

You would then display compoundShape in your context. This should be less overhead then adding the edges to a wire, with just as good performance for rotation, etc.

M_Kovo's picture

Thank you for your reply.
Your idea works perfectly.
This is exactly what I was looking for.

Thank you.