feat: 重新规划ui布局;增加左右红外以及rgb相机可视化
This commit is contained in:
@@ -9,9 +9,11 @@ PointCloudGLWidget::PointCloudGLWidget(QWidget *parent)
|
||||
, m_vertexBuffer(nullptr)
|
||||
, m_vao(nullptr)
|
||||
, m_pointCount(0)
|
||||
, m_fixedCenter(0.0f, 0.0f, 0.0f)
|
||||
, m_centerInitialized(false)
|
||||
, m_orthoSize(2000.0f) // 正交投影视野大小
|
||||
, m_rotationX(0.0f) // 从正面看(0度)
|
||||
, m_rotationY(0.0f) // 从正面看(0度)
|
||||
, m_rotationY(0.0f) // 不旋转Y轴
|
||||
, m_translation(0.0f, 0.0f, 0.0f)
|
||||
, m_leftButtonPressed(false)
|
||||
, m_rightButtonPressed(false)
|
||||
@@ -67,7 +69,7 @@ void PointCloudGLWidget::setupShaders()
|
||||
uniform mat4 mvp;
|
||||
void main() {
|
||||
gl_Position = mvp * vec4(position, 1.0);
|
||||
gl_PointSize = 2.0;
|
||||
gl_PointSize = 1.0; // 减小点的大小
|
||||
}
|
||||
)";
|
||||
|
||||
@@ -221,6 +223,27 @@ void PointCloudGLWidget::updatePointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cl
|
||||
|
||||
m_pointCount = m_vertices.size() / 3;
|
||||
|
||||
// 计算点云中心并进行中心化处理
|
||||
if (m_pointCount > 0) {
|
||||
float centerX = (minX + maxX) / 2.0f;
|
||||
float centerY = (minY + maxY) / 2.0f;
|
||||
float centerZ = (minZ + maxZ) / 2.0f;
|
||||
|
||||
// 第一帧:初始化固定中心点
|
||||
if (!m_centerInitialized) {
|
||||
m_fixedCenter = QVector3D(centerX, centerY, centerZ);
|
||||
m_centerInitialized = true;
|
||||
qDebug() << "[PointCloudGLWidget] Fixed center initialized:" << m_fixedCenter;
|
||||
}
|
||||
|
||||
// 使用固定的中心点进行中心化(避免抖动)
|
||||
for (size_t i = 0; i < m_vertices.size(); i += 3) {
|
||||
m_vertices[i] -= m_fixedCenter.x(); // X坐标
|
||||
m_vertices[i + 1] -= m_fixedCenter.y(); // Y坐标
|
||||
m_vertices[i + 2] -= m_fixedCenter.z(); // Z坐标
|
||||
}
|
||||
}
|
||||
|
||||
// 添加调试日志
|
||||
static int updateCount = 0;
|
||||
if (updateCount < 3 || updateCount % 100 == 0) {
|
||||
|
||||
Reference in New Issue
Block a user