コード例 #1
0
void GLC_Viewport::reframe(const GLC_BoundingBox& box)
{
	Q_ASSERT(!box.isEmpty());

	// Center view on the BoundingBox
	const GLC_Vector3d deltaVector(box.center() - m_pViewCam->target());
	m_pViewCam->translate(deltaVector);

	double cameraCover= box.boundingSphereRadius() * 2.0;

	// Compute Camera distance
	const double distance = cameraCover / m_ViewTangent;

	// Update Camera position
	m_pViewCam->setDistEyeTarget(distance);
}
コード例 #2
0
ファイル: glc_viewport.cpp プロジェクト: JasonWinston/GLC_lib
GLC_Camera GLC_Viewport::reframedCamera(const GLC_BoundingBox &box, double coverFactor) const
{
    Q_ASSERT(!box.isEmpty());
    GLC_Camera subject(*m_pViewCam);

    // Center view on the BoundingBox
    const GLC_Vector3d deltaVector(box.center() - m_pViewCam->target());
    subject.translate(deltaVector);

    if (coverFactor > 0.0) {
        double cameraCover= box.boundingSphereRadius() * coverFactor;

        // Compute Camera distance
        const double distance = cameraCover / m_ViewTangent;

        // Update Camera position
        subject.setDistEyeTarget(distance);
    }

    return subject;
}