Compute_Coordinates

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)
 Converts positions back and forth among the various coordinate systems. More...
 
HC_BOOLEAN Compute_Coordinates_By_Path (int count, const 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. More...
 
HC_BOOLEAN DCompute_Coordinates (const char *segment, const char *in_system, const HC_DPOINT *in_position, const char *out_system, HC_DPOINT *out_position)
 Similar to Compute_Coordinates(), but returns double-precision values for position. More...
 
HC_BOOLEAN DCompute_Coordinates_By_Path (int count, const HC_KEY *keys, const char *in_system, const HC_DPOINT *in_position, const char *out_system, HC_DPOINT *out_position)
 Similar to Compute_Coordinates_By_Path(), but operates on double-precision data. More...
 

Detailed Description

Function Documentation

◆ Compute_Coordinates()

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.

Parameters
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.
Returns
success

DETAILS

This routine examines the attributes present on segment and its owners and allows you to convert from in_system coordinates to out_system coordinates.

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.

NOTES

If a conversion is ambiguous (one of the matrices is singular), the system will choose arbitrarily among the valid possibilities. If a conversion is impossible (the point is on top of or behind a perspective camera), a false function status will be returned and out_position will be unchanged.

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.

RESTRICTIONS

The Compute_XXX() routines that require information about display drivers, do not work if they are called from an included segment. Display information must be associated with a window to return information about the display.

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.

See also
Compute_Transform, Show_Selection_Position, Show_Polyline, Show_Shell.

◆ Compute_Coordinates_By_Path()

HC_BOOLEAN Compute_Coordinates_By_Path ( int  count,
const 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.

Parameters
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.
Returns
success

DETAILS

No additional details. See Compute_Coordinates()

◆ DCompute_Coordinates()

HC_BOOLEAN DCompute_Coordinates ( const char *  segment,
const char *  in_system,
const HC_DPOINT *  in_position,
const char *  out_system,
HC_DPOINT *  out_position 
)

Similar to Compute_Coordinates(), but returns double-precision values for position.

Parameters
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.
Returns
success

DETAILS

No additional details. See Compute_Coordinates()

◆ DCompute_Coordinates_By_Path()

HC_BOOLEAN DCompute_Coordinates_By_Path ( int  count,
const HC_KEY *  keys,
const char *  in_system,
const HC_DPOINT *  in_position,
const char *  out_system,
HC_DPOINT *  out_position 
)

Similar to Compute_Coordinates_By_Path(), but operates on double-precision data.

Parameters
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.
Returns
success

DETAILS

No additional details. See Compute_Coordinates_By_Path()