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/deltaE/deltaEvrday.php
<!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>Displayer Check</title>
</head>

<body class="oneColElsCtr">
<?php

$L=$_POST["L"];
$a=$_POST["a"];
$b=$_POST["b"];

include 'lab2xyz.php';
function RGBToHex($r, $g, $b) {
//String padding bug found and the solution put forth by Pete Williams (http://snipplr.com/users/PeteW)
$hex = "#";
$hex.= str_pad(dechex($r), 2, "0", STR_PAD_LEFT);
$hex.= str_pad(dechex($g), 2, "0", STR_PAD_LEFT);
$hex.= str_pad(dechex($b), 2, "0", STR_PAD_LEFT);
 
return $hex;
}

function adj($C) {
  if (Abs($C) < 0.0031308) {
    return 12.92 * $C;
  }
  return 1.055 * Math.pow($C, 0.41666) - 0.055;
}

$chrome=80;

$L=58;
$a=-33;
$b=-45;
$myFile = "oF39WD.wrl";
//$icclab="upload/".$filename."T.ti1";
$fh = fopen($myFile, 'w') or die("can't open file");
//fwrite($fh, $p);


$viHead='#VRML V2.0 utf8

# Created by the Argyll CMS
Transform {
children [
	NavigationInfo {
		type "EXAMINE"        #  an object we examine
	} #  add our own light

    DirectionalLight {
        intensity 0.1
        ambientIntensity 0.1
        direction -1 -1 -1
    }
    DirectionalLight {
        intensity 0.3
        ambientIntensity 0.2
        direction 1 1 1
    }

    Viewpoint {
        position 0 0 250      # Position we view from
    }

# Lab axes as boxes:
Transform { translation -0.000000 -0.000000 0.000000
	children [
		Shape {
			geometry Box { size 2.000000 2.000000 100.000000 }
			appearance Appearance { material Material { diffuseColor 0.700000 0.700000 0.700000} }
		}
	]
}
Transform { translation 50.000000 -0.000000 -50.000000
	children [
		Shape {
			geometry Box { size 100.000000 2.000000 2.000000 }
			appearance Appearance { material Material { diffuseColor 1.000000 0.000000 0.000000} }
		}
	]
}
Transform { translation -0.000000 -50.000000 -50.000000
	children [
		Shape {
			geometry Box { size 2.000000 100.000000 2.000000 }
			appearance Appearance { material Material { diffuseColor 0.000000 0.000000 1.000000} }
		}
	]
}
Transform { translation -50.000000 -0.000000 -50.000000
	children [
		Shape {
			geometry Box { size 100.000000 2.000000 2.000000 }
			appearance Appearance { material Material { diffuseColor 0.000000 1.000000 0.000000} }
		}
	]
}
Transform { translation -0.000000 50.000000 -50.000000
	children [
		Shape {
			geometry Box { size 2.000000 100.000000 2.000000 }
			appearance Appearance { material Material { diffuseColor 1.000000 1.000000 0.000000} }
		}
	]
}
# Axes identification:
Transform { translation -2.000000 2.000000 60.000000
	children [
		Shape {
			geometry Text { string ["+L*"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 0.700000 0.700000 0.700000} }
		}
	]
}
Transform { translation -2.000000 2.000000 -60.000000
	children [
		Shape {
			geometry Text { string ["0"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 0.700000 0.700000 0.700000} }
		}
	]
}
Transform { translation 105.000000 -3.000000 -50.000000
	children [
		Shape {
			geometry Text { string ["+a*"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 1.000000 0.000000 0.000000} }
		}
	]
}
Transform { translation -5.000000 -110.000000 -50.000000
	children [
		Shape {
			geometry Text { string ["-b*"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 0.000000 0.000000 1.000000} }
		}
	]
}
Transform { translation -115.000000 -3.000000 -50.000000
	children [
		Shape {
			geometry Text { string ["-a*"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 0.000000 0.000000 1.000000} }
		}
	]
}
Transform { translation -5.000000 105.000000 -50.000000
	children [
		Shape {
			geometry Text { string ["+b*"]
				fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
				}
			appearance Appearance { material Material { diffuseColor 1.000000 1.000000 0.000000} }
		}
	]
}

Transform {
      translation 0 0 0
      children [
Shape {
	geometry IndexedLineSet {
		coord Coordinate {
                    point [
68 48 -3,#0R
22 -46 -26,#1B
-5 93 39,#2Y
-65 27 0,#3G
74 -3 -2,#4M
-37 -50 5,#5C
0.01 -2 45.000000,#6W
-0.01 -0.01 -34.000000,#7K
                    ]
                }
		color Color {
                    color [
                1.0 0.0 0.0,	#0red
				0.0 0.0 1.0,	#4blue
				1.0 1.0 0.0,	#1Y
				0.0 1.0 0.0,	#2green
				1.0 0.0 1.0,	#5m
				0.0 1.0 1.0,	#3C
			    1.0 1.0 1.0,	#6w
				0.0 0.0 0.0,	#7k
				 ]
            }
		coordIndex [
			 6, 0, -1,#r
			 6, 1, -1,#
			 6, 2, -1,#
			 6, 3, -1,#
			 6, 4, -1,#
			 6, 5, -1,#
			 7, 0, -1,
			 7, 1, -1,
			 7, 2, -1,
			 7, 3, -1,
			 7, 4, -1,
			 7, 5, -1,
			 0, 2, -1,
			 2, 3, -1,
			 3, 5, -1,
			 5, 1, -1,
			 1, 4, -1, 
			 4, 0, -1
			 
			]
		
			
	}
}

		
      ]
    }



    Transform {
      translation -0.246465 -0.201660 -50.000000
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 0.9 0.9 0.9 } }
		} 
      ]
    }

	    Transform {  #r
      translation 68 48 -3
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 0.9 0.0 0.0 } }
		} 
      ]
    }

		    Transform {  #b
      translation 22 -46 -26
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 0.0 0.0 1.0} }
		} 
      ]
    }

			    Transform {  #y
      translation -5 93 39
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 1.0 1.0 0.0} }
		} 
      ]
    }
	
				    Transform {  #y
      translation -65 27 0
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 0.0 1.0 0.0} }
		} 
      ]
    }
	
	 Transform {  #m
	      translation 74 -3 -2
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 1.0 0.0 1.0} }
		} 
      ]
    }';
fwrite($fh, $viHead);	
	$Lx=5;

	
	
	
	
	for ($i=1;$i<360;$i++){
			if ($i>55){
			$L=65;
		}
		if ($i>65){
			$L=70;
		}
		if ($i>75){
			$L=80;
		}
		if ($i>89){
			$L=89;
		}
		if ($i>120){
			$L=80;
		}
		if ($i>150){
			$L=70;
		}
		if ($i>180){
			$L=60;
		}
		
		
		$degree=deg2rad($i);
		$a=round(cos($degree)*$chrome,2);
		$b=round(sin($degree)*$chrome,2);
		$SXm=lab2xyz("x",$L,$a,$b);
		$SYm=lab2xyz("y",$L,$a,$b);
		$SZm=lab2xyz("z",$L,$a,$b);

		//echo "xyz:".$SXm."_".$SYm."_".$SZm."_<br>";

		$var_X = $SXm / 100.00;
		$var_Y = $SYm / 100.00;
		$var_Z = $SZm / 100.00;

		$var_R =  3.2404542*$var_X - 1.5371385*$var_Y - 0.4985314*$var_Z;
		$var_G = -0.9692660*$var_X + 1.8760108*$var_Y + 0.0415560*$var_Z;
		$var_B =  0.0556434*$var_X - 0.2040259*$var_Y + 1.0572252*$var_Z;

		//echo "var_R:".$var_R."_".$var_G."_".$var_B."_<br>";

		$var_R=round(adj($var_R),1);
		$var_G=round(adj($var_G),1);
		$var_B=round(adj($var_B),1);

		//echo "var_R2:".$var_R."_".$var_G."_".$var_B."_<br>";

		if ($var_R<0) {
		$var_R=0;	
		}
		if ($var_G<0) {
		$var_G=0;	
		}
		if ($var_B<0) {
		$var_B=0;	
		}
	$viHead1='
	Transform {  #c
	      translation '.$a." ".$b." ".$Lx.'
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor '.$var_R.' '.$var_G.' '.$var_B.'} }
		} 
      ]
    }';
fwrite($fh, $viHead1);	
	}
	
$viHead2='	
			 Transform {  #k
	      translation 0 0 -34
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 0.0 0.0 0.0} }
		} 
      ]
    }
	
				 Transform {  #w
	      translation 0 -2 45
      children [
		Shape { 
		 geometry Sphere { radius 2.0 }
        appearance Appearance { material Material { diffuseColor 1.0 1.0 1.0} }
		} 
      ]
    }
  


';


fwrite($fh, $viHead2);


$deltaHead='	

Transform {  #delta c
	      translation ';
		  
fwrite($fh, $deltaHead);	
$L1=$L-50;	  
if ($a<0 and $b<0) {    ///C 
$lab=$a." ".$b." ".$L1;
$ao=-37; $bo=-50; $Lo=55-50; $LT=55;
fwrite($fh, $lab);
$def76=de76(55,-37,-50,$L,$a,$b);
$newP='
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor 0.0 1.0 1.0} }
		} 
      ]
    }
';
}
elseif ($a>40) {     ////M
$lab=$a." ".$b." ".$L1;
$ao=73; $bo=-3; $Lo=48-50; $LT=48;
fwrite($fh, $lab);
$def76=de76(48,73,-3,$L,$a,$b);
$newP='
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor 1.0 0.0 1.0} }
		} 
      ]
    }
';
}
elseif ($b>40) {     /////Y
$lab=$a." ".$b." ".$L1;
$ao=-5; $bo=93; $Lo=89-50; $LT=89; 
fwrite($fh, $lab);
$def76=de76(89,-5,93,$L,$a,$b);
$newP='
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor 1.0 1.0 0.0} }
		} 
      ]
    }
';
}

elseif ($L<25) {    ////K
$lab=$a." ".$b." ".$L1;
$ao=0.1; $bo=0.1; $Lo=16-50; $LT=16;
fwrite($fh, $lab);
$def76=de76(16,0.1,0.1,$L,$a,$b);
$newP='
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor 0.0 0.0 0.0} }
		} 
      ]
    }
';
}

elseif ($L>80 and $b<20) {    ////P
$lab=$a." ".$b." ".$L1;
$ao=0.1; $bo=-2; $Lo=95-50; $LT=95;
fwrite($fh, $lab);
$def76=de76(95,0.1,-2,$L,$a,$b);
$newP='
      children [
		Shape { 
		 geometry Sphere { radius 1.0 }
        appearance Appearance { material Material { diffuseColor 0.0 0.0 0.0} }
		} 
      ]
    }
';
}


fwrite($fh, $newP);	


$lineset1=' Transform {
      translation 0 0 0
      children [
Shape {
	geometry IndexedLineSet {
		coord Coordinate {
                    point [
'.$ao.' '.$bo.' '.$Lo.',#0R
'.$a.' '.$b.' '.$L1.',#1B

                    ]
                }
		color Color {
                    color  [
                        1.0 0.0 0.0,	#red
				0.0 1.0 0.0,	#green
                        0.0 0.0 1.0,	#blue
                    ]
            }
		coordIndex [
			 0, 1, -1,	

			]
	}
		}

		
      ]
    }';


fwrite($fh, $lineset1);	




$deltaEnd='
] # end of children for world
  
 
}
';
fwrite($fh, $deltaEnd);			 
//fwrite($fh, $deltaEnd);	
		

//	fwrite($fh, $de76);		  
fclose($fh);
//sleep(2);
//////////////////////////////

  

function de76($l1,$a1,$b1,$l2,$a2,$b2) {
  $d76=sqrt(pow(($l1-$l2),2)+ pow(($a1-$a2),2)+pow(($b1-$b2),2));
  return round($d76,2);
}
	
$localIP = getHostByName(getHostName());
//window.location="http://".concat(<?php Print($_SERVER['SERVER_ADDR']); ?>get 3d viewer

	<SCRIPT LANGUAGE="JavaScript">
<!-- http://www.culturemark.com/redirectURL/
window.location="http://".concat("<?php Print $localIP ; ?>","/deltaE/oF39WD.wrl");
// -->
</script> 
</table>

<tr>

<br />
<td align="center"><font size="-2"> &copy; <a href="mailto:[email protected]">Fred Kuo</a>, 2010. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>


</tr>
</body>


</html>