Programming and Graphics

(Kiana) #1

322 Introduction to C++ Programming and Graphics


Matrix stack


pushmatrix () Save the current transformation matrix
on the matrix stack
popmatrix () Reinstate the last matrix pushed

Viewpoint


polarview (dist, azim, inc, twist) Specify the viewer’s position
in polar coordinates
up (x, y, z) Specify the world up
lookat (vx, vy, vz, px, py, pz, twist) Specify the viewer’s position

Arcs and circles


circleprecision (nsegs) Set number of line segments
around a circle; default is 32
arc (x, y, radius, startang, endang) Draw an arc in world units
sector (x, y, radius, startang, endang) Draw a sector interpreted
as a polygon
circle (x, y, radius) Draw a circle interpreted
as a polygon.

Curves


curvebasis (basis) Define a basis matrix for a curve
curveprecision (nsegs) Define the number of line segments to draw a curve
rcurve (geom) Draw a rational curve
curve (geom) Draw a curve
curven (n, geom) Draw n-3 overlapping curve segments;
nmustbeatleast4

Transformations


translate (x, y, z) Set up a translation
scale (x, y, z) Set up scaling factors for x, y, and z axes
rotate (angle, axis) Set up a rotation for axis, where axis is x, y, or z

Flushing


vsetflush (yesno) Set global flushing status
vflush () Call device flush or synchronization routine
Free download pdf