HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/FograCT1/pbnCT88dbapi.php
<?php 


 $servername = "127.0.0.1";
$username = "root";
$password = "fredsql";
$DBNAME = "tvicheck-st";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";


if( !mysqli_select_db($conn, $DBNAME)) {
  die ("無法選擇資料庫");
}
mysqli_query( $conn, "SET NAMES 'utf8'");


	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fogra39  TVI Check</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #ffffff;
	margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
	padding: 0;
	text-align: center; /* 這樣會讓容器在 IE 5* 瀏覽器內置中對齊。然後,文字會在 #container 選取器中設定為靠左對齊預設值 */
	color: #000000;
}
.oneColElsCtr #container {
	width: 46em;
	background: #FFFFFF;
	margin: 0 auto; /* 自動邊界 (搭配寬度) 會讓頁面置中對齊 */
	border: 0px solid #000000;
	text-align: left; /* 這樣做會覆寫 Body 元素上的 text-align: center。 */
}
.oneColElsCtr #mainContent {
	padding: 0 20px; /* 請記住,欄位間隔就是 Div 方塊內部的空間,而邊界就是 Div 方塊外部的空間 */
}
-->
</style></head>

<body class="oneColElsCtr">
<?php
error_reporting(0);
$f123= $_GET['f123'];
$f321= $_GET['f321'];




//echo "account:".$contact." Press:".$printer." device:".$device ." date:" .$date. " file:".$tvifile;
?><br><br>
<?php
function get_betweenC ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}

include 'sp38XYZ.php';
include 'spXYZ.php';
include 'lab2xyz.php';
include 'SCCA51.php';
include 'xyz2lab01.php';
include 'xyz2lab.php';
include 'DensityV38.php';
include 'DensityV.php';
$sum=260;
$check=1;


	echo "  TVI88 Checking form! (for Type 1 paper, white backing)" .  "<br />";
    
	
   	  echo "if you see anything in ";$check=0;$sid=0;?><font color="red">RED</font><?php echo", Fix it! " .  "<br />";
	   echo "Report start: " .  "<br />";
     // echo "Stored in: " . "upload/" . $_FILES["file"]["name"]. "<br />";
	  
	  ///parsing start
	  
	  	  $filedb=substr($f321,7,60);
	  $dbstr=explode("_", $filedb);
	  echo $dbstr[0]."XX".$dbstr[1]."XX".$dbstr[2]."XX".$dbstr[3].$dbstr[4].$dbstr[5];
	  $filename=$filedb;
	  $po=$dbstr[1];
	  $type=$dbstr[2];
	  $press=$dbstr[0];
	  
	  
	  $contents = file($f321);
		$stringC = implode($contents);
		
		$fMark = strrpos($stringC,'i1Profiler');
		

		
/////////////////////////////////////////////////////////// i1 profiler  go 437
		 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'BEGIN_DATA_FORMAT');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
	$cols=46;	
$string = implode($contents);		
//$p = ereg_replace("\r\n?", "\n", $string);

$pp = str_replace("	\r", "\r", $string);
$pp = str_replace("\r", "	", $pp);
//$p = str_replace("\r\n", '	', $string);
//echo $pp;

function get_between ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strrpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}

$datastring=get_between($pp,"BEGIN_DATA","END_DATA");

//$dot = explode("\t", $datastring);



$dot = explode("_", $datastring);////Measure upload



//echo "dot".$dot[6]."<br>";
//print_r($dot);
$Pdot=0;

$PmX=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

$PmY=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

$PmZ=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$Pmd=DensitySp38("K",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);



//echo "take PX:".$PmX."_Y:".$PmY."_Z:".$PmZ;

$PL=xyz2lab01("l",$PmX,$PmY,$PmZ);
$Pa=xyz2lab01("a",$PmX,$PmY,$PmZ);
$Pb=xyz2lab01("b",$PmX,$PmY,$PmZ);

$RPL=95; $RPa=0.01;$RPb=-2;

//$depaper=sqrt(pow((95-$PL),2)+ pow((1-$Pa),2)+pow(((4)-$Pb),2));
//echo "Fogra39 M0 paper: L:".$RPL.",  a:".$RPa.",  b:".$RPb.  "<br />";
echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";
//echo "CRPC 6 Paper: 95	1	-4,<br> Cyan:56	-37	-50".", Magenta:48	75	-4".", Yellow:89	-4	93".", Black:16	0	0".  "<br />";




$RPCCl=55.1;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48.49;$RPCMa=74;$RPCMb=-3.1;
$RPCYl=89.11;$RPCYa=-4.96;$RPCYb=92.96;
$RPCKl=15.96;$RPCKa=0.1;$RPCKb=0.1;

$Xp=$PmX*100;
$Yp=$PmY*100;
$Zp=$PmZ*100;
//////////////////////////////////////////////////////////////
$scCL=$RPCCl;
$scCa=$RPCCa;
$scCb=$RPCCb;
/////////////////////////////////////////////////////////////

$scML=$RPCMl;
$scMa=$RPCMa;
$scMb=$RPCMb;
////////////////////////////////////////////////////////////////

$scYL=$RPCYl;
$scYa=$RPCYa;
$scYb=$RPCYb;
////////////////////////////////////////////////////////////////////

$scKL=$RPCKl;
$scKa=$RPCKa;
$scKb=$RPCKb;

echo "Fogra39  <br> Cyan L:".round($scCL,2)."  a:".round($scCa,2)."  b:".round($scCb,2)."<br>Magenta L:".round($scML,2)."  a:".round($scMa,2)."  b:".round($scMb,2)."<br>Yellow L:".round($scYL,2)."  a:".round($scYa,2)."  b:".round($scYb,2)."<br>Black L:".round($scKL,2)."  a:".round($scKa,2)."  b:".round($scKb,2).  "<br />";


?>


	<p><p>
	
	<table width="200" border="1" align="center">
  <tr>
  	<td><div align="center">主色</div></td>
	<td><font color="#aaaaaa">2%</td>
    <td><font color="#aaaaaa">5%</td>
    <td><font color="#aaaaaa">10%</td>
    <td><font color="#aaaaaa">15%</td>
    <td><font color="#aaaaaa">20%</td>
    <td><font color="#aaaaaa">25%</td>
    <td><font color="#666666">30%</td>
    <td><font color="#666666">35%</td>
    <td><font color="#666666">40%</td>
    <td><font color="#666666">45%</td>
    <td><font color="#666666">50%</td>
    <td><font color="#666666">55%</td>
    <td><font color="#666666">60%</td>
    <td><font color="#666666">65%</td>
    <td>70%</td>
    <td>75%</td>
    <td>80%</td>
    <td>85%</td>
    <td>90%</td>
    <td>95%</td>
	<td>關聯</td>
  </tr>
  


  <?php
  //////////////////////////////////////////////////Fogra Media Check
  $psum=20;
 // $pl=95; $pa=-0.01;$pb=-2;
  $cl=$scCL; $ca=$scCa;$cb=$scCb;
  $ml=$scML; $ma=$scMa;$mb=$scMb;
  $yl=$scYL; $ya=$scYa;$yb=$scYb;
  $kl=$scKL; $ka=$scKa;$kb=$scKb;
  
?>



<?php
//$TVI_c=round(($PX-$Xi)/($PX-$C100X)*100-$cmy,2);

$PX=lab2xyz("x",$RPL,$RPa,$RPb);
$PY=lab2xyz("y",$RPL,$RPa,$RPb);
$PZ=lab2xyz("z",$RPL,$RPa,$RPb);

$RC100X=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RC100Y=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RC100Z=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

$RM100X=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RM100Y=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RM100Z=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$RY100X=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RY100Y=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RY100Z=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$RK100X=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RK100Y=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RK100Z=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);
/////////////////////////////////////////////////////////

$RTVIc95x=lab2xyz("x",56.81,-35.25,-48.28);
$RTVIc90x=lab2xyz("x",58.65,-33.37,-46.4);
$RTVIc85x=lab2xyz("x",60.55,-31.32,-44.34);
$RTVIc80x=lab2xyz("x",62.55,-29.07,-42.07);
$RTVIc75x=lab2xyz("x",64.68,-26.83,-39.61);
$RTVIc70x=lab2xyz("x",66.86,-24.73,-37.1);
$RTVIc60x=lab2xyz("x",71.22,-20.44,-31.88);
$RTVIc50x=lab2xyz("x",75.62,-16.48,-26.7);
$RTVIc40x=lab2xyz("x",79.72,-12.53,-21.75);
$RTVIc30x=lab2xyz("x",83.89,-9.15,-16.55);
$RTVIc25x=lab2xyz("x",85.85,-7.49,-14.13);
$RTVIc20x=lab2xyz("x",87.68,-5.78,-11.8);
$RTVIc15x=lab2xyz("x",89.63,-4.4,-9.36);
$RTVIc10x=lab2xyz("x",91.48,-2.97,-6.96);
$RTVIc5x=lab2xyz("x",93.28,-1.5,-4.52);


$RTVIc95y=lab2xyz("y",56.81,-35.25,-48.28);
$RTVIc90y=lab2xyz("y",58.65,-33.37,-46.4);
$RTVIc85y=lab2xyz("y",60.55,-31.32,-44.34);
$RTVIc80y=lab2xyz("y",62.55,-29.07,-42.07);
$RTVIc75y=lab2xyz("y",64.68,-26.83,-39.61);
$RTVIc70y=lab2xyz("y",66.86,-24.73,-37.1);
$RTVIc60y=lab2xyz("y",71.22,-20.44,-31.88);
$RTVIc50y=lab2xyz("y",75.62,-16.48,-26.7);
$RTVIc40y=lab2xyz("y",79.72,-12.53,-21.75);
$RTVIc30y=lab2xyz("y",83.89,-9.15,-16.55);
$RTVIc25y=lab2xyz("y",85.85,-7.49,-14.13);
$RTVIc20y=lab2xyz("y",87.68,-5.78,-11.8);
$RTVIc15y=lab2xyz("y",89.63,-4.4,-9.36);
$RTVIc10y=lab2xyz("y",91.48,-2.97,-6.96);
$RTVIc5y=lab2xyz("y",93.28,-1.5,-4.52);


$RTVIc95z=lab2xyz("z",56.81,-35.25,-48.28);
$RTVIc90z=lab2xyz("z",58.65,-33.37,-46.4);
$RTVIc85z=lab2xyz("z",60.55,-31.32,-44.34);
$RTVIc80z=lab2xyz("z",62.55,-29.07,-42.07);
$RTVIc75z=lab2xyz("z",64.68,-26.83,-39.61);
$RTVIc70z=lab2xyz("z",66.86,-24.73,-37.1);
$RTVIc60z=lab2xyz("z",71.22,-20.44,-31.88);
$RTVIc50z=lab2xyz("z",75.62,-16.48,-26.7);
$RTVIc40z=lab2xyz("z",79.72,-12.53,-21.75);
$RTVIc30z=lab2xyz("z",83.89,-9.15,-16.55);
$RTVIc25z=lab2xyz("z",85.85,-7.49,-14.13);
$RTVIc20z=lab2xyz("z",87.68,-5.78,-11.8);
$RTVIc15z=lab2xyz("z",89.63,-4.4,-9.36);
$RTVIc10z=lab2xyz("z",91.48,-2.97,-6.96);
$RTVIc5z=lab2xyz("z",93.28,-1.5,-4.52);



////////////////////////////////////////////////////////////


for ( $i = 1; $i <= 19; $i += 1) {
${'RTVIc'.($i*5)}= ((($PX-0.55*$PZ)-(${'RTVIc'.($i*5).'x'}-0.55*${'RTVIc'.($i*5).'z'}))/(($PX-0.55*$PZ)-($RC100X-0.55*$RC100Z)))*100;
}
//echo "__c50TVI:".$RTVIc50;

//////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
$RTVIm95x=lab2xyz("x",49.69,70.97,-3.94);
$RTVIm90x=lab2xyz("x",51.5,67.62,-4.7);
$RTVIm85x=lab2xyz("x",53.5,63.84,-5.37);
$RTVIm80x=lab2xyz("x",55.8,59.52,-5.94);
$RTVIm75x=lab2xyz("x",58.32,54.99,-6.39);
$RTVIm70x=lab2xyz("x",60.84,50.59,-6.74);
$RTVIm60x=lab2xyz("x",66.01,41.96,-7.28);
$RTVIm50x=lab2xyz("x",71.23,33.64,-7.3);
$RTVIm40x=lab2xyz("x",76.42,25.78,-6.91);
$RTVIm30x=lab2xyz("x",81.39,18.7,-6.19);
$RTVIm25x=lab2xyz("x",83.8,15.34,-5.77);
$RTVIm20x=lab2xyz("x",86.18,12.01,-5.21);
$RTVIm15x=lab2xyz("x",88.45,8.91,-4.57);
$RTVIm10x=lab2xyz("x",90.67,5.9,-3.86);
$RTVIm5x=lab2xyz("x",92.86,2.93,-3.02);

//echo "m50x:".$RTVIm50x;

$RTVIm95y=lab2xyz("y",49.69,70.97,-3.94);
$RTVIm90y=lab2xyz("y",51.5,67.62,-4.7);
$RTVIm85y=lab2xyz("y",53.5,63.84,-5.37);
$RTVIm80y=lab2xyz("y",55.8,59.52,-5.94);
$RTVIm75y=lab2xyz("y",58.32,54.99,-6.39);
$RTVIm70y=lab2xyz("y",60.84,50.59,-6.74);
$RTVIm60y=lab2xyz("y",66.01,41.96,-7.28);
$RTVIm50y=lab2xyz("y",71.23,33.64,-7.3);
$RTVIm40y=lab2xyz("y",76.42,25.78,-6.91);
$RTVIm30y=lab2xyz("y",81.39,18.7,-6.19);
$RTVIm25y=lab2xyz("y",83.8,15.34,-5.77);
$RTVIm20y=lab2xyz("y",86.18,12.01,-5.21);
$RTVIm15y=lab2xyz("y",88.45,8.91,-4.57);
$RTVIm10y=lab2xyz("y",90.67,5.9,-3.86);
$RTVIm5y=lab2xyz("y",92.86,2.93,-3.02);
//echo "__m50y:".$RTVIm50y;
$RTVIm95z=lab2xyz("z",49.69,70.97,-3.94);
$RTVIm90z=lab2xyz("z",51.5,67.62,-4.7);
$RTVIm85z=lab2xyz("z",53.5,63.84,-5.37);
$RTVIm80z=lab2xyz("z",55.8,59.52,-5.94);
$RTVIm75z=lab2xyz("z",58.32,54.99,-6.39);
$RTVIm70z=lab2xyz("z",60.84,50.59,-6.74);
$RTVIm60z=lab2xyz("z",66.01,41.96,-7.28);
$RTVIm50z=lab2xyz("z",71.23,33.64,-7.3);
$RTVIm40z=lab2xyz("z",76.42,25.78,-6.91);
$RTVIm30z=lab2xyz("z",81.39,18.7,-6.19);
$RTVIm25z=lab2xyz("z",83.8,15.34,-5.77);
$RTVIm20z=lab2xyz("z",86.18,12.01,-5.21);
$RTVIm15z=lab2xyz("z",88.45,8.91,-4.57);
$RTVIm10z=lab2xyz("z",90.67,5.9,-3.86);
$RTVIm5z=lab2xyz("z",92.86,2.93,-3.02);
//echo "__m50z:".$RTVIm50z;


////////////////////////////////////////////////////////////



for ( $i = 1; $i <= 19; $i += 1) {
${'RTVIm'.($i*5)}= ((($PY-${'RTVIm'.($i*5).'y'})/($PY- $RM100Y))*100);   
}

//echo "__m50TVI:".$RTVIm50;

//////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
$RTVIy95x=lab2xyz("x",89.18,-5,88.44);
$RTVIy90x=lab2xyz("x",89.34,-5,83.76);
$RTVIy85x=lab2xyz("x",89.52,-4.95,78.84);
$RTVIy80x=lab2xyz("x",89.73,-4.82,73.52);
$RTVIy75x=lab2xyz("x",90.02,-4.75,67.99);
$RTVIy70x=lab2xyz("x",90.34,-4.7,62.56);
$RTVIy60x=lab2xyz("x",90.92,-4.39,51.51);
$RTVIy50x=lab2xyz("x",91.55,-4,41);
$RTVIy40x=lab2xyz("x",92.19,-3.47,31.15);
$RTVIy30x=lab2xyz("x",92.97,-2.61,22.02);
$RTVIy25x=lab2xyz("x",93.32,-2.13,17.61);
$RTVIy20x=lab2xyz("x",93.62,-1.62,13.27);
$RTVIy15x=lab2xyz("x",93.98,-1.31,9.31);
$RTVIy10x=lab2xyz("x",94.34,-0.94,5.42);
$RTVIy5x=lab2xyz("x",94.69,-0.5,1.64);

$RTVIy95y=lab2xyz("y",89.18,-5,88.44);
$RTVIy90y=lab2xyz("y",89.34,-5,83.76);
$RTVIy85y=lab2xyz("y",89.52,-4.95,78.84);
$RTVIy80y=lab2xyz("y",89.73,-4.82,73.52);
$RTVIy75y=lab2xyz("y",90.02,-4.75,67.99);
$RTVIy70y=lab2xyz("y",90.34,-4.7,62.56);
$RTVIy60y=lab2xyz("y",90.92,-4.39,51.51);
$RTVIy50y=lab2xyz("y",91.55,-4,41);
$RTVIy40y=lab2xyz("y",92.19,-3.47,31.15);
$RTVIy30y=lab2xyz("y",92.97,-2.61,22.02);
$RTVIy25y=lab2xyz("y",93.32,-2.13,17.61);
$RTVIy20y=lab2xyz("y",93.62,-1.62,13.27);
$RTVIy15y=lab2xyz("y",93.98,-1.31,9.31);
$RTVIy10y=lab2xyz("y",94.34,-0.94,5.42);
$RTVIy5y=lab2xyz("y",94.69,-0.5,1.64);

$RTVIy95z=lab2xyz("z",89.18,-5,88.44);
$RTVIy90z=lab2xyz("z",89.34,-5,83.76);
$RTVIy85z=lab2xyz("z",89.52,-4.95,78.84);
$RTVIy80z=lab2xyz("z",89.73,-4.82,73.52);
$RTVIy75z=lab2xyz("z",90.02,-4.75,67.99);
$RTVIy70z=lab2xyz("z",90.34,-4.7,62.56);
$RTVIy60z=lab2xyz("z",90.92,-4.39,51.51);
$RTVIy50z=lab2xyz("z",91.55,-4,41);
$RTVIy40z=lab2xyz("z",92.19,-3.47,31.15);
$RTVIy30z=lab2xyz("z",92.97,-2.61,22.02);
$RTVIy25z=lab2xyz("z",93.32,-2.13,17.61);
$RTVIy20z=lab2xyz("z",93.62,-1.62,13.27);
$RTVIy15z=lab2xyz("z",93.98,-1.31,9.31);
$RTVIy10z=lab2xyz("z",94.34,-0.94,5.42);
$RTVIy5z=lab2xyz("z",94.69,-0.5,1.64);


////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////////////////////////////
for ( $i = 1; $i <= 19; $i += 1) {
${'RTVIy'.($i*5)}= ((($PZ-${'RTVIy'.($i*5).'z'})/($PZ- $RY100Z))*100);   
}

//echo "__y50TVI:".$RTVIy50;


/////////////////////////////////////////////////////////

$RTVIk95x=lab2xyz("x",21.46,0.1,-0.14);
$RTVIk90x=lab2xyz("x",26.69,0.1,-0.27);
$RTVIk85x=lab2xyz("x",31.72,0.1,-0.4);
$RTVIk80x=lab2xyz("x",36.62,0.1,-0.52);
$RTVIk75x=lab2xyz("x",41.11,0.1,-0.64);
$RTVIk70x=lab2xyz("x",45.53,0.1,-0.75);
$RTVIk60x=lab2xyz("x",54.14,0.1,-0.97);
$RTVIk50x=lab2xyz("x",61.82,0.1,-1.16);
$RTVIk40x=lab2xyz("x",69.28,0.1,-1.35);
$RTVIk30x=lab2xyz("x",76.12,0.1,-1.52);
$RTVIk25x=lab2xyz("x",79.47,0.1,-1.61);
$RTVIk20x=lab2xyz("x",82.79,0.1,-1.69);
$RTVIk15x=lab2xyz("x",85.89,0.1,-1.77);
$RTVIk10x=lab2xyz("x",88.97,0.1,-1.85);
$RTVIk5x=lab2xyz("x",92.03,0.1,-1.92);

$RTVIk95y=lab2xyz("y",21.46,0.1,-0.14);
$RTVIk90y=lab2xyz("y",26.69,0.1,-0.27);
$RTVIk85y=lab2xyz("y",31.72,0.1,-0.4);
$RTVIk80y=lab2xyz("y",36.62,0.1,-0.52);
$RTVIk75y=lab2xyz("y",41.11,0.1,-0.64);
$RTVIk70y=lab2xyz("y",45.53,0.1,-0.75);
$RTVIk60y=lab2xyz("y",54.14,0.1,-0.97);
$RTVIk50y=lab2xyz("y",61.82,0.1,-1.16);
$RTVIk40y=lab2xyz("y",69.28,0.1,-1.35);
$RTVIk30y=lab2xyz("y",76.12,0.1,-1.52);
$RTVIk25y=lab2xyz("y",79.47,0.1,-1.61);
$RTVIk20y=lab2xyz("y",82.79,0.1,-1.69);
$RTVIk15y=lab2xyz("y",85.89,0.1,-1.77);
$RTVIk10y=lab2xyz("y",88.97,0.1,-1.85);
$RTVIk5y=lab2xyz("y",92.03,0.1,-1.92);

$RTVIk95z=lab2xyz("z",21.46,0.1,-0.14);
$RTVIk90z=lab2xyz("z",26.69,0.1,-0.27);
$RTVIk85z=lab2xyz("z",31.72,0.1,-0.4);
$RTVIk80z=lab2xyz("z",36.62,0.1,-0.52);
$RTVIk75z=lab2xyz("z",41.11,0.1,-0.64);
$RTVIk70z=lab2xyz("z",45.53,0.1,-0.75);
$RTVIk60z=lab2xyz("z",54.14,0.1,-0.97);
$RTVIk50z=lab2xyz("z",61.82,0.1,-1.16);
$RTVIk40z=lab2xyz("z",69.28,0.1,-1.35);
$RTVIk30z=lab2xyz("z",76.12,0.1,-1.52);
$RTVIk25z=lab2xyz("z",79.47,0.1,-1.61);
$RTVIk20z=lab2xyz("z",82.79,0.1,-1.69);
$RTVIk15z=lab2xyz("z",85.89,0.1,-1.77);
$RTVIk10z=lab2xyz("z",88.97,0.1,-1.85);
$RTVIk5z=lab2xyz("z",92.03,0.1,-1.92);

////////////////////////////////////////////////////////////

for ( $i = 1; $i <= 19; $i += 1) {
${'RTVIk'.($i*5)}= ((($PY-${'RTVIk'.($i*5).'y'})/($PY- $RK100Z))*100);   
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////get measured 
/////////////////////////////////////////

$Pdot=1;  
 $c2X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$c2Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$c2Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$c2l=xyz2lab01("l",$c2X,$c2Y,$c2Z);
	$c2a=xyz2lab01("a",$c2X,$c2Y,$c2Z);
	$c2b=xyz2lab01("b",$c2X,$c2Y,$c2Z);
	
	$c2d=DensitySp38("C",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	


for ( $i = 2; $i <= 20; $i += 1) {
$Pdot=$i;  
 ${'c'.$i.'X'}=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	${'c'.$i.'Y'}=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	${'c'.$i.'Z'}=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);	

	${'c'.(($i-1)*5).'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	${'c'.(($i-1)*5).'d'}=DensitySp38("C",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	//echo "tviC:".${'RTVIc'.($i*5)}."zz";
;}
 
 $Pdot=23;  
 $m2X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$m2Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$m2Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$m2l=xyz2lab01("l",$m2X,$m2Y,$m2Z);
	$m2a=xyz2lab01("a",$m2X,$m2Y,$m2Z);
	$m2b=xyz2lab01("b",$m2X,$m2Y,$m2Z);
	
	$m2d=DensitySp38("M",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
 
 
for ( $i = 24; $i <= 42; $i += 1) {
$Pdot=$i;  $j=($i-23)*5;
 ${'m'.($j).'X'}=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

 //echo "<br>mix:".${'m'.($j).'X'};
 
	${'m'.($j).'Y'}=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	${'m'.($j).'Z'}=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);	

	${'m'.($j).'l'}=xyz2lab01("l",${'m'.$j.'X'},${'m'.$j.'Y'},${'m'.$j.'Z'});
	${'m'.($j).'a'}=xyz2lab01("a",${'m'.$j.'X'},${'m'.$j.'Y'},${'m'.$j.'Z'});
	${'m'.($j).'b'}=xyz2lab01("b",${'m'.$j.'X'},${'m'.$j.'Y'},${'m'.$j.'Z'});
	//echo "tviM:".${'RTVIc'.($i*5)}."zz";
;}

 $Pdot=45;  
 $y2X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$y2Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$y2Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$y2l=xyz2lab01("l",$y2X,$y2Y,$y2Z);
	$y2a=xyz2lab01("a",$y2X,$y2Y,$y2Z);
	$y2b=xyz2lab01("b",$y2X,$y2Y,$y2Z);
	
	$y2d=DensitySp38("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
 

for ( $i = 46; $i <= 64; $i += 1) {
$Pdot=$i;  $j=($i-45)*5;
 ${'y'.($j).'X'}=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

 //echo "<br>miy:".${'y'.($j).'X'};
 
	${'y'.($j).'Y'}=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	${'y'.($j).'Z'}=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);	

	${'y'.($j).'l'}=xyz2lab01("l",${'y'.$j.'X'},${'y'.$j.'Y'},${'y'.$j.'Z'});
	${'y'.($j).'a'}=xyz2lab01("a",${'y'.$j.'X'},${'y'.$j.'Y'},${'y'.$j.'Z'});
	${'y'.($j).'b'}=xyz2lab01("b",${'y'.$j.'X'},${'y'.$j.'Y'},${'y'.$j.'Z'});
	//echo "tviM:".${'RTVIc'.($i*5)}."zz";
;}
 
 $Pdot=67;  
 $k2X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$k2Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$k2Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$k2l=xyz2lab01("l",$k2X,$k2Y,$k2Z);
	$k2a=xyz2lab01("a",$k2X,$k2Y,$k2Z);
	$k2b=xyz2lab01("b",$k2X,$k2Y,$k2Z);
	
	$k2d=DensitySp38("K",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
 
for ( $i = 68; $i <= 86; $i += 1) {
$Pdot=$i;  $j=($i-67)*5;
 ${'k'.($j).'X'}=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

 //echo "<br>kix:".${'k'.($j).'X'};
 
	${'k'.($j).'Y'}=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	${'k'.($j).'Z'}=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);	

	${'k'.($j).'l'}=xyz2lab01("l",${'k'.$j.'X'},${'k'.$j.'Y'},${'k'.$j.'Z'});
	${'k'.($j).'a'}=xyz2lab01("a",${'k'.$j.'X'},${'k'.$j.'Y'},${'k'.$j.'Z'});
	${'k'.($j).'b'}=xyz2lab01("b",${'k'.$j.'X'},${'k'.$j.'Y'},${'k'.$j.'Z'});
	//echo "tviM:".${'RTVIc'.($i*5)}."zz";
;}
$TVIk5x=lab2xyz("x",$c5l,$c5a,$c5b);
$TVIk5y=lab2xyz("y",$c5l,$c5b,$c5b);
$TVIc95zz=lab2xyz("z",$c95l,$c95a,$c95b);
 
 for ( $t = 5; $t <= 95; $t += 5) {
 ${'TVIc'.($t).'x'}=lab2xyz("x",${'c'.$t.'l'},${'c'.$t.'a'},${'c'.$t.'b'}); //TVIc5x;    c5l;
 ${'TVIc'.($t).'y'}=lab2xyz("y",${'c'.$t.'l'},${'c'.$t.'a'},${'c'.$t.'b'});
 ${'TVIc'.($t).'z'}=lab2xyz("z",${'c'.$t.'l'},${'c'.$t.'a'},${'c'.$t.'b'}); 
 }
 
 for ( $t = 5; $t <= 95; $t += 5) {
 ${'TVIm'.($t).'x'}=lab2xyz("x",${'m'.$t.'l'},${'m'.$t.'a'},${'m'.$t.'b'});
 ${'TVIm'.($t).'y'}=lab2xyz("y",${'m'.$t.'l'},${'m'.$t.'a'},${'m'.$t.'b'});
 ${'TVIm'.($t).'z'}=lab2xyz("z",${'m'.$t.'l'},${'m'.$t.'a'},${'m'.$t.'b'}); 
 }
 
 for ( $t = 5; $t <= 95; $t += 5) {
 ${'TVIy'.($t).'x'}=lab2xyz("x",${'y'.$t.'l'},${'y'.$t.'a'},${'y'.$t.'b'});
 ${'TVIy'.($t).'y'}=lab2xyz("y",${'y'.$t.'l'},${'y'.$t.'a'},${'y'.$t.'b'});
 ${'TVIy'.($t).'z'}=lab2xyz("z",${'y'.$t.'l'},${'y'.$t.'a'},${'y'.$t.'b'}); 
 }
 
 for ( $t = 5; $t <= 95; $t += 5) {
 ${'TVIk'.($t).'x'}=lab2xyz("x",${'k'.$t.'l'},${'k'.$t.'a'},${'k'.$t.'b'});
 ${'TVIk'.($t).'y'}=lab2xyz("y",${'k'.$t.'l'},${'k'.$t.'a'},${'k'.$t.'b'});
 ${'TVIk'.($t).'z'}=lab2xyz("z",${'k'.$t.'l'},${'k'.$t.'a'},${'k'.$t.'b'}); 
 }
 


$Pdot=21;
	$C100X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$C100Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$C100Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$c100l=xyz2lab01("l",$C100X,$C100Y,$C100Z);
	$c100a=xyz2lab01("a",$C100X,$C100Y,$C100Z);
	$c100b=xyz2lab01("b",$C100X,$C100Y,$C100Z);
	
	
	$c100d=DensitySp38("C",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
//echo "<br>c100d".$c100d."-dot20<br>";
/////////////////////////////////////m sec

$Pdot=43;
	$M100X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$M100Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$M100Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$m100l=xyz2lab01("l",$M100X,$M100Y,$M100Z);
	$m100a=xyz2lab01("a",$M100X,$M100Y,$M100Z);
	$m100b=xyz2lab01("b",$M100X,$M100Y,$M100Z);
	
	$m100d=DensitySp38("M",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
//echo "<br>m100d".$m100d."-dot20<br>";


$Pdot=65;
	$Y100X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$Y100Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$Y100Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$y100l=xyz2lab01("l",$Y100X,$Y100Y,$Y100Z);
	$y100a=xyz2lab01("a",$Y100X,$Y100Y,$Y100Z);
	$y100b=xyz2lab01("b",$Y100X,$Y100Y,$Y100Z);
	
		$y100d=DensitySp38("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
//echo "<br>y100d".$y100d."-dot20<br>";


	$Pdot=87;
	$K100X=sp38XYZ("X",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$K100Y=sp38XYZ("Y",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);

	$K100Z=sp38XYZ("Z",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
	
	$k100l=xyz2lab01("l",$K100X,$K100Y,$K100Z);
	$k100a=xyz2lab01("a",$K100X,$K100Y,$K100Z);
	$k100b=xyz2lab01("b",$K100X,$K100Y,$K100Z);
	

	$k100d=DensitySp38("K",$dot[11+$cols*$Pdot],$dot[11+$cols*$Pdot+1],$dot[11+$cols*$Pdot+2],$dot[11+$cols*$Pdot+3],$dot[11+$cols*$Pdot+4],$dot[11+$cols*$Pdot+5],$dot[11+$cols*$Pdot+6],$dot[11+$cols*$Pdot+7],$dot[11+$cols*$Pdot+8],$dot[11+$cols*$Pdot+9],$dot[11+$cols*$Pdot+10],$dot[11+$cols*$Pdot+11],$dot[11+$cols*$Pdot+12],$dot[11+$cols*$Pdot+13],$dot[11+$cols*$Pdot+14],$dot[11+$cols*$Pdot+15],$dot[11+$cols*$Pdot+16],$dot[11+$cols*$Pdot+17],$dot[11+$cols*$Pdot+18],$dot[11+$cols*$Pdot+19],$dot[11+$cols*$Pdot+20],$dot[11+$cols*$Pdot+21],$dot[11+$cols*$Pdot+22],$dot[11+$cols*$Pdot+23],$dot[11+$cols*$Pdot+24],$dot[11+$cols*$Pdot+25],$dot[11+$cols*$Pdot+26],$dot[11+$cols*$Pdot+27],$dot[11+$cols*$Pdot+28],$dot[11+$cols*$Pdot+29],$dot[11+$cols*$Pdot+30],$dot[11+$cols*$Pdot+31],$dot[11+$cols*$Pdot+32],$dot[11+$cols*$Pdot+33],$dot[11+$cols*$Pdot+34],$dot[11+$cols*$Pdot+35]);
//echo "<br>k100d".$k100d."-dot20<br>";
 //$RTVIc5=((($PX-0.55*$PZ)-($RTVIc5x-0.55*$RTVIc5z))/(($PX-0.55*$PZ)-($RC100X-0.55*$RC100Z)))*100; TVIc
 $TVIc95s=((($Xp-0.55*$Zp)-($TVIc95x-0.55*$TVIc95z))/(($Xp-0.55*$Zp)-($C100X*100-0.55*$C100Z*100)))*100;
 //echo "<br>PX=".($PmX*100)."--Xp=".$TVIm5x."____"."tvic95s:".$TVIc95s."<br>";
 
 
for ( $t = 5; $t <= 95; $t += 5) {
${'TVIc'.$t}=((($Xp-0.55*$Zp)-(${'TVIc'.$t.'x'}-0.55*${'TVIc'.$t.'z'}))/(($Xp-0.55*$Zp)-($C100X*100-0.55*$C100Z*100)))*100;
 }
 
for ( $t = 5; $t <= 95; $t += 5) {
${'TVIm'.$t}=((($Yp-${'TVIm'.($t).'y'})/($Yp- $M100Y*100))*100);   
 } 
 
for ( $t = 5; $t <= 95; $t += 5) {
${'TVIy'.$t}=((($Zp-${'TVIy'.($t).'z'})/($Zp- $Y100Z*100))*100);   
 }  
 
 $TVIy40=($TVIy45+$TVIy35)/2;
 
for ( $t = 5; $t <= 95; $t += 5) {
${'TVIk'.$t}=((($Yp-${'TVIk'.($t).'y'})/($Yp- $K100Z*100))*100);    
 }   
 



?>
<tr>
<td bgcolor="#bbFFFF"><div align="center">C</div></td>
<td bgcolor="#bbFFFF"><div align="center"><?php echo ($c2d-$Pmd);?></div></td>
<?php  //////////////////////////////////////////C
for ( $t = 5; $t <= 95; $t += 5) {
//
?><td bgcolor="#bbFFFF"><div align="right"><?php
	if ($t==35) {$rounddv=0;}
	elseif ($t==45) {$rounddv=0;}
	elseif ($t==55) {$rounddv=0;}
	elseif ($t==65) {$rounddv=0;}
	else {$rounddv=${'TVIc'.$t}-${'RTVIc'.$t};}
	
		if ($t<=25 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>25 and abs($rounddv)>4.5){
	$check=1;$sum=$sum-abs($rounddv);;?><font color="red"><div align="right"><?php
	}
	elseif ($t>65 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);;?><font color="red"><div align="right"><?php
	}
	${'cSpread'.$t}=$rounddv;
	${'c'.$t}=round(${'TVIc'.$t},2);
	echo round($rounddv,2);
	$sum=$sum-abs($rounddv);
	?> </td><?php
	}
	?>
	<td bgcolor="#bbFFFF"><div align="center"><a href="../FograPC10/rankL.php?tvifile=5049-JSPlate1.txt&color=C&c5=<?php echo $c5;?>&c10=<?php echo $c10;?>&c15=<?php echo $c15;?>&c20=<?php echo $c20;?>&c25=<?php echo $c25;?>&c30=<?php echo $c30;?>&c35=<?php echo $c35;?>&c40=<?php echo $c40;?>&c45=<?php echo $c45;?>&c50=<?php echo $c50;?>&c55=<?php echo $c55;?>&c60=<?php echo $c60;?>&c65=<?php echo $c65;?>&c70=<?php echo $c70;?>&c75=<?php echo $c75;?>&c80=<?php echo $c80;?>&c85=<?php echo $c85;?>&c90=<?php echo $c90;?>&c95=<?php echo $c95;?>">
	 <?php  echo "Plate";?>  </a></div></td>	
</tr>

<tr>
<td bgcolor="#FFccFF"><div align="center">M</div></td>
<td bgcolor="#FFccFF"><div align="center"><?php echo ($m2d-$Pmd);?></div></td>
<?php //////////////////////////////////////////////M
for ( $t = 5; $t <= 95; $t += 5) {
//
?><td bgcolor="#FFccFF"><div align="right"><?php
	if ($t==35) {$rounddv=0;}
	elseif ($t==45) {$rounddv=0;}
	elseif ($t==55) {$rounddv=0;}
	elseif ($t==65) {$rounddv=0;}
	else {$rounddv=${'TVIm'.$t}-${'RTVIm'.$t};}
	
		if ($t<=25 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>25 and abs($rounddv)>4.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>65 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	${'mSpread'.$t}=$rounddv;
	${'c'.$t}=round(${'TVIm'.$t},2);
	echo round($rounddv,2);
	$sum=$sum-abs($rounddv);
	?> </td><?php
	}
	?>
	<td bgcolor="#bbFFFF"><div align="center"><a href="../FograPC10/rankL.php?tvifile=5049-JSPlate1.txt&color=M&c5=<?php echo $c5;?>&c10=<?php echo $c10;?>&c15=<?php echo $c15;?>&c20=<?php echo $c20;?>&c25=<?php echo $c25;?>&c30=<?php echo $c30;?>&c35=<?php echo $c35;?>&c40=<?php echo $c40;?>&c45=<?php echo $c45;?>&c50=<?php echo $c50;?>&c55=<?php echo $c55;?>&c60=<?php echo $c60;?>&c65=<?php echo $c65;?>&c70=<?php echo $c70;?>&c75=<?php echo $c75;?>&c80=<?php echo $c80;?>&c85=<?php echo $c85;?>&c90=<?php echo $c90;?>&c95=<?php echo $c95;?>">
	 <?php  echo "Plate";?>  </a></div></td>	
</tr>

<tr>
<td bgcolor="#FFFFbb"><div align="center">Y</div></td>
<td bgcolor="#FFFFbb"><div align="center"><?php echo ($y2d-$Pmd);?></div></td>
<?php //////////////////////////////////////////////M
for ( $t = 5; $t <= 95; $t += 5) {
//
?><td bgcolor="#FFFFbb"><div align="right"><?php
	if ($t==35) {$rounddv=0;}
	elseif ($t==45) {$rounddv=0;}
	elseif ($t==55) {$rounddv=0;}
	elseif ($t==65) {$rounddv=0;}
	else {$rounddv=${'TVIy'.$t}-${'RTVIy'.$t};}
	
	if ($t<=25 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>25 and abs($rounddv)>4.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>65 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	
	${'ySpread'.$t}=$rounddv;
	${'c'.$t}=round(${'TVIy'.$t},2);
	echo round($rounddv,2);
	$sum=$sum-abs($rounddv);
	?> </td><?php
	}
	?>
	<td bgcolor="#bbFFFF"><div align="center"><a href="../FograPC10/rankL.php?tvifile=5049-JSPlate1.txt&color=Y&c5=<?php echo $c5;?>&c10=<?php echo $c10;?>&c15=<?php echo $c15;?>&c20=<?php echo $c20;?>&c25=<?php echo $c25;?>&c30=<?php echo $c30;?>&c35=<?php echo $c35;?>&c40=<?php echo $c40;?>&c45=<?php echo $c45;?>&c50=<?php echo $c50;?>&c55=<?php echo $c55;?>&c60=<?php echo $c60;?>&c65=<?php echo $c65;?>&c70=<?php echo $c70;?>&c75=<?php echo $c75;?>&c80=<?php echo $c80;?>&c85=<?php echo $c85;?>&c90=<?php echo $c90;?>&c95=<?php echo $c95;?>">
	 <?php  echo "Plate";?>  </a></div></td>	
</tr>

<tr>
<td bgcolor="#DDDDDD"><div align="center">K</div></td>
<td bgcolor="#DDDDDD"><div align="center"><?php echo ($k2d-$Pmd);?></div></td>
<?php //////////////////////////////////////////////M
for ( $t = 5; $t <= 95; $t += 5) {
//
?><td bgcolor="#DDDDDD"><div align="right"><?php
	if ($t==35) {$rounddv=0;}
	elseif ($t==45) {$rounddv=0;}
	elseif ($t==55) {$rounddv=0;}
	elseif ($t==65) {$rounddv=0;}
	else {$rounddv=${'TVIk'.$t}-${'RTVIk'.$t};}
	
		if ($t<=25 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>25 and abs($rounddv)>4.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	elseif ($t>65 and abs($rounddv)>3.5){
	$check=1;$sum=$sum-abs($rounddv);?><font color="red"><div align="right"><?php
	}
	${'kSpread'.$t}=$rounddv;
	${'c'.$t}=round(${'TVIk'.$t},2);
	echo round($rounddv,2);
	$sum=$sum-abs($rounddv);
	?> </td><?php
	}
	?>
	<td bgcolor="#bbFFFF"><div align="center"><a href="../FograPC10/rankL.php?tvifile=5049-JSPlate1.txt&color=K&c5=<?php echo $c5;?>&c10=<?php echo $c10;?>&c15=<?php echo $c15;?>&c20=<?php echo $c20;?>&c25=<?php echo $c25;?>&c30=<?php echo $c30;?>&c35=<?php echo $c35;?>&c40=<?php echo $c40;?>&c45=<?php echo $c45;?>&c50=<?php echo $c50;?>&c55=<?php echo $c55;?>&c60=<?php echo $c60;?>&c65=<?php echo $c65;?>&c70=<?php echo $c70;?>&c75=<?php echo $c75;?>&c80=<?php echo $c80;?>&c85=<?php echo $c85;?>&c90=<?php echo $c90;?>&c95=<?php echo $c95;?>">
	 <?php  echo "Plate";?>  </a></div></td>	
</tr>

	<tr>
  <td bgcolor="#D5CCCC"><div align="center">CMY</div></td>
  <td>
  <?php
  
  for ( $s = 5; $s <= 95; $s += 5) {
  $vc=${"cSpread".$s}; 
  $vm=${"mSpread".$s};
  $vy=${"ySpread".$s};
  //$ecc=${$vc};
 // echo ";".$vy;
  $scmy=max(abs($vc-$vm),abs($vy-$vm),abs($vc-$vy))
?><td bgcolor="#D5CCCC"><div align="right"><?php 
if ($scmy>5){
$check=1;?><font color="red"><?php
}
echo round($scmy,2);?> </div></td><?php 
}///cmy loop
?> </tr> 
	<tr>
<td><div align="center"> </div></td>
<td><div align="right"> </div></td>
<td><div align="right"> </div></td>
<td><div align="right"> </div></td>
<td><div align="center"> </div></td>
<td><div align="right"> </div></td>
<td><div align="right"> </div></td>
<td><div align="right"> </div></td>
<td><div align="right"> </div></td>
</tr>
<?php
function de76($l1,$a1,$b1,$l2,$a2,$b2) {
 $d76=sqrt(pow(($l1-$l2),2)+ pow(($a1-$a2),2)+pow(($b1-$b2),2));
return $d76;	

}

	# ------- The graph values in the form of associative array
	function de00($l1,$a1,$b1,$l2,$a2,$b2) {
  $d76=sqrt(pow(($l1-$l2),2)+ pow(($a1-$a2),2)+pow(($b1-$b2),2));
    $cab1 = sqrt(pow($a1,2) + pow($b1,2));
    $cab2 =  sqrt(pow($a2,2) + pow($b2,2));
	
	 
	
    $meanc = ($cab1 + $cab2) / 2;
	
    $logmeanc =log10($meanc);
	
    $log25 = log10(25);
	$cratio = sqrt(pow(10,($logmeanc*7 - log10((pow(10,($logmeanc*7)) + pow(10,($log25*7)))))));
	
    $g = 0.5 * (1 - $cratio);
	
	$a1 = (1 + $g) * $a1;
    $a2 = (1 + $g) * $a2;
	
	$cab1 = pow((pow($a1 , 2)+ pow($b1 , 2) ),0.5);
    $cab2 = pow((pow($a2 , 2) + pow($b2 , 2) ),0.5);
	$deltac = $cab1 - $cab2;
	
	
	 //   ' calculate delta L*
    $deltal = $l1 - $l2;
	 
	//';calculate hue angles
    If ($b1 == 0) {
        If ($a1 >= 0) {
            $h1 = 0;}
        Else {
            $h1 = 180;}}
	Else {
        $h1 = rad2deg(atan2($b1, $a1));
    } 
       
	
	
    If ($b2 == 0) {
        If ($a2 >= 0) {
            $h2 = 0;}
        Else {
            $h2 = 180; }
        }
    Else {
        $h2 = rad2deg(atan2($b2, $a2));
    }
	
    If ($h1 < 0) {
        $h1 = $h1 + 360;}
       
    If ($h2 < 0) {
        $h2 = $h2 + 360;}
    
	//    ' calculate delta h and mean h
    $deltah = $h1 - $h2;
    $meanh = $h1 + $h2;
		


    If ($deltah > 180) {
        $deltah = $deltah - 360;
        $meanh = $meanh - 360;
    }
    
    If ($deltah < -180) {
        $deltah = $deltah + 360;
        $meanh = $meanh - 360;
    }

    $delth = 2 * pow(($cab1 * $cab2),0.5) * sin(deg2rad($deltah / 2));
 
    $deltal = $l1 - $l2;
    $deltaE = pow((pow($deltal,2) + pow($deltac,2) + pow($delth,2)),0.5);

    $deltaha = pow($deltaE , 2)- pow($deltal , 2) - pow($deltac , 2);

    If ($deltaha < 0) {
        $deltaha = 0;
    }
    
    $delth = pow($deltaha , 0.5);
    $delth = 2 * pow(($cab1 * $cab2),0.5) * sin(deg2rad($deltah / 2));
   	 	
    $meanl = ($l1 + $l2) / 2;
    $meanc = ($cab1 + $cab2) / 2;
    $meanh = $meanh / 2;


//' Computes the weighting functions.

    $sl = 1 + ((0.015 * pow(($meanl - 50),2)) / pow((20 + pow(($meanl - 50),2)),0.5));
    $sc = 1 + 0.045 * $meanc;

//' find the hue angle goodness
 //   ' split these up because I don't know how to split lines in vb
    $t1 = 1 - 0.17 * cos(deg2rad($meanh - 30));
    $t2 = 0.24 * cos(deg2rad(2 * $meanh));
    $t3 = 0.32 * cos(deg2rad(3 * $meanh + 6));
    $t4 = -0.2 * cos(deg2rad(4 * $meanh - 63));
    $t = $t1 + $t2 + $t3 + $t4;
    
    $sh = 1 + 0.015 * $meanc * $t;
    $sr = $sc * $sh;
  //same problem as above with the big numbers
    $logmeanc = log10($meanc);
    $log25 =log10(25);
    $rc_numerator = pow(10 , ($logmeanc * 7));
    $rc_denominator = $rc_numerator + pow(10 , ($log25 * 7));
    $rc = 2 * pow(($rc_numerator / $rc_denominator) , 0.5);
	
    $dthet = 30 * exp(-1 * pow((($meanh - 275) / 25) , 2));
    $rt = -sin(2 * deg2rad($dthet)) * $rc;	
	
	// ' Now computes deltaV
    $vl = pow(($deltal / $sl) , 2);
    $vc = pow(($deltac / $sc) , 2);
    $vh = pow(($delth / $sh) , 2);

    $deltaE2000 = pow(($vl + $vc + $vh + ($rt * $deltac * $delth / $sr)) , 0.5);
	return $deltaE2000;	
	//$deltaE2000=12.233;
  //return round($d76,2);
  //return $cab1;
}
/////////////////////////////////////////////////
 $pa00=de00($RPL,$RPa,$RPb,$PL,$Pa,$Pb);
 ?>
<tr><td><div align="center"></div></td>
<td><div align="right">L</div></td>
<td><div align="right">a</div></td>
<td><div align="right">b</div></td>
<td><div align="center">量測</div></td>
<td><div align="right">L</div></td>
<td><div align="right">a</div></td>
<td><div align="right">b</td>
<td><div align="right">de</div></td>
<td><div align="right">density</div></td></tr>

<?php

 $dc00=de76($cl,$ca,$cb,$c100l,$c100a,$c100b);
 $dm00=de76($ml,$ma,$mb,$m100l,$m100a,$m100b);
 $dy00=de76($yl,$ya,$yb,$y100l,$y100a,$y100b);
 $dk00=de76($kl,$ka,$kb,$k100l,$k100a,$k100b);
 ?>

<tr><td><div align="center">W</div></td>
<td><div align="right"><?php echo $RPL;?></div></td>
<td><div align="right"><?php echo $RPa;?></div></td>
<td><div align="right"><?php echo $RPb;?></div></td>
<td><div align="center"></div></td>
<td><div align="right"><?php echo $PL;?></div></td>
<td><div align="right"><?php echo $Pa;?></div></td>
<td><div align="right"><?php echo $Pb;?></div></td>
<td><div align="right"><?php echo round($pa00,2);?></div></td></tr>

<tr><td bgcolor="#bbFFFF"><div align="center">C</div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php echo round($cl,2);?></div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php echo round($ca,2);?></div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php echo round($cb,2);?></div></td>
<td bgcolor="#bbFFFF"><div align="center"></div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php echo $c100l;?></div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php echo $c100a;?></div></td>
<td <?php if ($c100b<$cb) {echo ' bgcolor="#91ff78"'; } else { echo ' bgcolor="#bbFFFF"'; }?>><div align="right"><?php echo $c100b;?></div></td>
<td bgcolor="#bbFFFF"><div align="right"><?php if ($dc00>5) {$sid=1;?><font color="red"><?php }
  echo round($dc00,2);$psum=$psum-$dc00;?></div></td>
  <td bgcolor="#bbFFFF"><div align="right"><?php echo round($c100d,2);?></div></td>
  </tr>
  
 <tr><td bgcolor="#FFccFF"><div align="center">M</div></td>
<td bgcolor="#FFccFF"><div align="right"><?php echo round($ml,2);?></div></td>
<td bgcolor="#FFccFF"><div align="right"><?php echo round($ma,2);?></div></td>
<td bgcolor="#FFccFF"><div align="right"><?php echo round($mb,2);?></div></td>
<td bgcolor="#FFccFF"><div align="center"></div></td>
<td bgcolor="#FFccFF"><div align="right"><?php echo $m100l;?></div></td>
<td <?php if ($m100a>$ma) {echo ' bgcolor="#91ff78"'; } else { echo ' bgcolor="#FFccFF"'; }?>><div align="right"><?php echo $m100a;?></div></td>
<td bgcolor="#FFccFF"><div align="right"><?php echo $m100b;?></div></td>
<td bgcolor="#FFccFF"><div align="right"><?php if ($dm00>5) {$sid=1;?><font color="red"><?php }
  echo round($dm00,2);$psum=$psum-$dm00;?></div></td>
    <td bgcolor="#FFccFF"><div align="right"><?php echo round($m100d,2);?></div></td>
	</tr>
  
 <tr><td bgcolor="#FFFFbb"><div align="center">Y</div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php echo round($yl,2);?></div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php echo round($ya,2);?></div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php echo round($yb,2);?></div></td>
<td bgcolor="#FFFFbb"><div align="center"></div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php echo $y100l;?></div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php echo $y100a;?></div></td>
<td <?php if ($y100b>$yb) {echo ' bgcolor="#91ff78"'; } else { echo ' bgcolor="#FFFFbb"'; }?>><div align="right"><?php echo $y100b;?></div></td>
<td bgcolor="#FFFFbb"><div align="right"><?php if ($dy00>5) {$sid=1;?><font color="red"><?php }
  echo round($dy00,2);$psum=$psum-$dy00;?></div></td>
    <td bgcolor="#FFFFbb"><div align="right"><?php echo round($y100d,2);?></div></td>
	</tr>
  
 <tr><td bgcolor="#DDDDDD"><div align="center">K</div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php echo round($kl,2);?></div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php echo round($ka,2);?></div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php echo round($kb,2);?></div></td>
<td bgcolor="#DDDDDD"><div align="center"></div></td>
<td <?php if ($k100l<$kl) {echo ' bgcolor="#91ff78"'; } else { echo ' bgcolor="#DDDDDD"'; }?>><div align="right"><?php echo $k100l;?></div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php echo $k100a;?></div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php echo $k100b;?></div></td>
<td bgcolor="#DDDDDD"><div align="right"><?php if ($dk00>5) {$sid=1;?><font color="red"><?php }
  echo round($dk00,2);$psum=$psum-$dk00;?></div></td>
    <td bgcolor="#DDDDDD"><div align="right"><?php echo round($k100d,2);?></div></td>
	</tr>

</table>


<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php

  $Tsum=(($sum/260)*60)+(($psum/20)*40);
  $Rsum=round($Tsum,2);
  if (($check==0) && ($sid==0)){
	$passbit=1;}
	
	
  if(!empty($_SERVER['HTTP_CLIENT_IP'])){
   $myip = $_SERVER['HTTP_CLIENT_IP'];
}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
   $myip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
   $myip= $_SERVER['REMOTE_ADDR'];
}
  
  
  


		// generate and execute query
		$query = "INSERT INTO fogra39tvis(company, contact, email, type, filename, score, passbit, date, device, dsn, printer, paper, ink, rankbit) VALUES('$company', '$contact', '$email', '$type', '$filename','$Rsum', '$passbit', NOW(), '$device', '$myip', '$printer', '$paper', '$ink', '$rankbit')";
		
		//echo $query;
		//$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
		$results =  mysqli_query($conn, $query);
		
		$gfname= $company."-";
		//echo "gfname:".$gfname;
  
		mysqli_close($conn);
		
//////////////////////////////////////////////////graph		
include 'graphFixC.php';







GenGraphC($gfname,round($TVIc5,2)-5,round($TVIc10,2)-10,round($TVIc15,2)-15,round($TVIc20,2)-20,round($TVIc25,2)-25,round($TVIc30,2)-30,0.01,round($TVIc40,2)-40,0.01,round($TVIc50,2)-50,0.01,round($TVIc60,2)-60,0.01,round($TVIc70,2)-70,round($TVIc75,2)-75,round($TVIc80,2)-80,round($TVIc85,2)-85,round($TVIc90,2)-90,round($TVIc95,2)-95,round($RTVIc5,2)-5,round($RTVIc10,2)-10,round($RTVIc15,2)-15,round($RTVIc20,2)-20,round($RTVIc25,2)-25,round($RTVIc30,2)-30,0.01,round($RTVIc40,2)-40,0.01,round($RTVIc50,2)-50,0.01,round($RTVIc60,2)-60,0.01,round($RTVIc70,2)-70,round($RTVIc75,2)-75,round($RTVIc80,2)-80,round($RTVIc85,2)-85,round($RTVIc90,2)-90,round($RTVIc95,2)-95);
?>

<img src=<?php echo 'graph/'.$gfname.'graphC.gif?';?>nocache=<?php echo time(); ?>>
</div>
</table>

<table>
<div>
<?php
include 'graphFixM.php';
GenGraphM($gfname,round($TVIm5,2)-5,round($TVIm10,2)-10,round($TVIm15,2)-15,round($TVIm20,2)-20,round($TVIm25,2)-25,round($TVIm30,2)-30,0.01,round($TVIm40,2)-40,0.01,round($TVIm50,2)-50,0.01,round($TVIm60,2)-60,0.01,round($TVIm70,2)-70,round($TVIm75,2)-75,round($TVIm80,2)-80,round($TVIm85,2)-85,round($TVIm90,2)-90,round($TVIm95,2)-95,round($RTVIm5,2)-5,round($RTVIm10,2)-10,round($RTVIm15,2)-15,round($RTVIm20,2)-20,round($RTVIm25,2)-25,round($RTVIm30,2)-30,0.01,round($RTVIm40,2)-40,0.01,round($RTVIm50,2)-50,0.01,round($RTVIm60,2)-60,0.01,round($RTVIm70,2)-70,round($RTVIm75,2)-75,round($RTVIm80,2)-80,round($RTVIm85,2)-85,round($RTVIm90,2)-90,round($RTVIm95,2)-95);
?>
<img src=<?php echo 'graph/'.$gfname.'graphM.gif?';?>nocache=<?php echo time(); ?>>
</div>
</table>

<table>
<div>
<?php
include 'graphFixY.php';
GenGraphY($gfname,round($TVIy5,2)-5,round($TVIy10,2)-10,round($TVIy15,2)-15,round($TVIy20,2)-20,round($TVIy25,2)-25,round($TVIy30,2)-30,0.01,round($TVIy40,2)-40,0.01,round($TVIy50,2)-50,0.01,round($TVIy60,2)-60,0.01,round($TVIy70,2)-70,round($TVIy75,2)-75,round($TVIy80,2)-80,round($TVIy85,2)-85,round($TVIy90,2)-90,round($TVIy95,2)-95,round($RTVIy5,2)-5,round($RTVIy10,2)-10,round($RTVIy15,2)-15,round($RTVIy20,2)-20,round($RTVIy25,2)-25,round($RTVIy30,2)-30,0.01,round($RTVIy40,2)-40,0.01,round($RTVIy50,2)-50,0.01,round($RTVIy60,2)-60,0.01,round($RTVIy70,2)-70,round($RTVIy75,2)-75,round($RTVIy80,2)-80,round($RTVIy85,2)-85,round($RTVIy90,2)-90,round($RTVIy95,2)-95);
?>
<img src=<?php echo 'graph/'.$gfname.'graphY.gif?';?>nocache=<?php echo time(); ?>>
</div>
</table>

<table>
<div>
<?php
include 'graphFixK.php';
GenGraphK($gfname,round($TVIk5,2)-5,round($TVIk10,2)-10,round($TVIk15,2)-15,round($TVIk20,2)-20,round($TVIk25,2)-25,round($TVIk30,2)-30,0.01,round($TVIk40,2)-40,0.01,round($TVIk50,2)-50,0.01,round($TVIk60,2)-60,0.01,round($TVIk70,2)-70,round($TVIk75,2)-75,round($TVIk80,2)-80,round($TVIk85,2)-85,round($TVIk90,2)-90,round($TVIk95,2)-95,round($RTVIk5,2)-5,round($RTVIk10,2)-10,round($RTVIk15,2)-15,round($RTVIk20,2)-20,round($RTVIk25,2)-25,round($RTVIk30,2)-30,0.01,round($RTVIk40,2)-40,0.01,round($RTVIk50,2)-50,0.01,round($RTVIk60,2)-60,0.01,round($RTVIk70,2)-70,round($RTVIk75,2)-75,round($RTVIk80,2)-80,round($RTVIk85,2)-85,round($RTVIk90,2)-90,round($RTVIk95,2)-95);
?>
<img src=<?php echo 'graph/'.$gfname.'graphK.gif?';?>nocache=<?php echo time(); ?>>
</div>
</table>




<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');

echo "<br>K10,C10:$TVIk10,$TVIc10";
unlink('scatterDR.png');
$datay1 = array(0,round($TVIk5,2)-5,round($TVIk10,2)-10,round($TVIk15,2)-15,round($TVIk20,2)-20,round($TVIk25,2)-25,round($TVIk30,2)-30,round(($TVIk30+$TVIk40)/2,2)-35,round($TVIk40,2)-40,round(($TVIk40+$TVIk50)/2,2)-45,round($TVIk50,2)-50,round(($TVIk50+$TVIk60)/2,2)-55,round($TVIk60,2)-60,round(($TVIk60+$TVIk70)/2,2)-65,round($TVIk70,2)-70,round($TVIk75,2)-75,round($TVIk80,2)-80,round($TVIk85,2)-85,round($TVIk90,2)-90,round($TVIk95,2)-95,0);
$datay2 = array(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100);

$datay3 = array(0,round($TVIc5,2)-5,round($TVIc10,2)-10,round($TVIc15,2)-15,round($TVIc20,2)-20,round($TVIc25,2)-25,round($TVIc30,2)-30,round(($TVIc30+$TVIc40)/2,2)-35,round($TVIc40,2)-40,round(($TVIc40+$TVIc50)/2,2)-45,round($TVIc50,2)-50,round(($TVIc50+$TVIc60)/2,2)-55,round($TVIc60,2)-60,round(($TVIc60+$TVIc70)/2,2)-65,round($TVIc70,2)-70,round($TVIc75,2)-75,round($TVIc80,2)-80,round($TVIc85,2)-85,round($TVIc90,2)-90,round($TVIc95,2)-95,0);

$datay4 = array(0,round($TVIm5,2)-5,round($TVIm10,2)-10,round($TVIm15,2)-15,round($TVIm20,2)-20,round($TVIm25,2)-25,round($TVIm30,2)-30,round(($TVIm30+$TVIm40)/2,2)-35,round($TVIm40,2)-40,round(($TVIm40+$TVIm50)/2,2)-45,round($TVIm50,2)-50,round(($TVIm50+$TVIm60)/2,2)-55,round($TVIm60,2)-60,round(($TVIm60+$TVIm70)/2,2)-65,round($TVIm70,2)-70,round($TVIm75,2)-75,round($TVIm80,2)-80,round($TVIm85,2)-85,round($TVIm90,2)-90,round($TVIm95,2)-95,0);

$datay5 = array(0,round($TVIy5,2)-5,round($TVIy10,2)-10,round($TVIy15,2)-15,round($TVIy20,2)-20,round($TVIy25,2)-25,round($TVIy30,2)-30,round(($TVIy30+$TVIy40)/2,2)-35,round($TVIy40,2)-40,round(($TVIy40+$TVIy50)/2,2)-45,round($TVIy50,2)-50,round(($TVIy50+$TVIy60)/2,2)-55,round($TVIy60,2)-60,round(($TVIy60+$TVIy70)/2,2)-65,round($TVIy70,2)-70,round($TVIy75,2)-75,round($TVIy80,2)-80,round($TVIy85,2)-85,round($TVIy90,2)-90,round($TVIy95,2)-95,0);

$datayF = array(0,2,4,6,7.6,9.3,10.7,12,13,13.8,14.3,14.6,14.5,14.1,13.4,12.3,10.7,8.7,6.3,3.4,0);

$nf=14.5/(round($TVIc60,2)-60);

$datay3n = array(0,(round($TVIc5,2)-5)*$nf,(round($TVIc10,2)-10)*$nf,(round($TVIc15,2)-15)*$nf,(round($TVIc20,2)-20)*$nf,(round($TVIc25,2)-25)*$nf,(round($TVIc30,2)-30)*$nf,(round(($TVIc30+$TVIc40)/2,2)-35)*$nf,(round($TVIc40,2)-40)*$nf,(round(($TVIc40+$TVIc50)/2,2)-45)*$nf,(round($TVIc50,2)-50)*$nf,(round(($TVIc50+$TVIc60)/2,2)-55)*$nf,(round($TVIc60,2)-60)*$nf,(round(($TVIc60+$TVIc70)/2,2)-65)*$nf,(round($TVIc70,2)-70)*$nf,(round($TVIc75,2)-75)*$nf,(round($TVIc80,2)-80)*$nf,(round($TVIc85,2)-85)*$nf,(round($TVIc90,2)-90)*$nf,(round($TVIc95,2)-95)*$nf,0);

// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin",0,20,0,0);

$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->title->Set('Tone Curve');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xaxis->SetTickLabels(array('0','5','10','15','20','25','30','35','40','45','50','55','60','65','70','75','80','85','90','95','100'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

$p1 = new LinePlot($datay1);
$graph->Add($p1);

$p3 = new LinePlot($datay3);
$graph->Add($p3);

//$p3n = new LinePlot($datay3n);
//$graph->Add($p3n);

$p4 = new LinePlot($datay4);
$graph->Add($p4);

$p5 = new LinePlot($datay5);
$graph->Add($p5);

$pF = new LinePlot($datayF);
$graph->Add($pF);

//$p2 = new LinePlot($datay2);
//$graph->Add($p2);
$ADR=$c21l-$a21l;
$BDR=$ct21l-$at21l;

$pF = new LinePlot($datayF);
$graph->Add($pF);
$pF->SetColor("green");
$pF->SetLegend('F39');
$pF->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$pF->mark->SetColor('green');
$pF->mark->SetFillColor('green');
$pF->SetCenter();
/*
$p3n = new LinePlot($datay3n);
$graph->Add($p3n);
$p3n->SetColor("red");
$p3n->SetLegend('F39');
$p3n->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p3n->mark->SetColor('red');
$p3n->mark->SetFillColor('red');
$p3n->SetCenter();
*/
$p1->SetColor("#aaaaaa");
$p1->SetLegend('K='. $ADR);
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();


$p3->SetColor("#33CCFF");
$p3->SetLegend('C='. $ADR);
$p3->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p3->mark->SetColor('#33CCFF');
$p3->mark->SetFillColor('#33CCFF');
$p3->SetCenter();


$p4->SetColor("#FFCCFF");
$p4->SetLegend('M='. $ADR);
$p4->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p4->mark->SetColor('#FFCCFF');
$p4->mark->SetFillColor('#FFCCFF');
$p3->SetCenter();

$p5->SetColor("#DDDD99");
$p5->SetLegend('Y='. $ADR);
$p5->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p5->mark->SetColor('#DDDD99');
$p5->mark->SetFillColor('#DDDD99');
$p5->SetCenter();
//$p2->SetColor("#aaaaaa");
//$p2->SetLegend('Line='. $BDR);
//$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
//$p2->mark->SetColor('#aaaaaa');
//$p2->mark->SetFillColor('#aaaaaa');
//$p2->value->SetMargin(14);
//$p2->SetCenter();

$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);


// Output line
$graph->Stroke('scatterDR.png');
?>
<img src="scatterDR.png">
</div></td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
//require_once ('../jpgraph/jpgraph_line.php');


unlink('scatterDR2.png');
$datay1 = array(0,round($TVIk5,2),round($TVIk10,2),round($TVIk15,2),round($TVIk20,2),round($TVIk25,2),round($TVIk30,2),round(($TVIk30+$TVIk40)/2,2),round($TVIk40,2),round(($TVIk40+$TVIk50)/2,2),round($TVIk50,2),round(($TVIk50+$TVIk60)/2,2),round($TVIk60,2),round(($TVIk60+$TVIk70)/2,2),round($TVIk70,2),round($TVIk75,2),round($TVIk80,2),round($TVIk85,2),round($TVIk90,2),round($TVIk95,2),100);
$datay2 = array(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100);

$datay3 = array(0,round($TVIc5,2),round($TVIc10,2),round($TVIc15,2),round($TVIc20,2),round($TVIc25,2),round($TVIc30,2),round(($TVIc30+$TVIc40)/2,2),round($TVIc40,2),round(($TVIc40+$TVIc50)/2,2),round($TVIc50,2),round(($TVIc50+$TVIc60)/2,2),round($TVIc60,2),round(($TVIc60+$TVIc70)/2,2),round($TVIc70,2),round($TVIc75,2),round($TVIc80,2),round($TVIc85,2),round($TVIc90,2),round($TVIc95,2),100);

$datay4 = array(0,round($TVIm5,2),round($TVIm10,2),round($TVIm15,2),round($TVIm20,2),round($TVIm25,2),round($TVIm30,2),round(($TVIm30+$TVIm40)/2,2),round($TVIm40,2),round(($TVIm40+$TVIm50)/2,2),round($TVIm50,2),round(($TVIm50+$TVIm60)/2,2),round($TVIm60,2),round(($TVIm60+$TVIm70)/2,2),round($TVIm70,2),round($TVIm75,2),round($TVIm80,2),round($TVIm85,2),round($TVIm90,2),round($TVIm95,2),100);

$datay5 =array(0,round($TVIy5,2),round($TVIy10,2),round($TVIy15,2),round($TVIy20,2),round($TVIy25,2),round($TVIy30,2),round(($TVIy30+$TVIy40)/2,2),round($TVIy40,2),round(($TVIy40+$TVIy50)/2,2),round($TVIy50,2),round(($TVIy50+$TVIy60)/2,2),round($TVIy60,2),round(($TVIy60+$TVIy70)/2,2),round($TVIy70,2),round($TVIy75,2),round($TVIy80,2),round($TVIy85,2),round($TVIy90,2),round($TVIy95,2),100);

// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin");

$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->title->Set('Tone Curve');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xaxis->SetTickLabels(array('0','5','10','15','20','25','30','35','40','45','50','55','60','65','70','75','80','85','90','95','100'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

$p1 = new LinePlot($datay1);
$graph->Add($p1);

$p3 = new LinePlot($datay3);
$graph->Add($p3);

$p4 = new LinePlot($datay4);
$graph->Add($p4);

$p5 = new LinePlot($datay5);
$graph->Add($p5);

$p2 = new LinePlot($datay2);
$graph->Add($p2);
$ADR=$c21l-$a21l;
$BDR=$ct21l-$at21l;

$p1->SetColor("#aaaaaa");
$p1->SetLegend('K='. $ADR);
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();


$p3->SetColor("#33CCFF");
$p3->SetLegend('C='. $ADR);
$p3->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p3->mark->SetColor('#33CCFF');
$p3->mark->SetFillColor('#33CCFF');
$p3->SetCenter();


$p4->SetColor("#FFCCFF");
$p4->SetLegend('M='. $ADR);
$p4->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p4->mark->SetColor('#FFCCFF');
$p4->mark->SetFillColor('#FFCCFF');
$p3->SetCenter();

$p5->SetColor("#DDDD99");
$p5->SetLegend('Y='. $ADR);
$p5->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p5->mark->SetColor('#DDDD99');
$p5->mark->SetFillColor('#DDDD99');
$p5->SetCenter();

$p2->SetColor("#aaaaaa");
$p2->SetLegend('Line='. $BDR);
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#aaaaaa');
$p2->mark->SetFillColor('#aaaaaa');
$p2->value->SetMargin(14);
$p2->SetCenter();

$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);


// Output line
$graph->Stroke('scatterDR2.png');
?>
<img src="scatterDR2.png">
</div></td></tr>

</table>


 <?php
  require_once( 'PolynomialRegression.php' );

  $data =
    array
    (
       array( 0.00, 0.0 ), array( 5, $TVIc5-5 ), 
	   array( 10, $TVIc10-10 ), array( 15, $TVIc15-15 ), 
	   array( 20, $TVIc20-20 ), array( 25, $TVIc25-25 ), 
	   array( 30, $TVIc30-30 ), array( 35, ($TVIc30+$TVIc40)/2-35 ), 
	   array( 40, $TVIc40-40 ), array( 45, ($TVIc40+$TVIc50)/2-45 ),
	   array( 50, $TVIc50-50 ), array( 55, ($TVIc50+$TVIc60)/2-55 ), 
	   array( 60, $TVIc60-60 ), array( 65, ($TVIc60+$TVIc70)/2-65 ),
	   array( 70, $TVIc70-70 ), array( 75, $TVIc75-75 ), 
	   array( 80, $TVIc80-80 ), array( 85, $TVIc85-85 ), 
	   array( 90, $TVIc90-90), array( 95, $TVIc95-95 ),
	   array( 100, 0  )
    );
	
/*	

	  $data =
    array
    (
       array( 0.00, 0.0 ), array( 5, ($TVIc5-5 )*$nf), 
	   array( 10, ($TVIc10-10 )*$nf), array( 15, ($TVIc15-15 )*$nf), 
	   array( 20, ($TVIc20-20 )*$nf), array( 25, ($TVIc25-25 )*$nf), 
	   array( 30, ($TVIc30-30 )*$nf), array( 35, (($TVIc30+$TVIc40)/2-35 )*$nf), 
	   array( 40, ($TVIc40-40 )*$nf), array( 45, (($TVIc40+$TVIc50)/2-45 )*$nf),
	   array( 50, ($TVIc50-50 )*$nf), array( 55, (($TVIc50+$TVIc60)/2-55 )*$nf), 
	   array( 60, ($TVIc60-60 )*$nf), array( 65, (($TVIc60+$TVIc70)/2-65 )*$nf),
	   array( 70, ($TVIc70-70 )*$nf), array( 75, ($TVIc75-75 )*$nf), 
	   array( 80, ($TVIc80-80 )*$nf), array( 85, ($TVIc85-85 )*$nf), 
	   array( 90, ($TVIc90-90)*$nf), array( 95, ($TVIc95-95 )*$nf),
	   array( 100, 0  )
    );
*/
	

  // Precision digits in BC math.
  bcscale( 10 );
  
    $leastSquareRegression = new PolynomialRegression( 3 );//pupumonkey

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    {
	$leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );
	//echo "addData : " . $dataPoint[ 0 ]."-".$dataPoint[ 1 ] . "<br />\n";
	}

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
  //echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredC = round(1.0 - ( $Y_ErrorSum / $Y_MeanSum ),4);

//echo "<table align='center'><tr><td  bgcolor='#639ef6'><font color='#000000'><div align='center'>R squared:".round($R_SquaredC,3)."</div></td></tr></table>";
  
  //////////////////////////////
  
 $data =
    array
    (
       array( 0.00, 0.0 ), array( 5, $TVIm5-5 ), 
	   array( 10, $TVIm10-10 ), array( 15, $TVIm15-15 ), 
	   array( 20, $TVIm20-20 ), array( 25, $TVIm25-25 ), 
	   array( 30, $TVIm30-30 ), array( 35, ($TVIm30+$TVIm40)/2-35 ), 
	   array( 40, $TVIm40-40 ), array( 45, ($TVIm40+$TVIm50)/2-45 ),
	   array( 50, $TVIm50-50 ), array( 55, ($TVIm50+$TVIm60)/2-55 ), 
	   array( 60, $TVIm60-60 ), array( 65, ($TVIm60+$TVIm70)/2-65 ),
	   array( 70, $TVIm70-70 ), array( 75, $TVIm75-75 ), 
	   array( 80, $TVIm80-80 ), array( 85, $TVIm85-85 ), 
	   array( 90, $TVIm90-90), array( 95, $TVIm95-95 ),
	   array( 100, 0  )
    );
	

  // Precision digits in BC math.
  bcscale( 10 );
  
    $leastSquareRegression = new PolynomialRegression( 3 );//pupumonkey

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    {
	$leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );
	//echo "addData : " . $dataPoint[ 0 ]."-".$dataPoint[ 1 ] . "<br />\n";
	}

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
  //echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredM = round(1.0 - ( $Y_ErrorSum / $Y_MeanSum ),4);

// echo "<table align='center'><tr><td  bgcolor='#f663ed'><font color='#000000'><div align='center'>R squared:".round($R_SquaredM,3)."</div></td></tr></table>";
  
  //////////////////////////////
   $data =
    array
    (
       array( 0.00, 0.0 ), array( 5, $TVIy5-5 ), 
	   array( 10, $TVIy10-10 ), array( 15, $TVIy15-15 ), 
	   array( 20, $TVIy20-20 ), array( 25, $TVIy25-25 ), 
	   array( 30, $TVIy30-30 ), array( 35, ($TVIy30+$TVIy40)/2-35 ), 
	   array( 40, $TVIy40-40 ), array( 45, ($TVIy40+$TVIy50)/2-45 ),
	   array( 50, $TVIy50-50 ), array( 55, ($TVIy50+$TVIy60)/2-55 ), 
	   array( 60, $TVIy60-60 ), array( 65, ($TVIy60+$TVIy70)/2-65 ),
	   array( 70, $TVIy70-70 ), array( 75, $TVIy75-75 ), 
	   array( 80, $TVIy80-80 ), array( 85, $TVIy85-85 ), 
	   array( 90, $TVIy90-90), array( 95, $TVIy95-95 ),
	   array( 100, 0  )
    );
	

  // Precision digits in BC math.
  bcscale( 10 );
  
    $leastSquareRegression = new PolynomialRegression( 3 );//pupumonkey

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    {
	$leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );
	//echo "addData : " . $dataPoint[ 0 ]."-".$dataPoint[ 1 ] . "<br />\n";
	}

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
  //echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredY = round(1.0 - ( $Y_ErrorSum / $Y_MeanSum ),4);

 // echo "<table align='center'><tr><td  bgcolor='#f6f463'><font color='#000000'><div align='center'>R squared:".round($R_SquaredY,3)."</div></td></tr></table>";
  
  //////////////////////////////
   $data =
    array
    (
       array( 0.00, 0.0 ), array( 5, $TVIk5-5 ), 
	   array( 10, $TVIk10-10 ), array( 15, $TVIk15-15 ), 
	   array( 20, $TVIk20-20 ), array( 25, $TVIk25-25 ), 
	   array( 30, $TVIk30-30 ), array( 35, ($TVIk30+$TVIk40)/2-35 ), 
	   array( 40, $TVIk40-40 ), array( 45, ($TVIk40+$TVIk50)/2-45 ),
	   array( 50, $TVIk50-50 ), array( 55, ($TVIk50+$TVIk60)/2-55 ), 
	   array( 60, $TVIk60-60 ), array( 65, ($TVIk60+$TVIk70)/2-65 ),
	   array( 70, $TVIk70-70 ), array( 75, $TVIk75-75 ), 
	   array( 80, $TVIk80-80 ), array( 85, $TVIk85-85 ), 
	   array( 90, $TVIk90-90), array( 95, $TVIk95-95 ),
	   array( 100, 0  )
    );
	

  // Precision digits in BC math.
  bcscale( 10 );
  
    $leastSquareRegression = new PolynomialRegression( 3 );//pupumonkey

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    {
	$leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );
	//echo "addData : " . $dataPoint[ 0 ]."-".$dataPoint[ 1 ] . "<br />\n";
	}

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
  //echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredK = round(1.0 - ( $Y_ErrorSum / $Y_MeanSum ),4);

   echo "<table align='center'><tr>
   <td  bgcolor='#639ef6'><font color='#000000'><div align='center'>R squared:".round($R_SquaredC,3)."</div></td>
   <td  bgcolor='#f663ed'><font color='#000000'><div align='center'>R squared:".round($R_SquaredM,3)."</div></td>
   <td  bgcolor='#f6f463'><font color='#000000'><div align='center'>R squared:".round($R_SquaredY,3)."</div></td>
   <td  bgcolor='#cccccc'><font color='#000000'><div align='center'>R squared:".round($R_SquaredK,3)."</div></td>
   
   
   
   </tr></table>";
  
  //////////////////////////////
  
  
  
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//   //////////////////////////////////Beer's Law section   2727///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   ////////////////sec K
   $idx=11;
   $cols=46;
	$ki=0.820;
	
	
	for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=87;////K line

	$si=0;

	for ($s=380; $s<=730; $s+=10) {     
	${'p'.$s}=abs($dot[11+$si]);
	${'m'.$s}=abs($dot[11+$cols*$Pdot+$si]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	}
$si+1;
	
	
	$ki=$ki+0.015;

	${'k'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'k'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'k'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($k1Z,3)."<br>";
	
	${'k'.$i.'l'}=xyz2lab01("l",${'k'.$i.'X'},${'k'.$i.'Y'},${'k'.$i.'Z'});
	${'k'.$i.'a'}=xyz2lab01("a",${'k'.$i.'X'},${'k'.$i.'Y'},${'k'.$i.'Z'});
	${'k'.$i.'b'}=xyz2lab01("b",${'k'.$i.'X'},${'k'.$i.'Y'},${'k'.$i.'Z'});
	
	//echo "K1L=".round($k1l,3).",".round($k1a,3).",".round($k1b,3);
	${'k'.$i.'dd'}=DensitySp38("K",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "K1D=".round(${'k'.$i.'dd'},3);

	//echo "K1D=".round(${'k'.$i.'dd'},3);
	}
	//echo "<br>";
//////////////////////sec C
	$ki=0.820;
	for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=21;////C line
	$si=0;

	for ($s=380; $s<=730; $s+=10) {
	${'p'.$s}=abs($dot[11+$si]);
	${'m'.$s}=abs($dot[11+$cols*$Pdot+$si]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	}
	
	$ki=$ki+0.015;

	${'c'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'c'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'c'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($c1Z,3)."<br>";
	
	${'c'.$i.'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	//echo "K1L=".round($c1l,3).",".round($c1a,3).",".round($c1b,3);
	${'c'.$i.'dd'}=DensitySp38("C",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "C1D=".round(${'c'.$i.'dd'},3);
	
	//echo "c1D=".round($c1dd,3);
	}
	//echo "<br>";
//////////////////////////sec M
	$ki=0.820;
	
	for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=43;////M line
	$si=0;

	for ($s=380; $s<=730; $s+=10) {
	${'p'.$s}=abs($dot[11+$si]);
	${'m'.$s}=abs($dot[11+$cols*$Pdot+$si]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	}

	$ki=$ki+0.015;

	${'m'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'m'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'m'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($m1X,3).",".round($m1Y,3).",".round($m1Z,3)."<br>";
	
	${'m'.$i.'l'}=xyz2lab01("l",${'m'.$i.'X'},${'m'.$i.'Y'},${'m'.$i.'Z'});
	${'m'.$i.'a'}=xyz2lab01("a",${'m'.$i.'X'},${'m'.$i.'Y'},${'m'.$i.'Z'});
	${'m'.$i.'b'}=xyz2lab01("b",${'m'.$i.'X'},${'m'.$i.'Y'},${'m'.$i.'Z'});
	
	//echo "K1L=".round($m1l,3).",".round($m1a,3).",".round($m1b,3);
	${'m'.$i.'dd'}=DensitySp38("M",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "<br>m1D=".round(${'m'.$i.'dd'},3);

	//echo "m1D=".round(${'m'.$i.'dd'},3);
	}
 //echo "<br>";
///////////////////sec Y
	$ki=0.880;
	for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=65;////Y line
	$si=0;

	for ($s=380; $s<=730; $s+=10) {
	${'p'.$s}=abs($dot[11+$si]);
	${'m'.$s}=abs($dot[11+$cols*$Pdot+$si]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	}

	$ki=$ki+0.015;

	${'y'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'y'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'y'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($y1X,3).",".round($y1Y,3).",".round($y1Z,3)."<br>";
	
	${'y'.$i.'l'}=xyz2lab01("l",${'y'.$i.'X'},${'y'.$i.'Y'},${'y'.$i.'Z'});
	${'y'.$i.'a'}=xyz2lab01("a",${'y'.$i.'X'},${'y'.$i.'Y'},${'y'.$i.'Z'});
	${'y'.$i.'b'}=xyz2lab01("b",${'y'.$i.'X'},${'y'.$i.'Y'},${'y'.$i.'Z'});
	
	//echo "K1L=".round($y1l,3).",".round($y1a,3).",".round($y1b,3);
	${'y'.$i.'dd'}=DensitySp38("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "<br>y1D=".round(${'y'.$i.'dd'},3);

  // echo "y1D=".round(${'y'.$i.'dd'},3);
   }
   
   //////////////////////////////////Beer's Law section
   //////////////////////////////////////////////////////
 

//include 'dE00.php';

 
 $tt00=de76(55,-37,-50,54.3,-34.47,-52.63);
 

 
 $dek00=de76($kl,$ka,$kb,$k100l,$k100a,$k100b);
 $dec00=de76($cl,$ca,$cb,$c100l,$c100a,$c100b);
  //$dec00=de76($cLt,$cat,$cbt,$cLm,$cam,$cbm);
 $dem00=de76($ml,$ma,$mb,$m100l,$m100a,$m100b);
 $dey00=de76($yl,$ya,$yb,$y100l,$y100a,$y100b);

  $dk176=de76($kl,$ka,$kb,$k1l,$k1a,$k1b);
  $dk276=de76($kl,$ka,$kb,$k2l,$k2a,$k2b);
  $dk376=de76($kl,$ka,$kb,$k3l,$k3a,$k3b);
  $dk476=de76($kl,$ka,$kb,$k4l,$k4a,$k4b);
  $dk576=de76($kl,$ka,$kb,$k5l,$k5a,$k5b);
  $dk676=de76($kl,$ka,$kb,$k6l,$k6a,$k6b);
  $dk776=de76($kl,$ka,$kb,$k7l,$k7a,$k7b);
  $dk876=de76($kl,$ka,$kb,$k8l,$k8a,$k8b);
  $dk976=de76($kl,$ka,$kb,$k9l,$k9a,$k9b);
  $dk1076=de76($kl,$ka,$kb,$k10l,$k10a,$k10b);
  $dk1176=de76($kl,$ka,$kb,$k11l,$k11a,$k11b);
  $dk1276=de76($kl,$ka,$kb,$k12l,$k12a,$k12b);
  $dk1376=de76($kl,$ka,$kb,$k13l,$k13a,$k13b);
  $dk1476=de76($kl,$ka,$kb,$k14l,$k14a,$k14b);
  $dk1576=de76($kl,$ka,$kb,$k15l,$k15a,$k15b);
  $dk1676=de76($kl,$ka,$kb,$k16l,$k16a,$k16b);
  $dk1776=de76($kl,$ka,$kb,$k17l,$k17a,$k17b);
  $dk1876=de76($kl,$ka,$kb,$k18l,$k18a,$k18b);
  $dk1976=de76($kl,$ka,$kb,$k19l,$k19a,$k19b);
  $dk2076=de76($kl,$ka,$kb,$k20l,$k20a,$k20b);
  $dk2176=de76($kl,$ka,$kb,$k21l,$k21a,$k21b);
  $dk2276=de76($kl,$ka,$kb,$k22l,$k22a,$k22b);
  $dk2376=de76($kl,$ka,$kb,$k23l,$k23a,$k23b);
  $dk2476=de76($kl,$ka,$kb,$k24l,$k24a,$k24b);
  $dk2576=de76($kl,$ka,$kb,$k25l,$k25a,$k25b);
  $dk2676=de76($kl,$ka,$kb,$k26l,$k26a,$k26b);
  $dk2776=de76($kl,$ka,$kb,$k27l,$k27a,$k27b);
  $dk2876=de76($kl,$ka,$kb,$k28l,$k28a,$k28b);
  $dk2976=de76($kl,$ka,$kb,$k29l,$k29a,$k29b);
  $dk3076=de76($kl,$ka,$kb,$k30l,$k30a,$k30b);
  $kmin=min($dk176,$dk276,$dk376,$dk476,$dk576,$dk676,$dk776,$dk876,$dk976,$dk1076,$dk1176,$dk1276,$dk1376,$dk1476,$dk1576,$dk1676,$dk1776,$dk1876,$dk1976,$dk2076,$dk2176,$dk2276,$dk2376,$dk2476,$dk2576,$dk2676,$dk2776,$dk2876,$dk2976,$dk3076);
  
  
 // $dk194=de94($kl,$ka,$kb,$k1l,$k1a,$k1b);
  

  ?>



<?php if ($dk176==$kmin){ $kopt='1';$koptD=$k1dd;if ($k1l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk276==$kmin){ $kopt='2';$koptD=$k2dd;if ($k2l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk376==$kmin){ $kopt='3';$koptD=$k3dd;if ($k3l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk476==$kmin){ $kopt='4';$koptD=$k4dd;if ($k4l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk576==$kmin){ $kopt='5';$koptD=$k5dd;if ($k5l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk676==$kmin){ $kopt='6';$koptD=$k6dd;if ($k6l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk776==$kmin){ $kopt='7';$koptD=$k7dd;if ($k7l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php  if ($dk876==$kmin){ $kopt='8';$koptD=$k8dd; if ($k8l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk976==$kmin){ $kopt='9';$koptD=$k9dd;if ($k9l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1076==$kmin){ $kopt='10';$koptD=$k10dd;if ($k10l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1176==$kmin){ $kopt='11';$koptD=$k11dd;if ($k11l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1276==$kmin){ $kopt='12';$koptD=$k12dd;if ($k12l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1376==$kmin){ $kopt='13';$koptD=$k13dd;if ($k13l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1476==$kmin){ $kopt='14';$koptD=$k14dd;if ($k14l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php  if ($dk1576==$kmin){ $kopt='15';$koptD=$k15dd;if ($k15l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1676==$kmin){ $kopt='16';$koptD=$k16dd;if ($k16l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1776==$kmin){ $kopt='17';$koptD=$k17dd;if ($k17l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1876==$kmin){ $kopt='18';$koptD=$k18dd;if ($k18l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk1976==$kmin){ $kopt='19';$koptD=$k19dd;if ($k19l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2076==$kmin){ $kopt='20';$koptD=$k20dd;if ($k20l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2176==$kmin){ $kopt='21';$koptD=$k21dd;if ($k21l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2276==$kmin){ $kopt='22';$koptD=$k22dd;if ($k22l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php  if ($dk2376==$kmin){ $kopt='23';$koptD=$k23dd;if ($k23l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2476==$kmin){ $kopt='24';$koptD=$k24dd;if ($k24l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2576==$kmin){ $kopt='25';$koptD=$k25dd;if ($k25l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2676==$kmin){ $kopt='26';$koptD=$k26dd;if ($k26l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2776==$kmin){ $kopt='27';$koptD=$k27dd;if ($k27l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2876==$kmin){ $kopt='28';$koptD=$k28dd;if ($k28l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk2976==$kmin){ $kopt='29';$koptD=$k29dd;if ($k29l<16) {$kdi="-";} else {$kdi='+';}}?>
<?php if ($dk3076==$kmin){ $kopt='30';$koptD=$k30dd;if ($k30l<16) {$kdi="-";} else {$kdi='+';}}?>



<?php
$dc176=de76($cl,$ca,$cb,$c1l,$c1a,$c1b);
  $dc276=de76($cl,$ca,$cb,$c2l,$c2a,$c2b);
  $dc376=de76($cl,$ca,$cb,$c3l,$c3a,$c3b);
  $dc476=de76($cl,$ca,$cb,$c4l,$c4a,$c4b);
  $dc576=de76($cl,$ca,$cb,$c5l,$c5a,$c5b);
  $dc676=de76($cl,$ca,$cb,$c6l,$c6a,$c6b);
  $dc776=de76($cl,$ca,$cb,$c7l,$c7a,$c7b);
  $dc876=de76($cl,$ca,$cb,$c8l,$c8a,$c8b);
  $dc976=de76($cl,$ca,$cb,$c9l,$c9a,$c9b);
  $dc1076=de76($cl,$ca,$cb,$c10l,$c10a,$c10b);
  $dc1176=de76($cl,$ca,$cb,$c11l,$c11a,$c11b);
  $dc1276=de76($cl,$ca,$cb,$c12l,$c12a,$c12b);
  $dc1376=de76($cl,$ca,$cb,$c13l,$c13a,$c13b);
  $dc1476=de76($cl,$ca,$cb,$c14l,$c14a,$c14b);
  $dc1576=de76($cl,$ca,$cb,$c15l,$c15a,$c15b);
  $dc1676=de76($cl,$ca,$cb,$c16l,$c16a,$c16b);
  $dc1776=de76($cl,$ca,$cb,$c17l,$c17a,$c17b);
  $dc1876=de76($cl,$ca,$cb,$c18l,$c18a,$c18b);
  $dc1976=de76($cl,$ca,$cb,$c19l,$c19a,$c19b);
  $dc2076=de76($cl,$ca,$cb,$c20l,$c20a,$c20b);
  $dc2176=de76($cl,$ca,$cb,$c21l,$c21a,$c21b);
  $dc2276=de76($cl,$ca,$cb,$c22l,$c22a,$c22b);
  $dc2376=de76($cl,$ca,$cb,$c23l,$c23a,$c23b);
  $dc2476=de76($cl,$ca,$cb,$c24l,$c24a,$c24b);
  $dc2576=de76($cl,$ca,$cb,$c25l,$c25a,$c25b);
  $dc2676=de76($cl,$ca,$cb,$c26l,$c26a,$c26b);
  $dc2776=de76($cl,$ca,$cb,$c27l,$c27a,$c27b);
  $dc2876=de76($cl,$ca,$cb,$c28l,$c28a,$c28b);
  $dc2976=de76($cl,$ca,$cb,$c29l,$c29a,$c29b);
  $dc3076=de76($cl,$ca,$cb,$c30l,$c30a,$c30b);
  $cmin=min($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
  
  ?>
<?php if ($dc176==$cmin){ $copt='1';$coptD=$c1dd;if ($c1b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc276==$cmin){ $copt='2';$coptD=$c2dd;if ($c2b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc376==$cmin){ $copt='3';$coptD=$c3dd;if ($c3b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc476==$cmin){ $copt='4';$coptD=$c4dd;if ($c4b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc576==$cmin){ $copt='5';$coptD=$c5dd;if ($c5b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc676==$cmin){ $copt='6';$coptD=$c6dd;if ($c6b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php  if ($dc776==$cmin){ $copt='7';$coptD=$c7dd;if ($c7b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc876==$cmin){ $copt='8';$coptD=$c8dd; if ($c8b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc976==$cmin){ $copt='9';$coptD=$c9dd;if ($c9b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1076==$cmin){ $copt='10';$coptD=$c10dd;if ($c10b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1176==$cmin){ $copt='11';$coptD=$c11dd;if ($c11b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1276==$cmin){ $copt='12';$coptD=$c12dd;if ($c12b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1376==$cmin){ $copt='13';$coptD=$c13dd;if ($c13b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1476==$cmin){ $copt='14';$coptD=$c14dd;if ($c14b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php  if ($dc1576==$cmin){ $copt='15';$coptD=$c15dd;if ($c15b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1676==$cmin){ $copt='16';$coptD=$c16dd;if ($c16b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1776==$cmin){ $copt='17';$coptD=$c17dd;if ($c17b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1876==$cmin){ $copt='18';$coptD=$c18dd;if ($c18b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc1976==$cmin){ $copt='19';$coptD=$c19dd;if ($c19b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2076==$cmin){ $copt='20';$coptD=$c20dd;if ($c20b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2176==$cmin){ $copt='21';$coptD=$c21dd;if ($c21b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2276==$cmin){ $copt='22';$coptD=$c22dd;if ($c22b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2376==$cmin){ $copt='23';$coptD=$c23dd;if ($c23b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2476==$cmin){ $copt='24';$coptD=$c24dd;if ($c24b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2576==$cmin){ $copt='25';$coptD=$c25dd;if ($c25b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2676==$cmin){ $copt='26';$coptD=$c26dd;if ($c26b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2776==$cmin){ $copt='27';$coptD=$c27dd;if ($c27b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2876==$cmin){ $copt='28';$coptD=$c28dd;if ($c28b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php if ($dc2976==$cmin){ $copt='29';$coptD=$c29dd;if ($c29b<-50) {$cdi="-";} else {$cdi='+';}}?>
<?php  if ($dc3076==$cmin){ $copt='30';$coptD=$c30dd;if ($c30b<-50) {$cdi="-";} else {$cdi='+';}} 

$dm176=de76($ml,$ma,$mb,$m1l,$m1a,$m1b);
  $dm276=de76($ml,$ma,$mb,$m2l,$m2a,$m2b);
  $dm376=de76($ml,$ma,$mb,$m3l,$m3a,$m3b);
  $dm476=de76($ml,$ma,$mb,$m4l,$m4a,$m4b);
  $dm576=de76($ml,$ma,$mb,$m5l,$m5a,$m5b);
  $dm676=de76($ml,$ma,$mb,$m6l,$m6a,$m6b);
  $dm776=de76($ml,$ma,$mb,$m7l,$m7a,$m7b);
  $dm876=de76($ml,$ma,$mb,$m8l,$m8a,$m8b);
  $dm976=de76($ml,$ma,$mb,$m9l,$m9a,$m9b);
  $dm1076=de76($ml,$ma,$mb,$m10l,$m10a,$m10b);
  $dm1176=de76($ml,$ma,$mb,$m11l,$m11a,$m11b);
  $dm1276=de76($ml,$ma,$mb,$m12l,$m12a,$m12b);
  $dm1376=de76($ml,$ma,$mb,$m13l,$m13a,$m13b);
  $dm1476=de76($ml,$ma,$mb,$m14l,$m14a,$m14b);
  $dm1576=de76($ml,$ma,$mb,$m15l,$m15a,$m15b);
  $dm1676=de76($ml,$ma,$mb,$m16l,$m16a,$m16b);
  $dm1776=de76($ml,$ma,$mb,$m17l,$m17a,$m17b);
  $dm1876=de76($ml,$ma,$mb,$m18l,$m18a,$m18b);
  $dm1976=de76($ml,$ma,$mb,$m19l,$m19a,$m19b);
  $dm2076=de76($ml,$ma,$mb,$m20l,$m20a,$m20b);
  $dm2176=de76($ml,$ma,$mb,$m21l,$m21a,$m21b);
  $dm2276=de76($ml,$ma,$mb,$m22l,$m22a,$m22b);
  $dm2376=de76($ml,$ma,$mb,$m23l,$m23a,$m23b);
  $dm2476=de76($ml,$ma,$mb,$m24l,$m24a,$m24b);
  $dm2576=de76($ml,$ma,$mb,$m25l,$m25a,$m25b);
  $dm2676=de76($ml,$ma,$mb,$m26l,$m26a,$m26b);
  $dm2776=de76($ml,$ma,$mb,$m27l,$m27a,$m27b);
  $dm2876=de76($ml,$ma,$mb,$m28l,$m28a,$m28b);
  $dm2976=de76($ml,$ma,$mb,$m29l,$m29a,$m29b);
  $dm3076=de76($ml,$ma,$mb,$m30l,$m30a,$m30b);
  $mmin=min($dm176,$dm276,$dm376,$dm476,$dm576,$dm676,$dm776,$dm876,$dm976,$dm1076,$dm1176,$dm1276,$dm1376,$dm1476,$dm1576,$dm1676,$dm1776,$dm1876,$dm1976,$dm2076,$dm2176,$dm2276,$dm2376,$dm2476,$dm2576,$dm2676,$dm2776,$dm2876,$dm2976,$dm3076);
  
  
  //$dm194=de94($ml,$ma,$mb,$m1l,$m1a,$m1b);
  

  ?>


<?php if ($dm176==$mmin){ $mopt='1';$moptD=$m1dd;if ($m1a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm276==$mmin){ $mopt='2';$moptD=$m2dd;if ($m2a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm376==$mmin){ $mopt='3';$moptD=$m3dd;if ($m3a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm476==$mmin){ $mopt='4';$moptD=$m4dd;if ($m4a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm576==$mmin){ $mopt='5';$moptD=$m5dd;if ($m5a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm676==$mmin){ $mopt='6';$moptD=$m6dd;if ($m6a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm776==$mmin){ $mopt='7';$moptD=$m7dd;if ($m7a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm876==$mmin){ $mopt='8';$moptD=$m8dd; if ($m8a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm976==$mmin){ $mopt='9';$moptD=$m9dd;if ($m9a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1076==$mmin){ $mopt='10';$moptD=$m10dd;if ($m10a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1176==$mmin){ $mopt='11';$moptD=$m11dd;if ($m11a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1276==$mmin){ $mopt='12';$moptD=$m12dd;if ($m12a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1376==$mmin){ $mopt='13';$moptD=$m13dd;if ($m13a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1476==$mmin){ $mopt='14';$moptD=$m14dd;if ($m14a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php  if ($dm1576==$mmin){ $mopt='15';$moptD=$m15dd;if ($m15a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1676==$mmin){ $mopt='16';$moptD=$m16dd;if ($m16a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1776==$mmin){ $mopt='17';$moptD=$m17dd;if ($m17a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1876==$mmin){ $mopt='18';$moptD=$m18dd;if ($m18a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm1976==$mmin){ $mopt='19';$moptD=$m19dd;if ($m19a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2076==$mmin){ $mopt='20';$moptD=$m20dd;if ($m20a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2176==$mmin){ $mopt='21';$moptD=$m21dd;if ($m21a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2276==$mmin){ $mopt='22';$moptD=$m22dd;if ($m22a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php  if ($dm2376==$mmin){ $mopt='23';$moptD=$m23dd;if ($m23a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2476==$mmin){ $mopt='24';$moptD=$m24dd;if ($m24a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2576==$mmin){ $mopt='25';$moptD=$m25dd;if ($m25a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2676==$mmin){ $mopt='26';$moptD=$m26dd;if ($m26a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2776==$mmin){ $mopt='27';$moptD=$m27dd;if ($m27a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2876==$mmin){ $mopt='28';$moptD=$m28dd;if ($m28a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php if ($dm2976==$mmin){ $mopt='29';$moptD=$m29dd;if ($m29a>74) {$mdi="-";} else {$mdi='+';}}?>
<?php  if ($dm3076==$mmin){ $mopt='30';$moptD=$m30dd;if ($m30a>74) {$mdi="-";} else {$mdi='+';}}$dy176=de76($yl,$ya,$yb,$y1l,$y1a,$y1b);
  $dy276=de76($yl,$ya,$yb,$y2l,$y2a,$y2b);
  $dy376=de76($yl,$ya,$yb,$y3l,$y3a,$y3b);
  $dy476=de76($yl,$ya,$yb,$y4l,$y4a,$y4b);
  $dy576=de76($yl,$ya,$yb,$y5l,$y5a,$y5b);
  $dy676=de76($yl,$ya,$yb,$y6l,$y6a,$y6b);
  $dy776=de76($yl,$ya,$yb,$y7l,$y7a,$y7b);
  $dy876=de76($yl,$ya,$yb,$y8l,$y8a,$y8b);
  $dy976=de76($yl,$ya,$yb,$y9l,$y9a,$y9b);
  $dy1076=de76($yl,$ya,$yb,$y10l,$y10a,$y10b);
  $dy1176=de76($yl,$ya,$yb,$y11l,$y11a,$y11b);
  $dy1276=de76($yl,$ya,$yb,$y12l,$y12a,$y12b);
  $dy1376=de76($yl,$ya,$yb,$y13l,$y13a,$y13b);
  $dy1476=de76($yl,$ya,$yb,$y14l,$y14a,$y14b);
  $dy1576=de76($yl,$ya,$yb,$y15l,$y15a,$y15b);
  $dy1676=de76($yl,$ya,$yb,$y16l,$y16a,$y16b);
  $dy1776=de76($yl,$ya,$yb,$y17l,$y17a,$y17b);
  $dy1876=de76($yl,$ya,$yb,$y18l,$y18a,$y18b);
  $dy1976=de76($yl,$ya,$yb,$y19l,$y19a,$y19b);
  $dy2076=de76($yl,$ya,$yb,$y20l,$y20a,$y20b);
  $dy2176=de76($yl,$ya,$yb,$y21l,$y21a,$y21b);
  $dy2276=de76($yl,$ya,$yb,$y22l,$y22a,$y22b);
  $dy2376=de76($yl,$ya,$yb,$y23l,$y23a,$y23b);
  $dy2476=de76($yl,$ya,$yb,$y24l,$y24a,$y24b);
  $dy2576=de76($yl,$ya,$yb,$y25l,$y25a,$y25b);
  $dy2676=de76($yl,$ya,$yb,$y26l,$y26a,$y26b);
  $dy2776=de76($yl,$ya,$yb,$y27l,$y27a,$y27b);
  $dy2876=de76($yl,$ya,$yb,$y28l,$y28a,$y28b);
  $dy2976=de76($yl,$ya,$yb,$y29l,$y29a,$y29b);
  $dy3076=de76($yl,$ya,$yb,$y30l,$y30a,$y30b);
  $ymin=min($dy176,$dy276,$dy376,$dy476,$dy576,$dy676,$dy776,$dy876,$dy976,$dy1076,$dy1176,$dy1276,$dy1376,$dy1476,$dy1576,$dy1676,$dy1776,$dy1876,$dy1976,$dy2076,$dy2176,$dy2276,$dy2376,$dy2476,$dy2576,$dy2676,$dy2776,$dy2876,$dy2976,$dy3076);
  
  
  //$dy194=de94($yl,$ya,$yb,$y1l,$y1a,$y1b);
  

  ?>

<?php if ($dy176==$ymin){ $yopt='1';$yoptD=$y1dd;if ($y1b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy276==$ymin){ $yopt='2';$yoptD=$y2dd;if ($y2b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy376==$ymin){ $yopt='3';$yoptD=$y3dd;if ($y3b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy476==$ymin){ $yopt='4';$yoptD=$y4dd;if ($y4b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy576==$ymin){ $yopt='5';$yoptD=$y5dd;if ($y5b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy676==$ymin){ $yopt='6';$yoptD=$y6dd;if ($y6b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php  if ($dy776==$ymin){ $yopt='7';$yoptD=$y7dd;if ($y7b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php  if ($dy876==$ymin){ $yopt='8';$yoptD=$y8dd; if ($y8b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy976==$ymin){ $yopt='9';$yoptD=$y9dd;if ($y9b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1076==$ymin){ $yopt='10';$yoptD=$y10dd;if ($y10b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1176==$ymin){ $yopt='11';$yoptD=$y11dd;if ($y11b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1276==$ymin){ $yopt='12';$yoptD=$y12dd;if ($y12b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1376==$ymin){ $yopt='13';$yoptD=$y13dd;if ($y13b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1476==$ymin){ $yopt='14';$yoptD=$y14dd;if ($y14b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php  if ($dy1576==$ymin){ $yopt='15';$yoptD=$y15dd;if ($y15b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1676==$ymin){ $yopt='16';$yoptD=$y16dd;if ($y16b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1776==$ymin){ $yopt='17';$yoptD=$y17dd;if ($y17b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1876==$ymin){ $yopt='18';$yoptD=$y18dd;if ($y18b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy1976==$ymin){ $yopt='19';$yoptD=$y19dd;if ($y19b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2076==$ymin){ $yopt='20';$yoptD=$y20dd;if ($y20b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2176==$ymin){ $yopt='21';$yoptD=$y21dd;if ($y21b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2276==$ymin){ $yopt='22';$yoptD=$y22dd;if ($y22b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php  if ($dy2376==$ymin){ $yopt='23';$yoptD=$y23dd;if ($y23b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2476==$ymin){ $yopt='24';$yoptD=$y24dd;if ($y24b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2576==$ymin){ $yopt='25';$yoptD=$y25dd;if ($y25b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2676==$ymin){ $yopt='26';$yoptD=$y26dd;if ($y26b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2776==$ymin){ $yopt='27';$yoptD=$y27dd;if ($y27b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2876==$ymin){ $yopt='28';$yoptD=$y28dd;if ($y28b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy2976==$ymin){ $yopt='29';$yoptD=$y29dd;if ($y29b>93) {$ydi="-";} else {$ydi='+';}}?>
<?php if ($dy3076==$ymin){ $yopt='30';$yoptD=$y30dd;if ($y30b>93) {$ydi="-";} else {$ydi='+';}}?>





  
   <table width="200" border="1" align="center">
<tr>

<?php // content="text/plain; charset=utf-8"

require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 



?>

<td>
<div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterC.png');
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');

$datax = array($c1dd,$c2dd,$c3dd,$c4dd,$c5dd,$c6dd,$c7dd,$c8dd,$c9dd,$c10dd,$c11dd,$c12dd,$c13dd,$c14dd,$c15dd,$c16dd,$c17dd,$c18dd,$c19dd,$c20dd,$c21dd,$c22dd,$c23dd,$c24dd,$c25dd,$c26dd,$c27dd,$c28dd,$c29dd,$c30dd);
$datay = array($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
$dataxT = array($coptD,$c100d);
$datayT = array($cmin,15);
//echo "dec00:".$dec00;
$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("C scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->xgrid->Show();

$sp1 = new ScatterPlot($datayT,$dataxT);

if ($dec00>5) {
$sp1->SetColor("red");
}
else {
$sp1->SetColor("black");
}

$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();

$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"#00ffff",2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("#00ffff");
$sp2->mark->SetWidth(3);

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

$graph->Add($sp1);
$graph->Add($sp2);
$graph->Stroke('scatterC.png');

?>
<img src="scatterC.png">
</div>
</td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterM.png');


$datax = array($m1dd,$m2dd,$m3dd,$m4dd,$m5dd,$m6dd,$m7dd,$m8dd,$m9dd,$m10dd,$m11dd,$m12dd,$m13dd,$m14dd,$m15dd,$m16dd,$m17dd,$m18dd,$m19dd,$m20dd,$m21dd,$m22dd,$m23dd,$m24dd,$m25dd,$m26dd,$m27dd,$m28dd,$m29dd,$m30dd);
$datay = array($dm176,$dm276,$dm376,$dm476,$dm576,$dm676,$dm776,$dm876,$dm976,$dm1076,$dm1176,$dm1276,$dm1376,$dm1476,$dm1576,$dm1676,$dm1776,$dm1876,$dm1976,$dm2076,$dm2176,$dm2276,$dm2376,$dm2476,$dm2576,$dm2676,$dm2776,$dm2876,$dm2976,$dm3076);
$dataxT = array($moptD,$m100d);
$datayT = array($mmin,15);

$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("M scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

$sp1 = new ScatterPlot($datayT,$dataxT);
if ($dem00>5) {
$sp1->SetColor("red");
}
else {
$sp1->SetColor("black");
}
$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();

$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"#ff99ff",2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("#ff99ff");
$sp2->mark->SetWidth(3);

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);


$graph->Add($sp1);
$graph->Add($sp2);
$graph->Stroke('scatterM.png');

?>
<img src="scatterM.png">
</div></td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterY.png');


$datax = array($y1dd,$y2dd,$y3dd,$y4dd,$y5dd,$y6dd,$y7dd,$y8dd,$y9dd,$y10dd,$y11dd,$y12dd,$y13dd,$y14dd,$y15dd,$y16dd,$y17dd,$y18dd,$y19dd,$y20dd,$y21dd,$y22dd,$y23dd,$y24dd,$y25dd,$y26dd,$y27dd,$y28dd,$y29dd,$y30dd);
$datay = array($dy176,$dy276,$dy376,$dy476,$dy576,$dy676,$dy776,$dy876,$dy976,$dy1076,$dy1176,$dy1276,$dy1376,$dy1476,$dy1576,$dy1676,$dy1776,$dy1876,$dy1976,$dy2076,$dy2176,$dy2276,$dy2376,$dy2476,$dy2576,$dy2676,$dy2776,$dy2876,$dy2976,$dy3076);
$dataxT = array($yoptD,$y100d);
$datayT = array($ymin,15);

$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("Y scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->xgrid->Show();

$sp1 = new ScatterPlot($datayT,$dataxT);
if ($dey00>5) {
$sp1->SetColor("red");
}
else {
$sp1->SetColor("black");
}
$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();

$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"#ffff99",2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("#ffff99");
$sp2->mark->SetWidth(3);

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

$graph->Add($sp1);
$graph->Add($sp2);
$graph->Stroke('scatterY.png');

?>
<img src="scatterY.png">
</div></td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterK.png');


$datax = array($k1dd,$k2dd,$k3dd,$k4dd,$k5dd,$k6dd,$k7dd,$k8dd,$k9dd,$k10dd,$k11dd,$k12dd,$k13dd,$k14dd,$k15dd,$k16dd,$k17dd,$k18dd,$k19dd,$k20dd,$k21dd,$k22dd,$k23dd,$k24dd,$k25dd,$k26dd,$k27dd,$k28dd,$k29dd,$k30dd);
$datay = array($dk176,$dk276,$dk376,$dk476,$dk576,$dk676,$dk776,$dk876,$dk976,$dk1076,$dk1176,$dk1276,$dk1376,$dk1476,$dk1576,$dk1676,$dk1776,$dk1876,$dk1976,$dk2076,$dk2176,$dk2276,$dk2376,$dk2476,$dk2576,$dk2676,$dk2776,$dk2876,$dk2976,$dk3076);

//print_r($datax);
$dataxT = array($koptD,$k100d);
$datayT = array($kmin,15);


$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("K scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);


$sp1 = new ScatterPlot($datayT,$dataxT);
if ($dek00>5) {
$sp1->SetColor("red");
}
else {
$sp1->SetColor("black");
}
$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();


$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"gray",2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("gray");
$sp2->mark->SetWidth(3);
//$sp2->xgrid->Show();

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

$graph->Add($sp1);
$graph->Add($sp2);


//$graph->AddLine($line);

$graph->Stroke('scatterK.png');
/////////////////////////////////////////////////beer's law 1980   
?>
<img src="scatterK.png">
</div></td>
</tr>
</table>
   
  
 <?php
////////////////////////////rule set 2

$TL=58;
$Ta=($Pa/2);
$Tb=($Pb/2);

$ML=round($dot[2446],2);
$Ma=round($dot[2447],2);
$Mb=round($dot[2447],2);

$de544=pow(pow(($ML-58),2)+pow(($Ta-$Ma),2)+pow(($Tb-$Mb),2),0.5);

$df=pow(pow(($Ta-$Ma),2)+pow(($Tb-$Mb),2),0.5);

 
$emin=100;
$mddexT=0;
$deT=0;
	

/////////////////////////////////////////////////////////////////////
for ($CD=45;$CD<=55;$CD=$CD+1) {
for ($MD=35;$MD<=45;$MD=$MD+1) {
for ($YD=35;$YD<=45;$YD=$YD+1) {
$dc=$CD-50;
$dm=$MD-40;
$dy=$YD-40;

$cc=$dc*0.3; //echo "cc:".$cc;
$cm=$dm*0.4;//echo "cm:".$cm;

if ($dy>1) {
$cy=0;
}
else {
$cy=1;	
}
//echo "cy:".$cy;

$mc=-$dc*0.6;//echo "mc:".$mc;
$mm=$dm*0.7;//echo "mm:".$mm;
if ($dy>1) {
$my=-$dy*0.1;
}
else {
$my=-$dy*0.2;	
}
//echo "my:".$my;

$yc=-$dc*0.4;
$ym=-$dm*0.2;
$yy=$dy*0.6;

${'C'.$CD.$MD.$YD."L"}=round($TL-($cc+$cm-$cy),1);
${'C'.$CD.$MD.$YD."a"}=round($Ta+($mc+$mm+$my),1);
${'C'.$CD.$MD.$YD."b"}=round($Tb+($yc+$ym+$yy),1);
${'de'.$CD.$MD.$YD}=round(de76($ML,$Ma,$Mb,$TL-($cc+$cm-$cy),$Ta+($mc+$mm+$my),$Tb+($yc+$ym+$yy)),2);

if (${'de'.$CD.$MD.$YD}<1) 
	{$fColor='red';}
else {
	$fColor='black';
}

	$emin=min($emin,${'de'.$CD.$MD.$YD});
	if ($emin==${'de'.$CD.$MD.$YD}) {
	$mddexT=$CD.$MD.$YD;
	$deT=${'de'.$CD.$MD.$YD};
	}



//echo "<tr><td>".$CD."-".$MD."-".$YD."</td><td>".${'C'.$CD.$MD.$YD."L"}."</td><td>".${'C'.$CD.$MD.$YD."a"}."</td><td>".${'C'.$CD.$MD.$YD."b"}."</td><td><font color='".$fColor."'>".${'de'.$CD.$MD.$YD}."</td></tr>";
///////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

echo "<br>mdexT:".$mddexT;

///////////////////////////////////////////////////////////Measured


$emin=100;
$mddexM=0;
$deM=0;

/////////////////////////////////////////////////////////////////////
for ($CD=45;$CD<=55;$CD=$CD+1) {
for ($MD=35;$MD<=45;$MD=$MD+1) {
for ($YD=35;$YD<=45;$YD=$YD+1) {
$dc=$CD-50;
$dm=$MD-40;
$dy=$YD-40;

$cc=$dc*0.3; //echo "cc:".$cc;
$cm=$dm*0.4;//echo "cm:".$cm;

if ($dy>1) {
$cy=0;
}
else {
$cy=1;	
}
//echo "cy:".$cy;

$mc=-$dc*0.6;//echo "mc:".$mc;
$mm=$dm*0.7;//echo "mm:".$mm;
if ($dy>1) {
$my=-$dy*0.1;
}
else {
$my=-$dy*0.2;	
}
//echo "my:".$my;

$yc=-$dc*0.4;
$ym=-$dm*0.2;
$yy=$dy*0.6;

${'C'.$CD.$MD.$YD."L"}=round($ML-($cc+$cm-$cy),1);
${'C'.$CD.$MD.$YD."a"}=round($Ma+($mc+$mm+$my),1);
${'C'.$CD.$MD.$YD."b"}=round($Mb+($yc+$ym+$yy),1);
${'de'.$CD.$MD.$YD}=round(de76($TL,$Ta,$Tb,$ML-($cc+$cm-$cy),$Ma+($mc+$mm+$my),$Mb+($yc+$ym+$yy)),2);

if (${'de'.$CD.$MD.$YD}<1) 
	{$fColor='red';}
else {
	$fColor='black';
}

	$emin=min($emin,${'de'.$CD.$MD.$YD});
	if ($emin==${'de'.$CD.$MD.$YD}) {
	$mddexM=$CD.$MD.$YD;
	$deM=${'de'.$CD.$MD.$YD};
	}



//echo "<tr><td>".$CD."-".$MD."-".$YD."</td><td>".${'C'.$CD.$MD.$YD."L"}."</td><td>".${'C'.$CD.$MD.$YD."a"}."</td><td>".${'C'.$CD.$MD.$YD."b"}."</td><td><font color='".$fColor."'>".${'de'.$CD.$MD.$YD}."</td></tr>";
///////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

echo "mdexM:".$mddexM;
echo "<br>deT=".$deT."_deM=".$deM;
if ($deT<$deM){
	$FinalF=$mddexT;
	$FC=50-substr($FinalF,0,-4);
	$FM=40-substr($FinalF,2,-2);
	$FY=40-substr($FinalF,-2);
}
else {
	$FinalF=$mddexM;
	$FC=substr($FinalF,0,-4)-50;
	$FM=substr($FinalF,2,-2)-40;
	$FY=substr($FinalF,-2)-40;
}
echo "FC:".$FC;
echo "FM:".$FM;
echo "FY:".$FY;

include 'graphFixG.php';
echo "<br>Fix:".$FinalF."<br>";
GenGraphT3(-$FC,-$FM,-$FY,0);
///////////////////////////////////// rule set 2
?>
<table width="300" border="1" align="center">
  <tr  align="right">
  	 <td  bgcolor="#cccccc"><?php echo "目標:</td><td>"."58"."</td><td>".($Pa/2)."</td><td>".($Pb/2)."</td><td>";?></td>
    </tr>
	
	 <tr  align="right">
  	 <td bgcolor="#cccccc"><?php echo "量測:</td><td>".$ML."</td><td>".$Ma."</td><td>".$Mb."</td><td>";?></td>
    </tr>
	 <tr  align="right">
  	 <td bgcolor="#cccccc"><?php echo "delta:</td><td>".round(($ML-58),2)."</td><td>".round(($Ma-($Pa/2)),2)."</td><td>".round(($Mb-($Pb/2)),2);?></td>
	 <td>df</td>
    </tr>	
		 <tr>
  	 <td bgcolor="#cccccc">色差:</td>
	 <td> <font color='<?php if ($de544>3){echo "red";} else {echo "black";}?>'><div align="right"><?php echo  round($de544,2);?></div></font></td>
	 <td></td><td>
	 <td> <font color='<?php if ($df>2.5){echo "red";}else {echo "black";}?>'><div align="right"><?php echo round($df,2)."";?></td>
	 <img src="graphT3.gif?nocache=<?php echo time(); ?>">
    </tr>
 </table>  


 
<tr>
<td align="center">TVI Score=<?php echo round($sum,2);?></a><br>
</td>
</tr>
<tr>
<td align="center">Primaries color score=<?php echo round($psum,2);?></a><br>
</td>
</tr>
<tr>

<td align="center">Total score=<?php echo round($Tsum,2);?></a><br>
</td>
</tr>
<tr>
<td align="center"> <a href="rank.php">Report</a><br>
</td>
<td align="center"> <a href="index.htm">MainPage</a><br>
</td>
</tr
<tr>
<td align="center"><font size="-2"> &copy; <a href="mailto:[email protected]">Fred Kuo</a>, 2014. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>
</tr>
</body>


</html>