How to retrieve WCS of a vgPart

 

Vega Code Example

 

 

 

 

 

 
 

This example function illustrates :

  • How to get World coordinate position a  vgPart
  • How to retrieve the node type of a vgPart
  • How to test if a vgPart is a DCS node
  • How to get the X,Y, Z,H,P,R coordinates of a vgPart
  • How to use vgDeletePos
  • How create a vgPos instance
  • How to use a vgPos instance

 

 
   
 

 

 
 
 
    
     
 

#include "vg.h"          // Required for the standard Vega classes
#include "vgperf.h"      // Required for the vgGetXXXPfNode functions

int

getVegaPartsWorldPosition( vgPart *part

                       , const float *x, const float *y, const float *z

                       , const float *h, const float *p, const float *r ){

 

// ##################################################################

// # Public  function  

// #

// #   Function shows how to get the World(WCS) position of a vgPart

// #

// #   returns VG_SUCCESS if the Part has positioned

// #            otherwise retruns VG_FAILURE

// #

// ##################################################################

vgPosition *pos    = NULL;

int         result = VG_FAILURE;

    

    //

    //  Sanity check we need a vgPart

    //     

    if( part == NULL )

        return result;

 

 

    //

    //  Retrieve the node type of the part

    //     

    int parttype = vgGetProp ( part, VGPART_TYPE );

 

    //

    //  If the part is a DCS/SCS

    //     

    if( parttype == VGPART_DCS || parttype == VGPART_SCS ){

 

 

        //

        //  Create a vgPos

        //     

        pos = vgNewPos();

        if( pos == NULL )

            return result;

 

    

        //

        //  Get position of the vgpart

        //     

        vgGetWCSPos( part, pos );

 

        //

        //  Retireve coordinates

        //     

        vgGetPosVec( pos, x, y, z, h, p, r );

 

 

        result = VG_SUCCESS;

 

        //

        //  Release the vgPos as where done

        //     

        vgDelPos( pos);

        }

 

 

return result;

 

} // getVegaPartsWorldPosition

 

   

  
    
 

 

 

© Copyright 2004 Gordon Tomlinson  All Rights Reserved.

All logos, trademarks and copyrights in this site are property of their respective owner.