Functions | |
HC_BOOLEAN | Compute_Coordinates (const char *segment, const char *in_system, const HC_POINT *in_position, const char *out_system, HC_POINT *out_position) |
HC_BOOLEAN | Compute_Coordinates_By_Path (int count, HC_KEY *keys, const char *in_system, const HC_POINT *in_position, const char *out_system, HC_POINT *out_position) |
HC_BOOLEAN | DCompute_Coordinates (const char *segment, const char *in_system, const HCD_POINT *in_position, const char *out_system, HCD_POINT *out_position) |
HC_BOOLEAN Compute_Coordinates | ( | const char * | segment, | |
const char * | in_system, | |||
const HC_POINT * | in_position, | |||
const char * | out_system, | |||
HC_POINT * | out_position | |||
) |
Converts positions back and forth among the various coordinate systems.
segment | - The name of a segment that provides the Window, Camera, and/or Driver attributes for the conversion. | |
in_system | - Special constants for the input and output coordinate spaces. See below for details. | |
in_position | - A 3-D coordinate position in the in_system coordinate space. Passed by reference in all languages. | |
out_system | - Special constants for the input and output coordinate spaces. See below for details. | |
out_position | - A 3-D coordinate position in the out_system coordinate space. Passed by reference in all languages. Returned to user. |
The in_system and out_system parameters to Compute_Coordinates() can include one of the following:
local window
The value is in terms of the local window for segment. (The Z coordinate is usually zero.)
outer window
The value is in terms of the outermost window for segment. ("Outermost" refers to the first segment going up from segment, which has a Driver attribute.)
screen range
The value is in window coordinates units based on the value of the screen range in Set_Rendering_Options() set on the segment. If no screen range is set, this is the equivalent to local window.
local pixels
The value is measured in screen pixels within the local window on segment. The upper-left of the window is pixel (0, 0). The pixels go down and to the right. (The Z coordinate is usually zero.)
outer pixels
The value is in terms of pixels within the outermost window on segment.
projection
The value is in projection space (Normalized device coordinates) and maps directly to the window.
viewpoint
A coordinate system based on the position of the observer (camera). The origin is at the camera position. The viewing direction is the Z-axis and the camera up vector is the Y-axis.
world
The value is in normal world coordinates (the coordinate system in which the camera is positioned; the coordinates of geometry after modelling matrices have been applied, but before projecting through a camera into a window.) A window Z value of zero maps to the current camera "target" plane.
camera
The coordinate system used in calls to Set_Camera_Position() . A synonym for world coordinates.
object
The value is in the coordinate system that real geometry lives in. This is similar to "world" coordinates, but does not includes the Modelling Matrices, if any.
Window Z coordinates are described at length under Show_Selection_Position() .
To generate the world coordinates of an eye-ray, given window or pixel coordinates, call this routine twice with two different window or pixel Z coordinates.
If you have many points to transform it is more efficient to call Compute_Transform() to get a transform matrix. Then call Compute_Transformed_Points() to do all the points at once. If you have just one or a couple points to transform, Compute_Coordinates() is more efficient because it doesn't need to build the matrix.
Calling Compute_XXX() routines to obtain data associated with a display, generates an update. On most devices, this poses no problem. However, for hardcopy devices such as Postscript or CGM, this can generate a blank page. To avoid this problem, applications often open a temporary driver subsegment. The application calls the compute routine, and retains the computed information, and then discards the temporary driver subsegment.
HC_BOOLEAN Compute_Coordinates_By_Path | ( | int | count, | |
HC_KEY * | keys, | |||
const char * | in_system, | |||
const HC_POINT * | in_position, | |||
const char * | out_system, | |||
HC_POINT * | out_position | |||
) |
Similar to Compute_Coordinates(), but concatenates the matrices along a segment path rather than the currently open segment.
count | - The size of the keys array | |
keys | - The array of keys starting with the owning segment and following long all the way back to the root segment or other desired segment. | |
in_system | - Special constants for the input and output coordinate spaces. See below for details. | |
in_position | - A 3-D coordinate position in the in_system coordinate space. Passed by reference in all languages. | |
out_system | - Special constants for the input and output coordinate spaces. See below for details. | |
out_position | - A 3-D coordinate position in the out_system coordinate space. Passed by reference in all languages. Returned to user. |
HC_BOOLEAN DCompute_Coordinates | ( | const char * | segment, | |
const char * | in_system, | |||
const HCD_POINT * | in_position, | |||
const char * | out_system, | |||
HCD_POINT * | out_position | |||
) |
Similar to Compute_Coordinates() but accepts and returns double-precision values. This command can be used only when the application links with the HOOPS double-precision module.
segment | - The name of a segment that provides the Window, Camera, and/or Driver attributes for the conversion. | |
in_system | - Special constants for the input and output coordinate spaces. See below for details. | |
in_position | - A 3-D coordinate position in the in_system coordinate space. Passed by reference in all languages. | |
out_system | - Special constants for the input and output coordinate spaces. See below for details. | |
out_position | - A 3-D coordinate position in the out_system coordinate space. Passed by reference in all languages. Returned to user. |