示例#1
0
// generate camera ray
Ray OrthoCamera::GenerateRay( float x, float y, const PixelSample &ps) const
{
	x += ps.img_u;
	y += ps.img_v;

	float w = (float)m_imagesensor->GetWidth();
	float h = (float)m_imagesensor->GetHeight();

	x = ( ( x / w ) - 0.5f ) * m_camWidth;
	y = -1.0f * ( ( y / h - 0.5f ) ) * m_camHeight;

	Point ori = world2camera( Point( x , y , 0.0f ) );
	Vector dir = world2camera( Vector( 0.0f , 0.0f , 1.0f ) );

	return Ray( ori , dir );
}
示例#2
0
Vector2d Camera::world2pixel ( const Vector3d& p_w, const SE3& T_c_w )
{
    return camera2pixel ( world2camera(p_w, T_c_w) );
}