%%
%% This is file `colorwav.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% colorwav.dtx  (with options: `package')
%% 
%% This is a generated file
%% 
%% This file may be distributed and/or modified under the
%% conditions of the Limited General Product License
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{colorwav}
 [2007/04/12 v1.0 specify wavelength for color]
\RequirePackage{ifthen}
\RequirePackage{fp}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\newcommand{\COLORWAV@gamma}{0.8}%
\newcommand{\setGammaCorrection}[1]{%
\renewcommand{\COLORWAV@gamma}{#1}%
}
\newcommand{\COLORWAV@powerOfTen}{-9}%
\newcommand{\setUnitsE}[1]{%
\renewcommand{\COLORWAV@powerOfTen}{#1}%
}%
\newcommand{\COLORWAV@minWavelength}{380}%
\newcommand{\setMinVisibleWavelength}[1]{%
\renewcommand{\COLORWAV@minWavelength}{#1}%
}%
\newcommand{\COLORWAV@maxWavelength}{780}%
\newcommand{\setMaxVisibleWavelength}[1]{%
\renewcommand{\COLORWAV@maxWavelength}{#1}%
}%
\newcommand{\COLORWAV@colorAdjust}[3]{%
\FPifzero{#2}%
\xdef#1{0}%
\else%
\FPmul{\COLORWAV@tempA}{#2}{#3}%
\FPpow{\COLORWAV@tempA}{\COLORWAV@tempA}{\COLORWAV@gamma}%
\xdef#1{\COLORWAV@tempA}%
\fi%
}%
\newboolean{COLORWAV@lessthansmallest}%
\newboolean{COLORWAV@greaterthanlargest}%
\newboolean{COLORWAV@isnearuv}%
\newboolean{COLORWAV@isviolet}%
\newboolean{COLORWAV@isindigo}%
\newboolean{COLORWAV@isblue}%
\newboolean{COLORWAV@isgreen}%
\newboolean{COLORWAV@isorange}%
\newboolean{COLORWAV@isnearir}%
\newcommand{\storeRGBofWavelength}[4]{%
\setboolean{COLORWAV@lessthansmallest}{false}%
\setboolean{COLORWAV@greaterthanlargest}{false}%
\setboolean{COLORWAV@isnearuv}{false}%
\setboolean{COLORWAV@isviolet}{false}%
\setboolean{COLORWAV@isindigo}{false}%
\setboolean{COLORWAV@isblue}{false}%
\setboolean{COLORWAV@isgreen}{false}%
\setboolean{COLORWAV@isorange}{false}%
\setboolean{COLORWAV@isnearir}{false}%
\FPsub{\COLORWAV@tempA}{\COLORWAV@powerOfTen}{-9}%
\FPpow{\COLORWAV@tempA}{10}{\COLORWAV@tempA}%
\FPmul{\COLORWAV@thewavelen}{#4}{\COLORWAV@tempA}%
\FPiflt{\COLORWAV@thewavelen}{\COLORWAV@minWavelength}%
\setboolean{COLORWAV@lessthansmallest}{true}%
\fi%
\FPifgt{\COLORWAV@thewavelen}{\COLORWAV@maxWavelength}%
\setboolean{COLORWAV@greaterthanlargest}{true}%
\fi%
\FPiflt{\COLORWAV@thewavelen}{440}%
\setboolean{COLORWAV@isviolet}{true}%
\fi%
\FPiflt{\COLORWAV@thewavelen}{490}%
\setboolean{COLORWAV@isindigo}{true}%
\fi%
\FPiflt{\COLORWAV@thewavelen}{510}%
\setboolean{COLORWAV@isblue}{true}%
\fi%
\FPiflt{\COLORWAV@thewavelen}{580}%
\setboolean{COLORWAV@isgreen}{true}%
\fi%
\FPiflt{\COLORWAV@thewavelen}{645}%
\setboolean{COLORWAV@isorange}{true}%
\fi%
\ifthenelse{ \boolean{COLORWAV@lessthansmallest} \OR \boolean{COLORWAV@greaterthanlargest} }%
{%
\gdef\COLORWAV@redValue{0}%
\gdef\COLORWAV@greenValue{0}%
\gdef\COLORWAV@blueValue{0}%
}%
{\ifthenelse{ \boolean{COLORWAV@isviolet} }%
{%
\FPsub{\COLORWAV@tempA}{440}{\COLORWAV@minWavelength}%
\FPsub{\COLORWAV@tempB}{440}{\COLORWAV@thewavelen}%
\FPdiv{\COLORWAV@redValue}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\gdef\COLORWAV@greenValue{0.0}%
\gdef\COLORWAV@blueValue{1.0}%
}%
{\ifthenelse{ \boolean{COLORWAV@isindigo} }%
{%
\gdef\COLORWAV@redValue{0.0}%
\FPsub{\COLORWAV@tempA}{490}{440}%
\FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{440}%
\FPdiv{\COLORWAV@greenValue}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\gdef\COLORWAV@blueValue{1.0}%
}%
{\ifthenelse{ \boolean{COLORWAV@isblue} }%
{%
\gdef\COLORWAV@redValue{0.0}%
\gdef\COLORWAV@greenValue{1.0}%
\FPsub{\COLORWAV@tempA}{510}{490}%
\FPsub{\COLORWAV@tempB}{510}{\COLORWAV@thewavelen}%
\FPdiv{\COLORWAV@blueValue}{\COLORWAV@tempB}{\COLORWAV@tempA}%
}%
{\ifthenelse{ \boolean{COLORWAV@isgreen} }%
{%
\FPsub{\COLORWAV@tempA}{580}{510}%
\FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{510}%
\FPdiv{\COLORWAV@redValue}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\gdef\COLORWAV@greenValue{1.0}%
\gdef\COLORWAV@blueValue{0.0}%
}%
{\ifthenelse{ \boolean{COLORWAV@isorange} }%
{%
\gdef\COLORWAV@redValue{1.0}%
\FPsub{\COLORWAV@tempA}{645}{580}%
\FPsub{\COLORWAV@tempB}{645}{\COLORWAV@thewavelen}%
\FPdiv{\COLORWAV@greenValue}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\gdef\COLORWAV@blueValue{0.0}%
}%
{%
\gdef\COLORWAV@redValue{1.0}%
\gdef\COLORWAV@greenValue{0.0}%
\gdef\COLORWAV@blueValue{0.0}%
}}}}}}%
\FPiflt{\COLORWAV@thewavelen}{420}%
\setboolean{COLORWAV@isnearuv}{true}%
\fi%
\FPifgt{\COLORWAV@thewavelen}{700}%
\setboolean{COLORWAV@isnearir}{true}%
\fi%
\ifthenelse{ \boolean{COLORWAV@lessthansmallest} \OR \boolean{COLORWAV@greaterthanlargest} }%
{%
\gdef\COLORWAV@multFactor{0}%
}%
{\ifthenelse{ \boolean{COLORWAV@isnearuv} }%
{%
\FPsub{\COLORWAV@tempA}{420}{\COLORWAV@minWavelength}%
\FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{\COLORWAV@minWavelength}%
\FPdiv{\COLORWAV@multFactor}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\FPmul{\COLORWAV@multFactor}{0.7}{\COLORWAV@multFactor}%
\FPadd{\COLORWAV@multFactor}{0.3}{\COLORWAV@multFactor}%
}%
{\ifthenelse{ \boolean{COLORWAV@isnearir} }%
{%
\FPsub{\COLORWAV@tempA}{\COLORWAV@maxWavelength}{700}%
\FPsub{\COLORWAV@tempB}{\COLORWAV@maxWavelength}{\COLORWAV@thewavelen}%
\FPdiv{\COLORWAV@multFactor}{\COLORWAV@tempB}{\COLORWAV@tempA}%
\FPmul{\COLORWAV@multFactor}{0.7}{\COLORWAV@multFactor}%
\FPadd{\COLORWAV@multFactor}{0.3}{\COLORWAV@multFactor}%
}%
{%
\gdef\COLORWAV@multFactor{1.0}%
}}}%
\COLORWAV@colorAdjust{#1}{\COLORWAV@redValue}{\COLORWAV@multFactor}%
\COLORWAV@colorAdjust{#2}{\COLORWAV@greenValue}{\COLORWAV@multFactor}%
\COLORWAV@colorAdjust{#3}{\COLORWAV@blueValue}{\COLORWAV@multFactor}%
}%
\endinput
%%
%% End of file `colorwav.sty'.
