Class View2Camera


  • public final class View2Camera
    extends Object
    Transform each Vertex of a Model from the Camera's (shared) view coordinates to normalized camera coordinates.

    This stage transforms the Camera's view volume from a user defined shape (in the view coordinate system) into the standard normalized view volume (in the camera coordinate system) used by the Clip pipeline stage.

    There are two standard normalized view volumes, one for perspective projection and one for orthographic projection.

    The standard normalized perspective view volume is the infinitely long pyramid with its apex at the origin and intersecting the image plane z = -1 at the corners (-1, -1, -1) and (+1, +1, -1).

    The standard normalized orthographic view volume is the infinitely long parallelepiped centered on the z-axis and intersecting the image plane z = -1 at the corners (-1, -1, -1) and (+1, +1, -1).

    The user defined view volume determined by the Scene's Camera object is either the infinitely long pyramid with its apex at the origin and intersecting the image plane z = -1 at the corners (left, bottom, -1) and (right, top, -1), or it is the infinitely long parallelepiped parallel to the z-axis and intersecting the image plane z = -1 at the corners (left, bottom, -1) and (right, top, -1).

    The view coordinate system is relative to the user defined view volume.

    The normalized camera coordinate system is relative to the normalized view volume.

    The matrix that transforms the user defined view volume into the normalized view volume also transform the view coordinate system into the normalized camera coordinate system.

    The matrix that transforms view coordinates into normalized camera coordinates is derived in the comments of PerspectiveNormalizeMatrix and OrthographicNormalizeMatrix.

    • Method Detail

      • view2camera

        public static Model view2camera​(Model model,
                                        Camera camera)
        Use the Camera's normalizing Matrix to transform each Vertex from the Camera's view coordinate system to the normalized camera coordinate system.
        Parameters:
        model - Model with Vertex objects in the camera's view coordinate system
        camera - the Scene's Camera with the normalizing Matrix
        Returns:
        a new Model with Vertex objects in the normalized camera coordinate system