File: C:/xampp/htdocs/PSA/deltaEvr.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
$myFile = "oF39W.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} }
}
]
}
Transform { #c
translation -37 -50 5
children [
Shape {
geometry Sphere { radius 2.0 }
appearance Appearance { material Material { diffuseColor 0.0 1.0 1.0} }
}
]
}
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, $viHead);
$deltaHead='
Transform { #delta c
translation ';
fwrite($fh, $deltaHead);
$L1=$L-50;
if ($a<0 and $b<0) {
$lab=$a." ".$b." ".$L1;
$ao=-37; $bo=-50; $Lo=55-50;
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) {
$lab=$a." ".$b." ".$L1;
$ao=73; $bo=-3; $Lo=48-50;
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) {
$lab=$a." ".$b." ".$L1;
$ao=-5; $bo=93; $Lo=89-50;
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) {
$lab=$a." ".$b." ".$L1;
$ao=0.1; $bo=0.1; $Lo=16-50;
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} }
}
]
}
';
}
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='
Transform {
translation -70 -80 4
children [
Shape {
geometry Text { string ["Delta E='.$def76.'"]
fontStyle FontStyle { family "SANS" style "BOLD" size 10.000000 }
}
appearance Appearance { material Material { diffuseColor 0.700000 0.700000 0.700000} }
}
]
}
] # 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);
}
?>
<SCRIPT LANGUAGE="JavaScript">
<!-- http://www.culturemark.com/redirectURL/
window.location="http://127.0.0.1/deltaE/oF39W.wrl";
// -->
</script>
</table>
<tr>
<br />
<td align="center"><font size="-2"> © <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>