# Trigonometry

Provide functions for the trigonometric functions.

pyrr.trig.aspect_ratio(width, height)

pyrr.trig.calculate_fov(zoom, height=1.0)

  Calculates the required FOV to set the view frustrum to have a view with the specified height at the specified distance.

  Parameters:

    - zoom (float) – The distance to calculate the FOV for.

    - height (float) – The desired view height at the specified distance. The default is 1.0.

  Return type:

    A float representing the FOV to use in degrees.

pyrr.trig.calculate_height(fov, zoom)

  Performs the opposite of calculate_fov. Used to find the current height at a specific distance.

  Parameters:

    - fov (float) – The current FOV.

    - zoom (float) – The distance to calculate the height for.

  Return type:

    A float representing the height at the specified distance for the specified FOV.

pyrr.trig.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.

  Parameters:

    - aspect_ratio (float) – The aspect ratio of the viewport.

    - fov (float) – The FOV of the frustrum.

    - distance (float) – The distance from the origin/camera of the plane to calculate.

  Return type:

    A tuple of two floats: width and height: The width and height of the plane.

pyrr.trig.calculate_zoom(fov, height=1.0)

  Calculates the zoom (distance) from the camera with the specified FOV and height of image.

  Parameters:

    - fov (float) – The FOV to use.

    - height (float) – The height of the image at the desired distance.

  Return type:

    A float representing the zoom (distance) from the camera for the desired height at the specified FOV.

  Raises:

    ZeroDivisionError – Raised if the fov is 0.0.