hi there,
I want to change the color of a point with code.
For example, I want to change the 10th point in the point cloud to red.
thanks~
How to change the color of a point with code?
Re: How to change the color of a point with code?
1- Use text editor or LibreOffice Calc to add 255 in front of your red points and 0 for others
2- Save as csv or txt
3- Open by CC as in pic below
However may be there is beter way directly by CC ?
Remarks:
1- You can ignore label during importing points
2- You can put labels in group to show or hide
3- You can change opacity of label to 0
4- To change points size use properties not (+- ) it is sometimes does not work
. . . .
. .
2- Save as csv or txt
3- Open by CC as in pic below
However may be there is beter way directly by CC ?
Remarks:
1- You can ignore label during importing points
2- You can put labels in group to show or hide
3- You can change opacity of label to 0
4- To change points size use properties not (+- ) it is sometimes does not work
. . . .
. .
Re: How to change the color of a point with code?
Thank you for your reply.
But this method doesn't quite work for me.
What I need is a point cloud already loaded and then change the color of one of its points.
But still, thank you very much.
I found a function
This is how I use it (pc1 is the point cloud already loaded into the dbtree)
But it reports an error.
But this method doesn't quite work for me.
What I need is a point cloud already loaded and then change the color of one of its points.
But still, thank you very much.
I found a function
Code: Select all
void ccPointCloud::setPointColor(unsigned pointIndex, const ccColor::Rgba& col)
{
assert(m_rgbaColors && pointIndex < m_rgbaColors->currentSize());
m_rgbaColors->setValue(pointIndex, col);
//We must update the VBOs
colorsHaveChanged();
}
Code: Select all
pc1->setPointColor(10, ccColor::red);
Code: Select all
Assertion `m_rgbaColors && pointIndex < m_rgbaColors->currentSize()' failed.
Aborted (core dumped)
Re: How to change the color of a point with code?
I found my own way
need to set a base color first.
Then change the color of the 10th point
Then
Success
need to set a base color first.
Code: Select all
pc1->setColor(ccColor::white);
Code: Select all
pc1->setPointColor(10, ccColor::red);
Code: Select all
m_app->addToDB(pc1);