| |||||||||
| 
             
  | 
             
  | 
             
  | |||||||
| 
             
  | 
            
  | ||||||||
| 
             
  | |||||||||
| 
                     
 #include "vg.h"           // Required for the standard Vega classes
 
  | ||
| 
                     
 
 float getNavigatorSpeed( const int navIdx, const int pointIdx ){ // ############################################################## // # Public Function // # // # // # This functions show how to retrieve the speed of a control // # marker on the indexed Navigator, if the Navigator // # does not have a velocity marker at the given control point // # then retrun the overall navigator speed // # // # // # To get the overall speed simply pass pointIdx with a value // # set to less than Zero // # // # // ############################################################## char data[256]; unsigned ctrlptIdx = -1; int eventType = -1; double value = -1; unsigned nbytes = 0; 
 // // Sanity check we need the indexed navigator // vgSplineNavigator *navigator = vgGetNavigator( navIdx ); 
 if( navigator == NULL ) return 0.0f; 
 
 // // Retrieve how many markers the navigator has // int numMarkers = vgGetProp( navigator,VGNAV_NUM_MARKERS); 
 // // If index is out of rage then return the overall speed // if( pointIdx < 0 || pointIdx >= numMarkers ) return vgGetProp( navigator,VGSPLINENAV_VELOCITY ); 
 // // Unfortunately we have to search through every marker // that the Navigator has to find the Velocity marker // for the control point as Vega does not provide a // a straight forward interface to do this // for( int j = 0; j < numMarkers; j++ ){ 
 vgNavigatorGetMarker( (vgNavigator*)navigator, j, &ctrlptIdx, &eventType, &value, (void**)data, &nbytes ); 
 // // If we have found the Velocites of the control point then // return the speed which is returned in 'value' // if( eventType == VGSPLINENAV_VELOCITY && pointIdx == ctrlptIdx) { 
 return ( float ) value; 
 } } 
 
 // // If no velocity markers found then return the overall speed // return vgGetProp( navigator,VGSPLINENAV_VELOCITY ); 
 
 } // getNavigatorSpeed 
 
  | ||
| 
              
 
 © Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner.  | ||