vtk debug和release导致GetEventPosit
2023-05-19 本文已影响0人
stnevermore
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 会被赋值为不定值,很奇怪
}