beautypg.com

HP Prime Graphing Wireless Calculator User Manual

Page 291

background image

Programming in HP PPL

287

TRIANGLE_P

TRIANGLE

Syntax: TRIANGLE_P([G], x1, y1, x2, y2, x3, y3, c1,

[c2, c3], [Alpha], ["ZString", z1, z2, z3])

TRIANGLE_P([G], {x1, y1, [c1], [z1]}, {x2, y2,

[c2], [z2]},{x3, y3, [c3], [z3]}, ["ZString"])
TRIANGLE_P([G],points_definition,

triangle_definitions, rotation_matrix or
{rotation_matrix or -1, ["N"], [{eye_x, eye_y,
eye_z} or -1], [{3Dxmin, 3Dxmax, 3Dymin,
3Dymax, 3Dzmin, 3Dzmax}]}, [zstring])
TRIANGLE_P([G],pre_rotated_points,

triangle_definitions, [zstring])
TRIANGLE_P([G])

The basic form of TRIANGLE draws one triangle between
the specified pixel coordinates in the graphic using the
specified color and transparency (0 ≤ Alpha ≤ 255). If
three colors are specified, it blends the colors in between
the vertices.
The advanced form of TRIANGLE_P allows multiple
triangles to be rendered at the same time with a potential
3D transformation of the triangles’ vertices.
This is mostly used if you have a set of vertices and
triangles and want to display them all at once (faster).
points_definition is either a list or a matrix of point
definition. Each point is defined by two to four numbers:
x, y, z, and color. A valid point definition can have
multiple forms. Here are a couple of example: [x, y, z, c],
{x, y, z, c}, {x, y, #c}, {(x, y), c}, (x,y)... You can use a
vector of points instead of a list; in this case, the points can
be expressed as complex numbers.
triangle_ definitions is either a list or a matrix of triangle
definitions. Each triangle is defined by three to five
numbers: p1, p2, p3, color and alpha. p1, p2 and p3 are
the index in the points_definition of the 3 points that
define the triangle. Color is used to override the per point
color definition. If you need to provide an Alpha, but not
a color, use -1 for the color.