use AIS_PointCloud display

HI,

  I want to display a colored cylinder(points cloud) section by section. I used AIS_PointCloud to show the clound,but cann't show, who tell me or share code to me ,thanks.

Handle_AIS_ InteractiveContext m_ AISContext;
Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (2000, Standard_True);
aPoints->AddVertex(gp_Pnt(-40.0, -40.0, 0), Quantity_Color(Quantity_NOC_BLUE1));
aPoints->AddVertex(gp_Pnt(40.0, 40.0, 0), Quantity_Color(Quantity_NOC_BLUE2));
Handle(AIS_PointCloud) aPntCloud = new AIS_PointCloud();
aPntCloud->SetPoints(aPoints);
m_AISContext->Display(aPntCloud);

 

Manon Jubert's picture

Hi,

A solution to your problem could be :

a_occPc = new AIS_PointCloud();

Handle_Graphic3d_ArrayOfPoints arrayPoint = new Graphic3d_ArrayOfPoints(mycloudSource->size(), true, false);

for (Standard_Integer ii = 1; ii <= nbVertices; ++ii)

{

   gp_Pnt point(mycloud->points.[ii].x, mycloud->points[ii].y, mycloud->points[ii].z);

   Standard_Real r = ...;

   Standard_Real g = ...;

   Standard_Real b = ...;

   Quantity_Color aColor;

   aColor.SetValues(r, g, b, Quantity_TOC_RGB);

   arrayPoint->AddVertex(point, aColor);

}

a_occPc->SetPoints(arrayPoint);

m_AISContext->Display(_m_occPc);