World Space

World space is a user-defined floating point coordinate system that applies to an entire virtual buffer. World space can be thought of as a standard Cartesian plane extending from the lower left corner of the virtual buffer. The world space vertical orientation is thus inverted relative to screen space and viewports.

The Fastgraph functions that accept world space parameters translate them to their screen space equivalents and then call the analogous screen space function. Because of this translation and the use of floating point values, using world space is somewhat slower than using screen space.

Any program that uses world space coordinates must first initialize Fastgraph's internal world space parameters. The function fg_initw() is provided for this purpose. The fg_initw() function has no parameters and must be called before any other function that uses world space coordinates.

The next step in using world space is to call fg_setworld() to define the world space coordinates of the virtual buffer edges. The fg_setworld() function has four floating-point parameters -- the minimum x coordinate (left edge), the maximum x coordinate (right edge), the minimum y coordinate (bottom edge), and the maximum y coordinate (top edge). For example, if you define the world space coordinates with the statement

C/C++ and Delphi:


Visual Basic:

Call fg_setworld(-10.0, 10.0, 0.0, 2.5)

the (x,y) coordinates of the virtual buffer corners would be defined as shown here:

(-10.0,2.5)        (10.0,2.5)
(-10.0,0.0)        (10.0,0.0)

Fastgraph includes a function fg_getworld() that returns the world space extremes as defined in the most recent call to fg_setworld().

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.