IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 30, 2008, 7:45:21 AM (18 years ago)
Author:
eugene
Message:

modify functions to use both int and flt vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081124/Ohana/src/opihi/cmd.astro/czplot.c

    r20839 r20857  
    33int czplot (int argc, char **argv) {
    44 
    5   int i, kapa, Npts;
     5  int i, kapa;
    66  double min, range, Rmin, Rmax;
    7   opihi_flt *in, *out, *r, *d, *x, *y;
     7  opihi_flt *out, *r, *d, *x, *y;
    88  Vector Xvec, Yvec, Zvec, *xvec, *yvec, *zvec;
    99  Graphdata graphmode;
     
    2626  if ((zvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    2727
     28  REQUIRE_VECTOR_FLT (xvec, FALSE);
     29  REQUIRE_VECTOR_FLT (yvec, FALSE);
     30
    2831  if (xvec[0].Nelements != yvec[0].Nelements) {
    2932    gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]);
     
    4346  r   = xvec[0].elements.Flt;
    4447  d   = yvec[0].elements.Flt;
    45   in  = zvec[0].elements.Flt;
    4648  x   = Xvec.elements.Flt;
    4749  y   = Yvec.elements.Flt;
    48   out = Zvec.elements.Flt;
    49   for (i = 0; i < Zvec.Nelements; i++, in++, out++, r++, d++, x++, y++) {
    50     *out = MIN (1.0, MAX (0.01, (*in - min) / range));
     50  for (i = 0; i < Zvec.Nelements; i++, r++, d++, x++, y++) {
    5151    *r = ohana_normalize_angle (*r);
    5252    RD_to_XY (x, y, *r, *d, &graphmode.coords);
     53  }
     54
     55  out = Zvec.elements.Flt;
     56  if (zvec->type == OPIHI_FLT) {
     57    opihi_flt *in  = zvec[0].elements.Flt;
     58    for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
     59      *out = MIN (1.0, MAX (0.01, (*in - min) / range));
     60    }
     61  } else {
     62    opihi_int *in  = zvec[0].elements.Int;
     63    for (i = 0; i < Zvec.Nelements; i++, in++, out++) {
     64      *out = MIN (1.0, MAX (0.01, (*in - min) / range));
     65    }
    5366  }
    5467
     
    5669  graphmode.size = -1; /* point size determined by Zvec */
    5770  graphmode.etype = 0;
    58   Npts = Xvec.Nelements;
    59   PlotVectorTriplet (kapa, Npts, Xvec.elements.Flt, Yvec.elements.Flt, Zvec.elements.Flt, &graphmode);
     71  PlotVectorTriplet (kapa, Xvec, Yvec, Zvec, &graphmode);
    6072
    6173  free (Xvec.elements.Flt);
Note: See TracChangeset for help on using the changeset viewer.