コード例 #1
0
ファイル: glc_factory.cpp プロジェクト: JasonWinston/GLC_lib
GLC_3DViewInstance GLC_Factory::createBox(const GLC_BoundingBox& boundingBox) const
{
	const double lx= boundingBox.upperCorner().x() - boundingBox.lowerCorner().x();
	const double ly= boundingBox.upperCorner().y() - boundingBox.lowerCorner().y();
	const double lz= boundingBox.upperCorner().z() - boundingBox.lowerCorner().z();
	GLC_Box* pBox= new GLC_Box(lx, ly, lz);
	GLC_3DViewInstance newBox(pBox);
	newBox.translate(boundingBox.center().x(), boundingBox.center().y()
					, boundingBox.center().z());
	return newBox;
}
コード例 #2
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);
}
コード例 #3
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;
}