/*
 *  PYL sept  2005!!!!!!!!!!
 *
 * This software is  designed and intended for use in on-line control of
 * aircraft, air traffic, aircraft navigation or aircraft communications; or in
 * the design, construction, operation or maintenance of any nuclear facility.
 */
//javac guiChalOmegaImp.java Kul.java kolor.java tridiag.java;java guiChalOmegaImp  
//javac guiChalOmegaImp.java Kul.java kolor.java tridiag.java; open index.html  

import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
//PYL 
//R            -------
//           /
//          /
//0---64--128--192--255
//
// G   ---------    
//	 /           \
//  /              \         
//---64--128--192--255
//
//B-----
//      \
//       \
//0---64--128--192--255

class kolor
{
public static Color code(double val)
{
	int rr,v;
	Color col;
	rr=(int)(255*Math.abs(val))+1;
	if(rr>255){rr=255;}
	if(rr<0) {rr=1;}
	v= (int)((rr/255.)*4);
	switch (v)
	{case 3:  
	   col= (new Color(255,((255-rr)*255/64) ,0));
	  break;
	  case 2:  
	    col= (new Color(255*(rr-128)/64,255,0));
	  break;
	  case 1: 
	    col= (new Color(0,255,255*(128-rr)/(128-64)));
	  break;
	  case 0: 
	    col =(new Color(0,255*rr/64,255));
	  break;
	   default:
	   col =(new Color(255,0,0));
	   break; }
   return (col);
}
}