Beispiel #1
0
 function Coordinates3($Px, $Py, $Qx, $Qy, $type = 'node')
 {
     if ($type == 'center') {
         $Cx = ($Px + $Qx) / 2;
         $Cy = ($Py + $Qy) / 2;
         list($C1x, $C1y) = Rotate($Cx, $Cy, $Px, $Py, 45);
         list($Rx, $Ry) = LinePoint($Cx, $Cy, $C1x, $C1y, 0.5);
     } else {
         $length = Length($Px, $Py, $Qx, $Qy);
         list($Rx, $Ry) = LinePoint($Px, $Py, $Qx, $Qy, $length + 0.5);
     }
     return array($Rx, $Ry);
 }
 function LabelCoordinates($P, $Q, $type = 'node')
 {
     if ($type == 'center') {
         $C[0] = ($P[0] + $Q[0]) / 2;
         $C[1] = ($P[1] + $Q[1]) / 2;
         list($C1[0], $C1[1]) = Rotate($C[0], $C[1], $P[0], $P[1], -45);
         list($R[0], $R[1]) = LinePoint($C[0], $C[1], $C1[0], $C1[1], 0.7);
     } elseif ($type == 'minus') {
         $length = Length($P[0], $P[1], $Q[0], $Q[1]);
         list($R[0], $R[1]) = LinePoint($P[0], $P[1], $Q[0], $Q[1], $length - 0.7);
     } else {
         $length = Length($P[0], $P[1], $Q[0], $Q[1]);
         list($R[0], $R[1]) = LinePoint($P[0], $P[1], $Q[0], $Q[1], $length + 0.7);
     }
     return $R;
 }