vtk debug和release导致GetEventPosition和GetLastEventPosition的问题

void DentalArchIU::GetDraggingPoints(vtkActor* sphere, CVector3d& curDragPoint, CVector3d& lastDragPoint)
{
    if (!sphere)
        return;
    vtkRenderer* ren = m_WindowManager->GetRenderer();
    vtkRenderWindowInteractor* interactor = m_WindowManager->GetRenderWindowInteractor();
    vtkCameoInteractorStyle* iStyle = (vtkCameoInteractorStyle*)interactor->GetInteractorStyle();
    double displayPoint[3], ZDepthCurrentStay ;

    //calculate Z depth of current attachment stay
    CVector3d sphereCenter = sphere->GetCenter();//获取当前此附件的中心点
    //把世界坐标系变换到显示坐标系,因为平移附件是在显示的坐标系上的工作
    iStyle->ComputeWorldToDisplay(ren, sphereCenter[0], sphereCenter[1], sphereCenter[2], displayPoint);
    ZDepthCurrentStay = displayPoint[2]; //获取附件在当前位置的Z方向的深度

    CVector3d temp;
    int x = interactor->GetEventPosition()[0];//mouse pos
    int y = interactor->GetEventPosition()[1];
    iStyle->ComputeDisplayToWorld(ren, x, y, ZDepthCurrentStay, temp.point);

    x = interactor->GetLastEventPosition()[0];
    y = interactor->GetLastEventPosition()[1];
    iStyle->ComputeDisplayToWorld(ren, x, y, ZDepthCurrentStay, lastDragPoint.point);
    curDragPoint = temp; //如果不在这里赋值, 在release下面,这个curDragPoint 会被赋值为不定值,很奇怪
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容