Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ PEXViewMappingMatrix(3) — Open3D 4.96

Media Vault

Software Library

Restoration Projects

Artifacts Sought

PEXViewMappingMatrix(3)  —  Subroutines

Name

PEXViewMappingMatrix

Synopsis

int PEXViewMappingMatrix(PEXCoord2D ∗frame, PEXNPCSubVolume ∗viewport, int perspective, PEXCoord ∗prp, double view_plane, double back_plane, double front_plane, PEXMatrix matrix_return)

Arguments

framearray of 2 2D VRC locations which mark a rectangle in the view plane

viewportNPC viewport into which the frame gets mapped

perspectiveflag to indicate whether a perspective view is desired, a value of True requests that perspective be applied

prpprojection reference point

view_planeVRC position of view plane w.r.t. the VRP

back_planeVRC position of the back plane w.r.t. the VRP

front_planeVRC position of the front plane w.r.t. the VRP

matrix_return
matrix into which result is stored

Returns

Zero if successful; otherwise, one of the following:

PEXBadLimits
PEXBadViewport
PEXBadPlanes
PEXBadPRP

Description

This function creates a view mapping matrix that transforms a volume specified in view reference coordinates (VRC) to a volume in normalized projection coordinates (NPC).  This matrix is used in conjunction with a view orientation matrix as the viewing matrices for a designated view. 

The axes of VRC form a right-handed coordinate system.  The z axis is along the VPN (view plane normal, see PEXViewOrientation), The Y axis is fixed by VUP, and the X axis is determined so that the three axes form a right- handed coordinate system.

The front plane, back plane, and view plane all define planes in VRC parallel to the VRC x-y plane. The location of front_plane and back_plane along the z axis of VRC defines the front and back of the volume of VRC that will be mapped to the specified NPC viewport.  The view plane locates the view frame or "window" on the VRC z axis. The two points in frame determine the size of the view window by specifying lower left (frame[0]) and upper right (frame[1]) x and y VRC points of the window on the view plane. These values taken together establish the volume of VRC space that is mapped into the NPC viewport. 

The type of projection may be parallel or perspective.  The projection reference point (PRP) orients the projectors defining the surfaces of the view volume.  If perspective indicator is False, then the projection type is parallel and the projectors are all parallel to the vector joining the projection reference point and the center of the view window (located on the view plane).  If perspective is True, then the projectors all converge at the projection reference point.  Thus, the view volume is a parallelpiped for parallel views, and a truncated pyramid for perspective views.

When specifying NPC, the X, Y and Z limits must be as follows:

xmin < xmax ,  ymin < ymax ,  zmin <= zmax

Data Structures

typedef struct {
    PEXCoord            min;
    PEXCoord            max;
} PEXNPCSubVolume;
See also the PEXStructuresman page.

Errors

None

See Also

PEXViewMappingMatrix2D, PEXViewOrientationMatrix, PEXViewOrientationMatrix2D

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026