papyrus logo

color_utility.h

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

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1