Viewer Functions

The following convenience functions are defined for creating and manipulating the View3D widget.

Function NameDescription
XintCreateView3DCreates an unmanaged View3D widget.
XintView3DAddObjectAdds an object to the display list of a View3D widget.
XintView3DAddObjectAndMaterial.Adds an object to the display list of a View3D widget and assigns the object the specified material.
XintView3DDeselectAllTo deselect all selected objects.
XintView3DFreezeTo freeze/unfreeze the display.
XintView3DGetModelLimitsReturns the limits of the X, Y and Z axes.
XintView3DGetObjectPickableTells whether or not the specified object is pickable.
XintView3DGetObjectSelectableTells whether or not the specified object is selectable.
XintView3DGetObjectSelectedTells whether or not an object is selected.
XintView3DGetOrientationReturns the orientation of the specified viewer.
XintView3DGetTranslationReturns the translation of the specified viewer.
XintView3DGetZoomReturns the zoom of the specified viewer.
XintView3DPopFreezePop a freeze off of the stack (allow redraws).
XintView3DPushFreezePush a freeze onto the stack (prevent redraws).
XintView3DRecenterTo recenter the display.
XintView3DRedrawRedraws the entire display of a View3D widget.
XintView3DRemoveObjectRemoves an object from the display list of a View3D widget.
XintView3DScaleAdjusts the scaling of the display.
XintView3DSelectAllTo select all the objects displayed in the view.
XintView3DSelectObjectSelects or deselects the specified object.
XintView3DSetClipPlanesByEquationSets the clipping plane based on equation.
XintView3DSetClipPlanesByAngleSets the clipping plane based on angle.
XintView3DSetLightSets the light attributes of a viewer.
XintView3DSetLightRaysAndSpheresTells whether or not to identify active light sources.
XintView3DSetMaterialAssigns a material to an object for the specified viewer.
XintView3DSetOrientationSets the orientation of the specified viewer.
XintView3DSetPickableSets the pickable state of the specified object.
XintView3DSetSelectableSets the selectable state of the specified object.
XintView3DSetTranslationSets the translation of the specified viewer.
XintView3DSetZoomSets the zoom of the specified viewer.


XintCreateView3D

This function creates an unmanaged View3D widget.

     Object XintCreateView3D (...)

WidgetparentParent of new View3D widget.
char *nameName of new View3D widget.
ArgListarglistList of resource settings for the new widget.
CardinalargcountNumber of resources set by arglist.


XintView3DAddObject

This function adds an object to the list of objects displayed by a View3D widget. It increases the reference count of the object by 1. It should be used only if the object has already been assigned a material (See function
XintView3DSetMaterial to assign a material to an object). Also, use this function to add back an object that was removed from the display list of a viewer using function XintView3DRemoveObject.

     Boolean XintView3DAddObject (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object to add.

XintView3DAddObject returns True if the object was successfully added to the display list and False otherwise.


XintView3DAddObjectAndMaterial

This function adds an object to the list of objects displayed by a View3D widget and assigns a material to the object for that viewer. The function increases the reference count of the object by 1.

     Boolean XintView3DAddObjectAndMaterial (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object to add.
XintView3DMaterial *frontFront material for the object.
XintView3DMaterial *backBack material or NULL if object does not support a back material or if the back material should be the same as the front.

This function returns True if the object was successfully added to the display list and False otherwise.


XintView3DDeselectAll

This function deselects all the selected objects in the list of objects displayed by a View3D widget.

     void XintView3DDeselectAll (...)

WidgetwidgetID of the View3D widget.


XintView3DFreeze

This function allows the application to freeze the display, so that changes in the display list or in the object characteristics don't generate a redraw until the freeze state is turned off. This function is typically used when several objects are added or removed from the display list to minimize the number of redraws.

     void XintView3DFreeze(...)

WidgetwidgetID of the View3D widget.
BooleanfreezeTrue to freeze the display, False to unfreeze and redraw the display.

A typical code fragment, where multiple objects are added to the display list might appear as follows:

     XintView3DFreeze(view3d, True);
     XintView3DAddObject(view3D, object1);
     ....
     XintView3DAddObject(view3d, objectn);
     XintView3DFreeze(view3d, False);


XintView3DGetModelLimits

This function retrieves the limits of the X, Y and Z axes.

     void XintView3DGetModelLimits (...)

WidgetwidgetID of the View3D widget.
XintRealLimits *x_limitsAxis limits in the X direction.
XintRealLimits *y_limitsAxis limits in the Y direction.
XintRealLimits *z_limitsAxis limits in the Z direction.


XintView3DGetObjectPickable

This function returns True if the specified object is pickable, False otherwise.

     Boolean XintView3DGetObjectPickable (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object.


XintView3DGetObjectSelectable

This function returns True if the specified object is selectable. Otherwise it returns False.

     Boolean XintView3DGetObjectSelectable (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the object.


XintView3DGetObjectSelected

This function returns True if the specified object is selected inside widget . Otherwise it returns False.

     Boolean XintView3DGetObjectSelected (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the object.


XintView3DGetOrientation

This function retrieves the current orientation of the widget.

     void XintView3DGetOrientation (...)
WidgetwidgetID of the View3D widget.
XintReal *azimuthAzimuth of widget.
XintReal *dipDip of widget.
XintReal *twistTwist of widget.


XintView3DGetTranslation

This function retrieves the current translation of the widget.

     void XintView3DGetTranslation (...)
WidgetwidgetID of the View3D widget.
XintReal *x_offsetX offset of display.
XintReal *y_offsetY offset of display.


XintView3DGetZoom

This function retrieves the current zoom of the widget.

     XintReal XintView3DGetZoom (...)
WidgetwidgetID of the View3D widget.


XintView3DPopFreeze

This function allows the View3D widget to redraw.

     void XintView3DPopFreeze (...)
WidgetwidgetID of the View3D widget.

This function pops a freeze off of the stack. If there are any freezes on the stack, the View3D widget will not redraw. You can use the older API call XintView3DFreeze() to remove all freezes from the stack.


XintView3DPushFreeze

This function prevents the View3D widget from redrawing.

     void XintView3DPushFreeze (...)
WidgetwidgetID of the View3D widget.

This function pushes a freeze onto the stack. If there are any freezes on the stack, the View3D widget will not redraw. You can use XintView3DPopFreeze() or the older API call XintView3DFreeze() to remove all freezes from the stack.


XintView3DRecenter

This function recenters and resets the display of a View3D object, undoing all zooming and translation operations previously applied by an end-user.

     void XintView3DRecenter (...)

WidgetwidgetID of the View3D widget.


XintView3DRedraw

This function redraws the entire View3D widget window.

     void XintView3DRedraw (...)

WidgetwidgetID of the View3D widget.


XintView3DRemoveObject

This function removes an object from the display list of a 3D widget. The object removed will be destroyed unless it is used by another viewer or its reference count has been incremented using function
XintView3DRefObject.

     Boolean XintView3DRemoveObject (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the object to remove.

This function returns False if the object was not found in the list of objects displayed by the View3D widget. Otherwise it returns True.


XintView3DScale

This function scales the display.

     XintView3DScale (...)

WidgetwidgetID of the View3D widget.
charaxisSet to 'X' for the X axis, 'Y' for the Y axis, or 'Z' for the Z axis.
XintRealscaleAmount to scale the axis. 1.0 makes no change. Set < 1.0 to make the axis smaller. Set > 1.0 to make it larger.


XintView3DSelectAll

This function selects all the objects in the display list of a View3D widget.

     void XintView3DSelectAll (...)

WidgetwidgetID of the View3D widget.


XintView3DSelectObject

This function selects or deselects the specified object. If the argument object is set to NULL, the action affects all objects displayed by the View3D widget.

     void XintView3DSelectObject (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object.
BooleanselectTrue to select, False to deselect.


XintView3DSetClipPlanesByEquation

This function sets a clipping plane based on the following equation:
Ax + By + Cz + D = 0;

     void XintView3DSetClipPlanesByEquation (...)

WidgetwidgetID of the View3D widget.
intplaneWhich plane to set.
BooleanonSet to True to enable the clipping plane.
XintVector4equationThe clipping plane parameters (A,B,C,D).

Argument plane must be specified as one of the following constants:

Defined ConstantDescription
XintCLIP_PLANE0The default position is at quarter scale to +X edge and parallel to yz plane.
XintCLIP_PLANE1The default position is at quarter scale to -X edge and parallel to yz plane.
XintCLIP_PLANE2The default position is at quarter scale to +Y edge and parallel to xz plane.
XintCLIP_PLANE3The default position is at quarter scale to -Y edge and parallel to xz plane.
XintCLIP_PLANE4The default position is at quarter scale to +Z edge and parallel to xy plane.
XintCLIP_PLANE5The default position is at quarter scale to -Z edge and parallel to xy plane.


XintView3DSetClipPlanesByAngle

This function sets a clipping plane based on the user defined angle:

     void XintView3DSetClipPlanesByAngle (...)

WidgetwidgetID of the View3D widget.
intplaneWhich plane to set.
BooleanonSet to True to enable the clipping plane.
intazimuthThe angle between +X vector and the plane normal's projection on the xz plane.
intdipThe angle between plane normal and its projection on the xy plane.
XintVector3offsetThe distance from the original to the clipping plane.

Argument plane must be specified as one of the following constants:

Defined ConstantDescription
XintCLIP_PLANE0The default position is at quarter scale to +X edge and parallel to yz plane.
XintCLIP_PLANE1The default position is at quarter scale to -X edge and parallel to yz plane.
XintCLIP_PLANE2The default position is at quarter scale to +Y edge and parallel to xz plane.
XintCLIP_PLANE3The default position is at quarter scale to -Y edge and parallel to xz plane.
XintCLIP_PLANE4The default position is at quarter scale to +Z edge and parallel to xy plane.
XintCLIP_PLANE5The default position is at quarter scale to -Z edge and parallel to xy plane.


XintView3DSetLight

A View3D viewer can handle up to seven light sources, including a head light source with a fixed position and six light sources that rotate with the scene. Function XintView3DSetLight allows the application to control the state (on or off), the position and the intensity of each light source. For convenience, light sources are named according to their default position.

     void XintView3DSetLight (...)

WidgetwidgetID of the View3D widget.
intlightWhich light to set.
BooleanonSet to True to turn on the light and False to turn it off.
intintensityIntensity of the light (from 0 to XintLIGHT_MAX_INTENSITY)
intdipAn angle between -90° and +90° that specifies the position of the light source with respect to the z axis (-90° is parallel to the +Z axis and +90° is parallel to the -Z axis.).
intazimuthAn angle between -180° and +180° that specifies the position of the light source in the XY plane (angle 0° corresponds to the -Y axis).

Argument light must be specified as one of the following constants:

Defined ConstantDescription
XintLIGHT_HEADHead light. The position and intensity (set to XintLIGHT_MAX_INTENSITY) cannot be changed.
XintLIGHT_1Light positioned in the positive X direction (default position is dip = 0 and azimuth = 90).
XintLIGHT_2Light positioned in the negative X direction (default position is dip = 0 and azimuth = -90).
XintLIGHT_3Light positioned in the positive Y direction (default position is dip = 0 and azimuth = -180).
XintLIGHT_4Light positioned in the negative Y direction (default position is dip = 0 and azimuth = 0).
XintLIGHT_5Light positioned in the positive Z direction (default position is dip = -90 and azimuth = 0).
XintLIGHT_6Light positioned in the negative Z direction (default position is dip = 90 and azimuth = 0).


XintView3DSetLightRaysAndSpheres

This function is used to specify whether or not a sphere is drawn at the light position to indicate an active light source and whether or not a ray is traced to indicate the direction of the light.

     void XintView3DSetLightRaysAndSpheres (...)
WidgetwidgetID of the View3D widget viewer.
Booleanshow_raysTrue to draw the active light rays; False otherwise.
Booleanshow_spheresTrue to draw the active light spheres; False otherwise.


XintView3DSetMaterial

This function assigns a material to the specified object when displayed within a particular viewer.

     void XintView3DSetMaterial (...)

WidgetwidgetID of the View3D widget viewer.
XintView3DObject *objectID of the 3D object
XintView3DMaterial *frontFront material for the object.
XintView3DMaterial *backBack material or NULL if object does not support a back material or if the back material should be the same as the front.


XintView3DSetOrientation

This function sets the current orientation of the widget.

     void XintView3DSetOrientation (...)

WidgetwidgetID of the View3D widget viewer.
XintRealazimuthAzimuth of widget.
XintRealdipDip of widget.
XintRealtwistTwist of widget.


XintView3DSetPickable

This function sets the pickable state of the specified object.

     void XintView3DSetPickable (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object.
BooleanstateTrue to enable picking, False to disable picking.


XintView3DSetSelectable

This function sets the selectable state of the specified object.

     void XintView3DSetSelectable (...)

WidgetwidgetID of the View3D widget.
XintView3DObject *objectID of the 3D object.
BooleanstateTrue to enable selection, False to disable selection.


XintView3DSetTranslation

This function sets the current translation of the widget.

     void XintView3DSetTranslation (...)

WidgetwidgetID of the View3D widget viewer.
XintRealx_offsetX offset of display.
XintRealy_offsetY offset of display.


XintView3DSetZoom

This function sets the current zoom of the widget.

     void XintView3DSetZoom (...)

WidgetwidgetID of the View3D widget viewer.
XintRealzoomZoom of widget.