PointClouds with colorcoding for z-coord???AIS_IneractiveObject

I inherited a class from AIS_InteractiveObject. Is a class for more than 100 tausend points. Look at the listing. Now I will give some point a other color (dependency on z-coord). What can I do?
The selection mode in the code is seek. I search for a idee too.

Thx Torsten.

This is the code:
void CPoint3dPack::Compute(const Handle_PrsMgr_PresentationManager3d& aPresentationManager,const Handle_Prs3d_Presentation& aPresentation,const Standard_Integer aMode)
{
aPresentation->SetInfiniteState(myInfiniteState);

if (aMode==0)
{
static Handle(Graphic3d_AspectMarker3d) PtA = ::new Graphic3d_AspectMarker3d ();
PtA->SetType(Cnfg.m_style);
PtA->SetScale(Cnfg.m_scale);
PtA->SetColor(Cnfg.m_clr);
BasePackGroup = Prs3d_Root::CurrentGroup(aPresentation);
BasePackGroup->SetPrimitivesAspect(PtA);

Graphic3d_Array1OfVertex arrayVert (1, Count);
double *tmp=XYZ,x,y,z;
for (int i=1; i {
x=*tmp++;
y=*tmp++;
z=*tmp++;
arrayVert(i).SetCoord((Standard_Real)x,(Standard_Real)y,(Standard_Real)z);
}
BasePackGroup->MarkerSet(arrayVert);
}
else if (aMode== -99) // Selction, Hervorhebung
{
///////////TEST/////////////////////
CString buf;
buf=aMode;
MessageBox(NULL,buf,"",MB_OK);
////////////////////////////////////
static Handle(Graphic3d_AspectMarker3d) PtA = ::new Graphic3d_AspectMarker3d ();
PtA->SetType(Cnfg.m_style);
PtA->SetScale(Cnfg.m_scale);
PtA->SetColor(Cnfg.m_clr);
BasePackGroup = Prs3d_Root::CurrentGroup(aPresentation);
BasePackGroup->SetPrimitivesAspect(PtA);

Graphic3d_Array1OfVertex arrayVert (1, Count);
double *tmp=XYZ,x,y,z;
for (int i=1; i {
x=*tmp++;
y=*tmp++;
z=*tmp++;
arrayVert(i).SetCoord((Standard_Real)x,(Standard_Real)y,(Standard_Real)z);
}

BasePackGroup->MarkerSet(arrayVert);
}
}

Stephane Routelous's picture

Hallo Torsten.

You cannot.
well, you can, but the performances will be very very poor.
The problem is that in the class Graphic3d_Group, you don't have a method MarkerSet with an array of Graphic3d_VertexC.
It means, that you have to make a loop :

loop on all your vertices
SetPrimitiveAspect with your color
Display one point ( or all the points with the same color )
end loop.

the display driver will create one display structure for each colored point instead of one structure with all the points.
I've already done it before, but it is very very slow.

my 2 cents : don't use OpenCASCADE for disply if you need performance with a lot of points.

BTW, for points, if you use ASpect_TOM_Point for the style of your points, you will have better performances as the other types, because TOM_Point use the OpenGL primitive to display a point, and the other ones are using one bitmap per point.

HTH

Stoltz's picture

Hi Stephane !

I have the same problem. I have 100 000 points that have different colors. Is there an other way to change the color of each point? It's really frustrating that we cannot use MarkerSet with Graphic3d_VertexC...
Thank you for your help !

Philippe.