首页 > 代码库 > 计算vtkRender的屏幕坐标范围和物理坐标范围
计算vtkRender的屏幕坐标范围和物理坐标范围
vtkRenderWindow可以包含多个vtkRender,在模型检测等计算过程中需要计算一些vtkRender的屏幕范围和物理范围,最近想了一种方案:
计算屏幕坐标范围:
double vp[4]; this->Renderer->GetViewport(vp); this->Renderer->NormalizedDisplayToDisplay(vp[0], vp[1]); this->Renderer->NormalizedDisplayToDisplay(vp[2], vp[3]); double dx = vp[2] - vp[0]; double dy = vp[3] - vp[1];
计算物理坐标范围:
double vp[4]; this->Renderer->GetViewport(vp); double wp1[3] = { vp[0], vp[1], 0.0 }; double wp2[3] = { vp[2], vp[3], 0.0 }; this->Renderer->NormalizedDisplayToViewport(wp1[0], wp1[1]); this->Renderer->ViewportToNormalizedViewport(wp1[0], wp1[1]); this->Renderer->NormalizedViewportToView(wp1[0], wp1[1], wp1[2]); this->Renderer->ViewToWorld(wp1[0], wp1[1], wp1[2]); this->Renderer->NormalizedDisplayToViewport(wp2[0], wp2[1]); this->Renderer->ViewportToNormalizedViewport(wp2[0], wp2[1]); this->Renderer->NormalizedViewportToView(wp2[0], wp2[1], wp2[2]); this->Renderer->ViewToWorld(wp2[0], wp2[1], wp2[2]);
计算vtkRender的屏幕坐标范围和物理坐标范围
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。