Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5011 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Aug 14, 2005, 3:58:22 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: colors work, as they are expected too

Location:
orxonox/trunk/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/p_node.cc

    r5010 r5011  
    708708    tIterator<PNode>* iterator = this->children->getIterator();
    709709      //PNode* pn = this->children->enumerate ();
    710     Vector childColor =  Color::RGBtoHSV(color)+Vector(-.3,.3,.2);
     710    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
    711711    PNode* pn = iterator->nextElement();
    712712    while( pn != NULL)
  • orxonox/trunk/src/lib/util/color.cc

    r5010 r5011  
    1212   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    14 
    15    this code has been borrowed from:
    16    http://www.easyrgb.com/math.php
    1714*/
    1815
     
    2926#include <stdio.h>
    3027
    31 // Needed by rgb2hsv()
    32 float Color::maxrgb(float r, float g, float b)
    33 {
    34   float max;
    35 
    36   if( r > g)
    37     max = r;
    38   else
    39     max = g;
    40   if( b > max )
    41     max = b;
    42   return( max );
    43 }
    44 
    45 
    46 // Needed by rgb2hsv()
    47 float Color::minrgb(float r,float g,float b)
    48 {
    49   float min;
    50 
    51   if( r < g)
    52     min = r;
    53   else
    54     min = g;
    55   if( b < min )
    56     min = b;
    57   return( min );
    58 }
    59 
    60 
    61 /* Taken from "Fund'l of 3D Computer Graphics", Alan Watt (1989)
    62    Assumes (r,g,b) range from 0.0 to 1.0
    63    Sets h in degrees: 0.0 to 360.;
    64       s,v in [0.,1.]
    65 */
     28/**
     29 * transforms from RGB to HSVtoRGB
     30 * @param RGB the RGB-color [0-1]
     31 * @returns HSV: with values (h[0-360(degree)],s[0,1],v[0,1])
     32 */
    6633Vector Color::RGBtoHSV(const Vector& RGB)
    6734{
     
    9966    else
    10067      printf("rgb2hsv::How did I get here?\n");
    101     h *= 60;
     68    h *= 60.;
    10269    if( h < 0)
    10370      h += 360.0;
     
    10673}
    10774
    108 /* Taken from "Fund'l of 3D Computer Graphics", Alan Watt (1989)
    109    Assumes H in degrees, s,v in [0.,1.0];
    110    (r,g,b) range from 0.0 to 1.0
    111 */
     75/**
     76 * converts a Color from HSV to RGBtoHSV
     77 * @param HSV: Vector with values (h[0-360(degree)],s[0,1],v[0,1])
     78 * @returns RGB: Vector [0-1]
     79 */
    11280Vector Color::HSVtoRGB(const Vector& HSV)
    11381{
     
    175143  return Vector(r,g,b);
    176144}
     145
     146
     147// Needed by rgb2hsv()
     148float Color::maxrgb(float r, float g, float b)
     149{
     150  float max;
     151  if( r > g)
     152    max = r;
     153  else
     154    max = g;
     155  if( b > max )
     156    max = b;
     157  return( max );
     158}
     159
     160
     161// Needed by rgb2hsv()
     162float Color::minrgb(float r,float g,float b)
     163{
     164  float min;
     165
     166  if( r < g)
     167    min = r;
     168  else
     169    min = g;
     170  if( b < min )
     171    min = b;
     172  return( min );
     173}
     174
  • orxonox/trunk/src/lib/util/color.h

    r5010 r5011  
    1313class Vector;
    1414
     15//! a very abstract Class that helps transforming Colors into different Systems
    1516class Color
    1617{
Note: See TracChangeset for help on using the changeset viewer.