IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 8, 2015, 8:27:27 PM (11 years ago)
Author:
eugene
Message:

histograms should not draw beyond axis box; add anuenue color scheme

Location:
branches/eam_branches/ipp-20150405/Ohana/src/kapa2/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150405/Ohana/src/kapa2/src/DrawObjects.c

    r38062 r38099  
    248248 
    249249  /* connect first point to second point */
    250   sxa = sx0 - 0.5*(sx1 - sx0);
     250  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    251251  sya = MAX (sy0, Y0);
    252252  DrawLine (sx0, sy0, sxa, sy0);
     
    254254 
    255255  /* draw segment equal distance behind first point and down to x-axis */
    256   sxa = 0.5*(sx0 + sx1);
     256  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    257257  DrawLine (sx0, sy0, sxa, sy0);
    258258  DrawLine (sxa, sy0, sxa, sy1);
     
    269269    sx1 = MIN (MAX (sx1, X0), X1);
    270270    sy1 = MAX (MIN (sy1, Y0), Y1);
    271     sxa = 0.5*(sx0 + sx1);
     271    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    272272    DrawLine (sx0, sy0, sxa, sy0);
    273273    DrawLine (sxa, sy0, sxa, sy1);
     
    278278 
    279279  /* draw segment equal distance after last point and down to x-axis */
    280   sxa = sx1 + 0.5*(sx1 - sxo);
     280  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    281281  sya = MAX (sy1, Y0);
    282282  DrawLine (sx1, sy1, sxa, sy1);
  • branches/eam_branches/ipp-20150405/Ohana/src/kapa2/src/PSObjects.c

    r38062 r38099  
    211211 
    212212  /* connect first point to second point */
    213   sxa = sx0 - 0.5*(sx1 - sx0);
     213  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    214214  sya = MAX (sy0, Y0);
    215215  DrawLine (sx0, sy0, sxa, sy0);
     
    217217 
    218218  /* draw segment equal distance behind first point and down to x-axis */
    219   sxa = 0.5*(sx0 + sx1);
     219  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    220220  DrawLine (sx0, sy0, sxa, sy0);
    221221  DrawLine (sxa, sy0, sxa, sy1);
     
    232232    sx1 = MIN (MAX (sx1, X0), X1);
    233233    sy1 = MAX (MIN (sy1, Y0), Y1);
    234     sxa = 0.5*(sx0 + sx1);
     234    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    235235    DrawLine (sx0, sy0, sxa, sy0);
    236236    DrawLine (sxa, sy0, sxa, sy1);
     
    241241 
    242242  /* draw segment equal distance after last point and down to x-axis */
    243   sxa = sx1 + 0.5*(sx1 - sxo);
     243  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    244244  sya = MAX (sy1, Y0);
    245245  DrawLine (sx1, sy1, sxa, sy1);
  • branches/eam_branches/ipp-20150405/Ohana/src/kapa2/src/SetColormap.c

    r35106 r38099  
    166166    goto store_colors;
    167167  }
     168  /* anuenue */
     169  if (!strcasecmp (name, "anuenue")) {
     170    redRef   = 0.25*MaxValue*scale*4.0; // value at 0.0
     171    greenRef = 0.50*MaxValue*scale*4.0;
     172    blueRef  = 1.33*MaxValue*scale;
     173    for (i = 0; i < (int)(0.50*MaxValue); i++) { 
     174      SETVALUE (graphic[0].cmap[i].green, 0.0, 0, 0xffff); // red is a ramp from 0 to 0xffff
     175      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     176    }
     177    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
     178      SETVALUE (graphic[0].cmap[i].green, 4.0*i*scale - 0x20000, 0, 0xffff); // red is a ramp from 0 to 0xffff
     179      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     180    }
     181    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 
     182      SETVALUE (graphic[0].cmap[i].green, 0xffff, 0, 0xffff); // red is a ramp from 0 to 0xffff
     183      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     184    }
     185
     186    for (i = 0; i < (int)(0.25*MaxValue); i++) { 
     187      SETVALUE (graphic[0].cmap[i].red,  4*i*scale, 0, 0xffff);
     188    }
     189    for (i = (int)(0.25*MaxValue); i < (int)(0.50*MaxValue); i++) { 
     190      SETVALUE (graphic[0].cmap[i].red,  0x20000 - 4*i*scale, 0, 0xffff);
     191    }
     192    for (i = (int)(0.50*MaxValue); i < MaxValue; i++) { 
     193      SETVALUE (graphic[0].cmap[i].red,  2*i*scale - 0xffff, 0, 0xffff);
     194    }
     195
     196    for (i = 0; i < (int)(0.50*MaxValue); i++) { 
     197      SETVALUE (graphic[0].cmap[i].blue,  2*i*scale, 0, 0xffff);
     198    }
     199    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
     200      SETVALUE (graphic[0].cmap[i].blue,  0x30000 - 4*i*scale, 0, 0xffff);
     201    }
     202    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 
     203      SETVALUE (graphic[0].cmap[i].blue,  4*i*scale - 0x30000, 0, 0xffff);
     204    }
     205    goto store_colors;
     206  }
    168207  return (FALSE);
    169208
  • branches/eam_branches/ipp-20150405/Ohana/src/kapa2/src/bDrawObjects.c

    r38062 r38099  
    198198 
    199199  /* connect first point to second point */
    200   sxa = sx0 - 0.5*(sx1 - sx0);
     200  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    201201  sya = MAX (sy0, Y0);
    202202  DrawLine (buffer, sx0, sy0, sxa, sy0);
     
    204204 
    205205  /* draw segment equal distance behind first point and down to x-axis */
    206   sxa = 0.5*(sx0 + sx1);
     206  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    207207  DrawLine (buffer, sx0, sy0, sxa, sy0);
    208208  DrawLine (buffer, sxa, sy0, sxa, sy1);
     
    219219    sx1 = MIN (MAX (sx1, X0), X1);
    220220    sy1 = MAX (MIN (sy1, Y0), Y1);
    221     sxa = 0.5*(sx0 + sx1);
     221    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    222222    DrawLine (buffer, sx0, sy0, sxa, sy0);
    223223    DrawLine (buffer, sxa, sy0, sxa, sy1);
     
    228228 
    229229  /* draw segment equal distance after last point and down to x-axis */
    230   sxa = sx1 + 0.5*(sx1 - sxo);
     230  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    231231  sya = MAX (sy1, Y0);
    232232  DrawLine (buffer, sx1, sy1, sxa, sy1);
Note: See TracChangeset for help on using the changeset viewer.