nah itu tampilan programnya terdapat 4 titik koordina awal, selanjutnya kita bisa mencari titik koordinat baru dengan menggunakan penghitungan translasi, skala sampai shear sumbu x dan y.
dan ini scripnya
<!DOCTYPE html>
<?php
error_reporting(E_ALL ^
E_NOTICE);
$a=$_POST["a"]; $b=$_POST['b']; $c=$_POST['c']; $d=$_POST['d'];
$a1=$_POST["a1"]; $b1=$_POST['b1'];
$c1=$_POST['c1']; $d1=$_POST['d1'];
$x=$_POST["x"]; $rotasi=$_POST['rotasi'];
$y=$_POST["y"]; $sh=$_POST['sh'];
?>
<html>
<head>
<title></title>
</head>
<body>
<h1><B><U>TRANSFORMASI
2D</U></B></h1>
<form
method="post" action="?">
Diketahui beberapa titik
koordinat, sebagai berikut : <br>
A = ( <input type="text"
name="a" value="<?php echo $_POST["a"] ?>"
required> , <input type="text" name="a1"
value="<?php echo $_POST["a1"] ?>" required>
)<br>
B = ( <input type="text"
name="b" value="<?php echo $_POST["b"] ?>"
required> , <input type="text" name="b1"
value="<?php echo $_POST["b1"] ?>" required>
)<br>
C = ( <input type="text"
name="c" value="<?php echo $_POST["c"] ?>"
required> , <input type="text" name="c1"
value="<?php echo $_POST["c1"] ?>" required>
)<br>
D = ( <input type="text"
name="d" value="<?php echo $_POST["d"] ?>"
required> , <input type="text" name="d1"
value="<?php echo $_POST["d1"] ?>" required>
)<br>
<hr>
Tentukan Koordinat baru
dengan :
<br>faktor
tranlasi/skala/titik pusat ( <input type="text" name="x"
value="<?php echo $_POST["x"] ?>"> , <input
type="text" name="y" value="<?php echo
$_POST["y"] ?>"> )
<br>besar drajat
(jika akan di rotasi) ( <input type="text" name="rotasi"
value="<?php echo $_POST["rotasi"] ?>">) drajat
<br>besar shear
(jika akan di shear) ( <input type="text" name="sh"
value="<?php echo $_POST["sh"] ?>">)
<br>Dengan
menggunakan metode
<select
name="dropdown">
<option value="">- Pilih
-</option>
<option
value="trans">Translansi</option>
<option
value="skala">Skala</option>
<option
value="rot">Rotasi</option>
<option value="shx">Shear
sb x</option>
<option value="shy">Shear
sb y</option>
</select>
<input
type="submit" value="Hitung"><br>
<p><b><u>Titik
koordinat baru :</u></b></p>
</form>
<?php
error_reporting(E_ALL ^
E_NOTICE);
switch
($_POST['dropdown']) {
case "trans":
if(($x==null)||($y==null)){
echo "<b>Faktor tranlasi Tidak
Boleh Kosong";
}else{
$AX = $a+$x;
$AY = $a1+$y;
$BX = $b+$x;
$BY = $b1+$y;
$CX = $c+$x;
$CY = $c1+$y;
$DX = $d+$x;
$DY = $d1+$y;
?>
A' = ( <input type="text"
name="hasil"
value="<?=$AX;?>">,<input type="text"
name="hasil"
value="<?=$AY;?>">) <br>
B' = ( <input type="text"
name="hasil"
value="<?=$BX;?>">,<input type="text"
name="hasil"
value="<?=$BY;?>">) <br>
C' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$CY;?>">) <br>
D' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$DY;?>">)<br>
<?php
}
break;
case "skala":
if(($x==null)||($y==null)){
echo "<b>Faktor skala Tidak
Boleh Kosong";
}else{
$AX
= $a*$x;
$AY = $a1*$y;
$BX = $b*$x;
$BY = $b1*$y;
$CX = $c*$x;
$CY = $c1*$y;
$DX = $d*$x;
$DY = $d1*$y;
?>
A' = ( <input type="text"
name="hasil"
value="<?=$AX;?>">,<input type="text"
name="hasil" value="<?=$AY;?>">)
<br>
B' = ( <input type="text"
name="hasil"
value="<?=$BX;?>">,<input type="text"
name="hasil"
value="<?=$BY;?>">) <br>
C' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$CY;?>">) <br>
D' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$DY;?>">)<br>
<?php
}
break;
case "rot":
if($rotasi==null){
echo "<b>Rotasi (besar drajat)
Tidak Boleh Kosong";
}elseif(($x==null)||($y==null)){
echo "<b>Titik Pusat Tidak
Boleh Kosong";
}else{
$AX = round($x+($a-$x)*cos($rotasi) -
($a1-$y)*sin($rotasi),0);
$AY = round($y+($a-$x)*sin($rotasi) +
($a1-$y)*cos($rotasi),0);
$BX = round($x+($b-$x)*cos($rotasi) -
($b1-$y)*sin($rotasi),0);
$BY = round($y+($b-$x)*sin($rotasi) +
($b1-$y)*cos($rotasi),0);
$CX = round($x+($c-$x)*cos($rotasi) -
($c1-$y)*sin($rotasi),0);
$CY = round($y+($c-$x)*sin($rotasi) +
($c1-$y)*cos($rotasi),0);
$DX = round($x+($d-$x)*cos($rotasi) -
($d1-$y)*sin($rotasi),0);
$DY = round($y+($d-$x)*sin($rotasi) +
($d1-$y)*cos($rotasi),0);
?>
A'' = ( <input type="text"
name="hasil"
value="<?=$AX;?>">,<input type="text"
name="hasil" value="<?=$AY;?>">)
<br>
B'' = ( <input type="text"
name="hasil"
value="<?=$BX;?>">,<input type="text"
name="hasil"
value="<?=$BY;?>">) <br>
C'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$CY;?>">) <br>
D'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$DY;?>">)<br>
<?php
}
break;
case "shx":
if($sh==null){
echo "<b>Nilai shear Tidak
Boleh Kosong";
}else{
$AY =$a1;
$AX =$a + $sh*$AY;
$BY =$b1;
$BX =$b + $sh*$BY;
$CY =$c1;
$CX =$c + $sh*$CY;
$DY =$d1;
$DX =$d + $sh*$DY;
?>
A'' = ( <input type="text"
name="hasil"
value="<?=$AX;?>">,<input type="text" name="hasil" value="<?=$AY;?>">)
<br>
B'' = ( <input type="text"
name="hasil"
value="<?=$BX;?>">,<input type="text"
name="hasil"
value="<?=$BY;?>">) <br>
C'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$CY;?>">) <br>
D'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$DY;?>">)<br>
<?php
}
break;
case "shy":
if($sh==null){
echo "<b>Nilai shear Tidak
Boleh Kosong";
}else{
$AX =$a;
$AY =$a + $sh*$AX;
$BX =$b;
$BY =$b + $sh*$BX;
$CX =$c;
$CY =$c + $sh*$CX;
$DX =$d;
$DY =$d + $sh*$DX;
?>
A'' = ( <input type="text"
name="hasil"
value="<?=$AX;?>">,<input type="text"
name="hasil"
value="<?=$AY;?>">) <br>
B'' = ( <input type="text"
name="hasil"
value="<?=$BX;?>">,<input type="text"
name="hasil"
value="<?=$BY;?>">) <br>
C'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$CY;?>">) <br>
D'' = ( <input type="text"
name="hasil"
value="<?=$CX;?>">,<input type="text"
name="hasil"
value="<?=$DY;?>">)<br>
<?php
}
break;
default:
echo "<b>pilih salah satu aksi
<br>";
}
?></body></html>
![](http://1.bp.blogspot.com/-NwD8NpT8WkM/UQrXdZDnoYI/AAAAAAAABas/BcdXX4cGths/s000/noimage.png)
Any feedback, questions or ideas are always welcome. In case you are posting Code ,then first escape it using Postify and then paste it in the comments
0 comments: