Viewport

Class viewport performs three-dimensional viewport clipping in the normalized device coordinates, and maps the result into the device dependent coordinates. The viewport is the term representing the visible rectangular area on a screen. The physical size (dots in x and y) of a viewport should be given with :init message as the :width and :height arguments. :xcenter and :ycenter arguments determine the physical location of the viewport. These two parameters actually decide the location where objects are drawn on the screen when you are using a primitive display device like tektronics 4014 on which every dimension must be given absolutely to the origin of the screen. If you are using more sophisticated display device like Xwindows where locations can be determined relatively to the parent window, you need not to change viewport's parameters to move the viewport. These parameters are independent of the actual display location.

Viewport class assumes the origin of the viewport at the lower-left corner of the rectangular area and y-axis extends to the upper direction. Unfortunately, in many window systems and display devices, the origin is taken at the upper-left corner and y-axis extends to the lower direction. To work around this problem, a negative value should be given to the :height parameter.



homo-viewport-clip v1 v2 [function]

V1 and v2, which are two homogeneous vectors with four elements, represent a line in 3-D space. The line is clipped at the boundary of $x=-1, x=1, y=-1, y=1, z=0, z=1$, and a list of two vectors are returned. If the line lies completely outside the viewport, NIL is returned.



viewport [class]


  :super   coordinates 

:slots ()


viewport transformation maps the NDC (normalized device coordinates) to device specific coordinates. Inheriting the coordinates class, the viewport defines the size and the relative position of the projection screen.


:xcenter &optional xcenter [method]

X coordinates of the center of this viewport.


:ycenter &optional ycenter [method]
Y coordinates of the center of this viewport.


:size &optional size [method]
List of sizes in x direction and y direction.


:width &optional width [method]
width of this viewport.


:height &optional height [method]
height of this viewport.


:screen-point-to-ndc p [method]
p is a float-vector representing the location in the physical screen. p is transformed into the representation in the normalized-device coordinates.


:ndc-point-to-screen p [method]
NDC representation in this viewport, p, is transformed into the physical address on the screen.


:ndc-line-to-screen p1 p2 &optional (do-clip t) [method]
Two 3D float-vectors, p1 and p2, define a line in NDC. These two end points are transformed to the representation in the screen space. If do-clip is non-nil, the line is clipped.


:init &key (xcenter 100) (ycenter 100) (size 100) (width 100) (height 100) [method]
makes a new viewport object.


k-okada 2013-05-21