import math


def calculate_plane_size(aspect_ratio, fov, distance):
    """Calculates the width and height of a plane at the
    specified distance using the FOV of the frustrum
    and aspect ratio of the viewport.

    :param float aspect_ratio: The aspect ratio of the viewport.
    :param float fov: The FOV of the frustrum.
    :param float distance: The distance from the origin/camera
        of the plane to calculate.
    :rtype: A tuple of two floats: width and height: The width and height of
        the plane.
    """
    # http://www.songho.ca/opengl/gl_transform.html
    # http://nehe.gamedev.net/article/replacement_for_gluperspective/21002/
    # http://steinsoft.net/index.php?site=Programming/Code%20Snippets/OpenGL/gluperspective&printable=1
    tangent = math.radians(fov)
    height = distance * tangent
    width = height * aspect_ratio

    return width * 2.0, height * 2.0