Display Vertices fast...

I've got a problem...

I tried to import a company-internal file format into OC. This kind of files describe 3-dimensional clouds Everything works fine, but after processing the file I have to display some thousands of points(vertices). How can I do this in a fast way? I tried it by doing something like this:

for(i = 0; i

{

Geom_CartesianPoint P(x[i], y[i], z[i]);

myAISContext->Display(new AIS_Point(&P));

}

or:

for(i = 0; i

{

gp_Pnt P(x[i], y[i], z[i]);

TopoDS_Vertex V = BRepBuilderAPI_MakeVertex(P);

aSequence->Append(V);

}

if(!aSequence.IsNull())

{

for(Standard_Integer i = 1; i Length(); i++)

myAISContext->Display(new AIS_Shape(aSequence->Value(i)));

}

But those need eons to complete. Does anybody know how I can do this faster??

And how can I force OC to display just Points(Pixels) instead of those "crosses" for an Vertex?

Thank you for any help...

Stephane Routelous's picture

Hello,

you need to write your owndisplay object.

Create a new class inheriting from AIS_InteractiveObject.

I think you can see the samples with the file User_Cylinder.cxx to see how to do that.

In the Compute Method , you can get a Graphic3d_Group doing the following :

Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);

Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);

You must set the marker type in the Drawer to Aspect_TOM_Point

Handle(Graphic3d_AspectMarker3d) asp = myDrawer->PointAspect();

asp->SetTypeOfMarker(Aspect_TOM_POINT)

And in this Group , there is a method : MarkerSet where you can give a list of points

MyObject::Compute(...) {

Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);

Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);

Handle(Graphic3d_AspectMarker3d) asp; asp = myDrawer->PointAspect()->Aspect();

asp->SetTypeOfMarker(Aspect_TOM_POINT);

theGroup->SetGroupPrimitivesAspect(asp);

const Graphic3d_Array1OfVertex& theArray = GetVertices(); //your points

theGroup->MarkerSet(theArray);

}

Christian Reif's picture

If you use the display method this way the viewer is updated after every single point

this should speed up your application for(Standard_Integer i = 1; i <= aSequence->Length(); i++) { myAISContext->Display(new AIS_Shape(aSequence->Value(i)),false); } myAISContext->UpdateCurrentViewer();