当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF_STATIC::getVectorsAngle方法代码示例

本文整理汇总了PHP中TCPDF_STATIC::getVectorsAngle方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_STATIC::getVectorsAngle方法的具体用法?PHP TCPDF_STATIC::getVectorsAngle怎么用?PHP TCPDF_STATIC::getVectorsAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF_STATIC的用法示例。


在下文中一共展示了TCPDF_STATIC::getVectorsAngle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SVGPath


//.........这里部分代码省略.........
                         $y0 = $y;
                         $rx = abs($params[$ck - 6]);
                         $ry = abs($params[$ck - 5]);
                         $ang = -$rawparams[$ck - 4];
                         $angle = deg2rad($ang);
                         $fa = $rawparams[$ck - 3];
                         // large-arc-flag
                         $fs = $rawparams[$ck - 2];
                         // sweep-flag
                         $x = $params[$ck - 1] + $xoffset;
                         $y = $params[$ck] + $yoffset;
                         if (abs($x0 - $x) < $minlen and abs($y0 - $y) < $minlen) {
                             // endpoints are almost identical
                             $xmin = min($xmin, $x);
                             $ymin = min($ymin, $y);
                             $xmax = max($xmax, $x);
                             $ymax = max($ymax, $y);
                         } else {
                             $cos_ang = cos($angle);
                             $sin_ang = sin($angle);
                             $a = ($x0 - $x) / 2;
                             $b = ($y0 - $y) / 2;
                             $xa = $a * $cos_ang - $b * $sin_ang;
                             $ya = $a * $sin_ang + $b * $cos_ang;
                             $rx2 = $rx * $rx;
                             $ry2 = $ry * $ry;
                             $xa2 = $xa * $xa;
                             $ya2 = $ya * $ya;
                             $delta = $xa2 / $rx2 + $ya2 / $ry2;
                             if ($delta > 1) {
                                 $rx *= sqrt($delta);
                                 $ry *= sqrt($delta);
                                 $rx2 = $rx * $rx;
                                 $ry2 = $ry * $ry;
                             }
                             $numerator = $rx2 * $ry2 - $rx2 * $ya2 - $ry2 * $xa2;
                             if ($numerator < 0) {
                                 $root = 0;
                             } else {
                                 $root = sqrt($numerator / ($rx2 * $ya2 + $ry2 * $xa2));
                             }
                             if ($fa == $fs) {
                                 $root *= -1;
                             }
                             $cax = $root * ($rx * $ya / $ry);
                             $cay = -$root * ($ry * $xa / $rx);
                             // coordinates of ellipse center
                             $cx = $cax * $cos_ang - $cay * $sin_ang + ($x0 + $x) / 2;
                             $cy = $cax * $sin_ang + $cay * $cos_ang + ($y0 + $y) / 2;
                             // get angles
                             $angs = TCPDF_STATIC::getVectorsAngle(1, 0, ($xa - $cax) / $rx, ($cay - $ya) / $ry);
                             $dang = TCPDF_STATIC::getVectorsAngle(($xa - $cax) / $rx, ($ya - $cay) / $ry, (-$xa - $cax) / $rx, (-$ya - $cay) / $ry);
                             if ($fs == 0 and $dang > 0) {
                                 $dang -= 2 * M_PI;
                             } elseif ($fs == 1 and $dang < 0) {
                                 $dang += 2 * M_PI;
                             }
                             $angf = $angs - $dang;
                             if ($fs == 0 and $angs > $angf or $fs == 1 and $angs < $angf) {
                                 // reverse angles
                                 $tmp = $angs;
                                 $angs = $angf;
                                 $angf = $tmp;
                             }
                             $angs = round(rad2deg($angs), 6);
                             $angf = round(rad2deg($angf), 6);
                             // covent angles to positive values
                             if ($angs < 0 and $angf < 0) {
                                 $angs += 360;
                                 $angf += 360;
                             }
                             $pie = false;
                             if ($key == 0 and isset($paths[$key + 1][1]) and trim($paths[$key + 1][1]) == 'z') {
                                 $pie = true;
                             }
                             list($axmin, $aymin, $axmax, $aymax) = $this->_outellipticalarc($cx, $cy, $rx, $ry, $ang, $angs, $angf, $pie, 2, false, $fs == 0, true);
                             $xmin = min($xmin, $x, $axmin);
                             $ymin = min($ymin, $y, $aymin);
                             $xmax = max($xmax, $x, $axmax);
                             $ymax = max($ymax, $y, $aymax);
                         }
                         if ($relcoord) {
                             $xoffset = $x;
                             $yoffset = $y;
                         }
                     }
                 }
                 break;
             case 'Z':
                 $this->_out('h');
                 break;
         }
         $firstcmd = false;
     }
     // end foreach
     if (!empty($op)) {
         $this->_out($op);
     }
     return array($xmin, $ymin, $xmax - $xmin, $ymax - $ymin);
 }
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


注:本文中的TCPDF_STATIC::getVectorsAngle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。