beautypg.com

HP Prime Graphing Wireless Calculator User Manual

Page 292

background image

288

Programming in HP PPL

Note that {Color, [Alpha], triangle_1, ..., triangle_n} is
also a valid form to avoid respecifying the same color for
each triangle.
rotation_matrix is a matrix between sizes 2*2 to 3*4 that
specifies the rotation and translation of the point using
usual 3D and 4D geometry.
{eye_x, eye_y, eye_z} defines the eye position
(projection).
{3Dxmin, 3Dxmax, 3Dymin, 3Dymax, 3Dzmin, 3Dzmax}
is used to perform 3D clipping on the pretransformed
objects.
Each point is rotated and translated through a
multiplication by the rotation_matrix. It is then projected
on the view plan using the eye position calculated by the
following equation: x=eye_z/z*x-eye_x and y=eye_z/
z*y-eye_y.
Each triangle is clipped in 3D, if 3D clipping data is
provided.
If "N" is specified, the Z coordinates are normalized
between 0 and 255 after rotation, providing easier
zClipping.
If zstring is provided, per pixel z clipping happens using
the z value string (see the following).
TRIANGLE_P returns a string which contains all the
transformed points. If you plan to call TRIANGLE or LINE
multiple times in a row using the same points and
transformation, you can do so by replacing the
points_definition with this string and omitting the
transformation definition in subsequent calls to TRIANGLE
and LINE.
About zstring:
TRIANGLE_P([G]) returns a string adapted for z clipping.
To use z clipping, call TRIANGLE_P to create a z clipping
string (initialized at 255 for each pixels). You can then call
TRIANGLE_P with appropriate z (0-255) values for each
of the triangle vertices and TRIANGLE_P will not draw
pixels farther than the already drawn pixels. ZString is
automatically updated as appropriate.