color_utility.h

00001 /***************************************************************************
00002 *   Copyright (C) 2006 by Rick L. Vinyard, Jr.                            *
00003 *   rvinyard@cs.nmsu.edu                                                  *
00004 *                                                                         *
00005 *   This program is free software; you can redistribute it and/or modify  *
00006 *   it under the terms of the GNU Lesser General Public License as        *
00007 *   published by the Free Software Foundation version 2.1.                *
00008 *                                                                         *
00009 *   This program is distributed in the hope that it will be useful,       *
00010 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012 *   GNU General Public License for more details.                          *
00013 *                                                                         *
00014 *   You should have received a copy of the GNU Lesser General Public      *
00015 *   License along with this library; if not, write to the                 *
00016 *   Free Software Foundation, Inc.,                                       *
00017 *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018 ***************************************************************************/
00019 #ifndef PAPYRUSCOLORUTILITY_H
00020 #define PAPYRUSCOLORUTILITY_H
00021 
00022 namespace Papyrus {
00023 
00024 template <typename T>
00025 inline
00026 void get_min_max(T& min, T& max, const T& first, const T& second, const T& third) {
00027     if (first > second) {
00028       if (first > third) {
00029         max = first;
00030         min = (third>second)?second:third;
00031       }
00032       else {
00033         max = third;
00034         min = second;
00035       }
00036     }
00037     else {
00038       if (first < third) {
00039         min = first;
00040         max = (third>second)?third:second;
00041       }
00042       else {
00043         min = third;
00044         max = second;
00045       }
00046     }
00047 }
00048 
00049 }
00050 
00051 #endif

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1