00001 /** 00002 \file Robots/LoBot/misc/LoTypes.C 00003 00004 \brief Some frequently used types across different parts of all the 00005 Lobot/Robolocust related programs. 00006 */ 00007 00008 // //////////////////////////////////////////////////////////////////// // 00009 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00010 // by the University of Southern California (USC) and the iLab at USC. // 00011 // See http://iLab.usc.edu for information about this project. // 00012 // //////////////////////////////////////////////////////////////////// // 00013 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00014 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00015 // in Visual Environments, and Applications'' by Christof Koch and // 00016 // Laurent Itti, California Institute of Technology, 2001 (patent // 00017 // pending; application number 09/912,225 filed July 23, 2001; see // 00018 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00019 // //////////////////////////////////////////////////////////////////// // 00020 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00023 // redistribute it and/or modify it under the terms of the GNU General // 00024 // Public License as published by the Free Software Foundation; either // 00025 // version 2 of the License, or (at your option) any later version. // 00026 // // 00027 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00028 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00029 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00030 // PURPOSE. See the GNU General Public License for more details. // 00031 // // 00032 // You should have received a copy of the GNU General Public License // 00033 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00034 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00035 // Boston, MA 02111-1307 USA. // 00036 // //////////////////////////////////////////////////////////////////// // 00037 // 00038 // Primary maintainer for this file: mviswana usc edu 00039 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/misc/LoTypes.C $ 00040 // $Id: LoTypes.C 13037 2010-03-23 01:00:53Z mviswana $ 00041 // 00042 00043 //------------------------------ HEADERS -------------------------------- 00044 00045 // lobot headers 00046 #include "Robots/LoBot/misc/LoTypes.H" 00047 00048 //----------------------------- NAMESPACE ------------------------------- 00049 00050 namespace lobot { 00051 00052 //--------------------------- OpenGL COLORS ----------------------------- 00053 00054 // Default constructor sets to black 00055 GLColor::GLColor() 00056 { 00057 m_color[0] = m_color[1] = m_color[2] = 0 ; 00058 } 00059 00060 // Constructor with bytes converts to clamped floats 00061 GLColor::GLColor(unsigned char r, unsigned char g, unsigned char b) 00062 { 00063 m_color[0] = r/255.0f ; 00064 m_color[1] = g/255.0f ; 00065 m_color[2] = b/255.0f ; 00066 } 00067 00068 // Constructor with floats clamps supplied values 00069 GLColor::GLColor(float r, float g, float b) 00070 { 00071 m_color[0] = clamp(r, 0.0f, 1.0f) ; 00072 m_color[1] = clamp(g, 0.0f, 1.0f) ; 00073 m_color[2] = clamp(b, 0.0f, 1.0f) ; 00074 } 00075 00076 // Copy constructor 00077 GLColor::GLColor(const GLColor& C) 00078 { 00079 m_color[0] = C.m_color[0] ; 00080 m_color[1] = C.m_color[1] ; 00081 m_color[2] = C.m_color[2] ; 00082 } 00083 00084 // Assignment 00085 GLColor& GLColor::operator=(const GLColor& C) 00086 { 00087 if (&C != this) { 00088 m_color[0] = C.m_color[0] ; 00089 m_color[1] = C.m_color[1] ; 00090 m_color[2] = C.m_color[2] ; 00091 } 00092 return *this ; 00093 } 00094 00095 //----------------------------------------------------------------------- 00096 00097 } // end of namespace encapsulating this file's definitions 00098 00099 /* So things look consistent in everyone's emacs... */ 00100 /* Local Variables: */ 00101 /* indent-tabs-mode: nil */ 00102 /* End: */