gpt4 book ai didi

c++ - Q3DScatter --> 如何在点云中添加不同颜色的点

转载 作者:行者123 更新时间:2023-11-30 03:31:16 40 4
gpt4 key购买 nike

我在 Qt 中编写了一个程序,它使用 Q3DScatter 可视化处理过的点云(3D 点)。现在我想添加不同颜色的计算关键点。那可能吗?有没有人有这方面的经验?您可以在下面看到将点云添加到数据数组的部分代码。

QScatterDataArray * dataArray = new QScatterDataArray;
dataArray->resize(vector_seg_x->size());
QScatterDataItem * ptrToDataArray = &dataArray->first();

for(int i = 0; i < vector_seg_x->size();i++){

ptrToDataArray->setPosition(QVector3D(
(double)(iter_seg_x[i]),
(double)(iter_seg_y[i]),
(double)(iter_seg_z[i])));
ptrToDataArray++;

}

m_graph_seg->seriesList().at(0)->dataProxy()->resetArray(dataArray);

最佳答案

您只能为整个点列表设置颜色/渐变:

Q3DScatter scatter;
scatter.setFlags(scatter.flags() ^ Qt::FramelessWindowHint);

scatter.addSeries(new QScatter3DSeries);
scatter.addSeries(new QScatter3DSeries);

{
QScatterDataArray *data = new QScatterDataArray;
*data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f);

scatter.seriesList().at(0)->dataProxy()->resetArray(data);

QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200));
linearGrad.setColorAt(0, Qt::blue);
linearGrad.setColorAt(1, Qt::red);

scatter.seriesList().at(0)->setBaseGradient(linearGrad);
scatter.seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyle::ColorStyleObjectGradient);
}

{
QScatterDataArray *data = new QScatterDataArray;
*data << QVector3D(0.f, 0.f, 0.f);

scatter.seriesList().at(1)->dataProxy()->resetArray(data);
scatter.seriesList().at(1)->setBaseColor(Qt::green);
}

scatter.show();

关于c++ - Q3DScatter --> 如何在点云中添加不同颜色的点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44329125/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com