loader image Authenticating...

Slope Varying Depends on two points

by Prabakaran 2012-05-02 14:53:32


$vx = $x2-$x1; //find vertex
$vy = $y2-$y1; //find vertex
$mag = sqrt($vx*$vx + $vy*$vy); // find distance from 2 points
$nvx = $vx/$mag; // normalized x
$nvy = $vy/$mag; // normalized y
//echo "$vx, $vy, $mag, $nvx, $nvy";

if($status == "decrease"){
$px = $x1+($nvx*($mag-$lt)); //new decreased x position
$py = $y1+($nvy*($mag-$lt)); //new decreased x position

//echo "
$px, $py
";
}
if($status == "increase"){
$px = $x1+($nvx*($mag+$lt)); //new decreased x position
$py = $y1+($nvy*($mag+$lt)); //new decreased x position

//echo "
$px, $py
";
}

?>
283
like
0
dislike
0
mail
flag

You must LOGIN to add comments