Basic Interface to Alias snapping functions
Synopsis
#include <AlSnap.h>
class AlSnap
static statusCode toGrid( Screencoord x, Screencoord y, double worldPos[3], AlWindow* window = NULL );
static statusCode toCV( Screencoord x, Screencoord y, AlObject* &obj, AlWindow *window = NULL );
static statusCode toCurve( Screencoord x, Screencoord y, AlObject* &obj, double &curveParam, AlWindow *window = NULL );
static int snappingTo( void );
Description
This class contains various utility functions for doing snapping. You can snap to grids, CVs and curves. When using the toGrid
function, the world position returned would be used to translate the object to the correct location. For the CV and curve
functions, the world position of the AlObject returned would be used to translate the object to the correct location. The
function snappingTo returns either kSnapGrid, kSnapCurve or kSnapCV based on what buttons have been set in the application.
statusCode AlSnap::toGrid( Screencoord x, Screencoord y, double worldPos[3], AlWindow* window )
Description
Snaps a point on the screen to the closest grid intersection. Returns world space coordinates for the closest grid intersection
to the specified cursor position.
The grid size is set using the meshSize method in AlWindow.
Arguments
< x, y - the screen position to test
> worldPos - the returned snapped world position
< window - the window to snap it to. Specify NULL to snap to the current window.
Return Codes
sSuccess - everything okay
sObjectNotFound - there was no point in range to snap to
sFailure - snapping failed
sInvalidArgument - the window was invalid (if given)
statusCode AlSnap::toCV( Screencoord x, Screencoord y, AlObject* &obj, AlWindow *window )
Description
Snaps a point on the screen to the closest curve, surface, or CurveOnSurface CV.
Arguments
< x, y - the screen position to test
> *obj - the returned snapped object
< window - the window to snap it to. Specify NULL to snap to the current window.
Return Codes
sSuccess - everything okay
sObjectNotFound - there was no point in range to snap to
sInsufficientMemory - not enough memory available
sFailure - could not complete request.
statusCode AlSnap::toCurve( Screencoord x, Screencoord y, AlObject* &obj, double &curveParam, AlWindow *window )
Description
Snaps a point on the screen to the closest curve intersection.
Arguments
< x, y - the screen position to test
> *obj - the returned snapped object
> curveParam - the parameter position on the curve
< window - the window to snap it to. Specify NULL to snap to the current window.
Return Codes
sSuccess - everything okay
sObjectNotFound - there was no point in range to snap to
sInsufficientMemory - not enough memory available
sFailure - could not complete request
int AlSnap::snappingTo( void )
Description
Returns the snap setting currently selected within the application.
Return Codes
kSnapGrid - Alias has grid snapping on
kSnapCV - Alias has CV snapping on
kSnapCurve- Alias has curve snapping on
NOTE: return values will be OR’ed together if more than one of the snapping functions is on.