Next: Joining Time Series Data Up: Some Functions and Methods Previous: Matrix and Matrix Sequence Contents

## Utilities for Handling Cartesian and Polar Vectors

  `bool Qu_is3Vector(QdObject_var &obj)`,
  returns true if the input object is a QdRMatrix_var or rank 1 and size 3, and has the FRAME attribute identifying it as a vector e.g. `if(Qu_is3Vector(b_xyz)){...}`
  The syntax for FRAME is described below.(U)

  `QdObject_var QuGetVectorXYZ(QdObject_var dov)`
  This returns a QdObject_var of the same underlying type as the input object, but as a cartesian xyz representation. It returns the input object if it is already in cartesian. It uses Qu_is3Vector() to ensure input is a vector with well defined representation and frame. Returns null var pointer (test with is_nil() ) if a cartesian vector cannot be constructed. It is used to protect cartesian routines against polar input representations. e.g.

        #include "Qdos.h"
        #include "QdUtils.h"

        QdObject_var vec_xyz = QuGetVectorXYZ((QdObject_var)vec_in);
        QdRMatrixSeq_var vecSeq = QdRMatrixSeq_var::narrow(vec_xyz);
        if ( vecSeq.is_nil() ) return QPLUG_FAILURE;

  `QdObject_var QuGetVectorComponent(QdObject_var dov, char *vcomp)`,
  e.g. `bx = QuGetVectorComponent(b_xyz,"x")` to extract a component from a vector series, where `vcomp one of {"x","y","z","r(mag)","theta(rad)","phi(rad)",`
  `"theta(deg)","phi(deg)","Lat(deg)","Lat(rad)"}`(U)

  `char * Qu_GetVectorRep(QdObject_var& obj)`, e.g.
  `rep = Qu_GetVectorRep(b_xyz)`
  returns the `xyz', `rtp' or `rlp' string of the FRAME xref.(U)

  `int QarAreFramesSame(QdObject_var ptr1, QdObject_var ptr2)`,
  returns QAR_OK if the input objects are both vectors in the same frame and representation (FRAME attributes are identical), e.g.

        #include "Qdos.h"
        #include "qar.h"
        if(QarAreFramesSame(b_xyz,c_xyz) == QAR_OK){ // OK go ahead...}

  See also the Qrtn plug-in code for frame rotations.
  See also the QDOS HTML documentation for cartesian to polar conversions.

Next: Joining Time Series Data Up: Some Functions and Methods Previous: Matrix and Matrix Sequence Contents