Open oocomeon opened 3 months ago
void pointAssociateToMap(PointType const * const pi, PointType * const po) { // 进行6自由度的变换,先进行旋转,然后再平移 // 主要进行坐标变换,将局部坐标转换到全局坐标中去 // 先绕z轴旋转 // |cosrz -sinrz 0| // Rz=|sinrz cosrz 0| // |0 0 1| // [x1,y1,z1]^T=Rz*[pi->x,pi->y,pi->z] float x1 = cYaw * pi->x - sYaw * pi->y; float y1 = sYaw * pi->x + cYaw * pi->y; float z1 = pi->z; // [x2,y2,z2]^T=Rx*[x1,y1,z1] // |1 0 0| // Rx=|0 cosrx -sinrx| // |0 sinrx cosrx| float x2 = x1; float y2 = cRoll * y1 - sRoll * z1; float z2 = sRoll * y1 + cRoll * z1; // 最后再绕Y轴旋转,然后加上平移 // |cosry 0 sinry| // Ry=|0 1 0| // |-sinry 0 cosry| po->x = cPitch * x2 + sPitch * z2 + tX; po->y = y2 + tY; po->z = -sPitch * x2 + cPitch * z2 + tZ; po->intensity = pi->intensity; }