Angle.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Measure
  17. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /**
  22. * Implement needed classes
  23. */
  24. #require_once 'Zend/Measure/Abstract.php';
  25. #require_once 'Zend/Locale.php';
  26. /**
  27. * Class for handling angle conversions
  28. *
  29. * @category Zend
  30. * @package Zend_Measure
  31. * @subpackage Zend_Measure_Angle
  32. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Measure_Angle extends Zend_Measure_Abstract
  36. {
  37. const STANDARD = 'RADIAN';
  38. const RADIAN = 'RADIAN';
  39. const MIL = 'MIL';
  40. const GRAD = 'GRAD';
  41. const DEGREE = 'DEGREE';
  42. const MINUTE = 'MINUTE';
  43. const SECOND = 'SECOND';
  44. const POINT = 'POINT';
  45. const CIRCLE_16 = 'CIRCLE_16';
  46. const CIRCLE_10 = 'CIRCLE_10';
  47. const CIRCLE_8 = 'CIRCLE_8';
  48. const CIRCLE_6 = 'CIRCLE_6';
  49. const CIRCLE_4 = 'CIRCLE_4';
  50. const CIRCLE_2 = 'CIRCLE_2';
  51. const FULL_CIRCLE = 'FULL_CIRCLE';
  52. /**
  53. * Calculations for all angle units
  54. *
  55. * @var array
  56. */
  57. protected $_units = array(
  58. 'RADIAN' => array('1','rad'),
  59. 'MIL' => array(array('' => M_PI,'/' => '3200'), 'mil'),
  60. 'GRAD' => array(array('' => M_PI,'/' => '200'), 'gr'),
  61. 'DEGREE' => array(array('' => M_PI,'/' => '180'), '°'),
  62. 'MINUTE' => array(array('' => M_PI,'/' => '10800'), "'"),
  63. 'SECOND' => array(array('' => M_PI,'/' => '648000'), '"'),
  64. 'POINT' => array(array('' => M_PI,'/' => '16'), 'pt'),
  65. 'CIRCLE_16' => array(array('' => M_PI,'/' => '8'), 'per 16 circle'),
  66. 'CIRCLE_10' => array(array('' => M_PI,'/' => '5'), 'per 10 circle'),
  67. 'CIRCLE_8' => array(array('' => M_PI,'/' => '4'), 'per 8 circle'),
  68. 'CIRCLE_6' => array(array('' => M_PI,'/' => '3'), 'per 6 circle'),
  69. 'CIRCLE_4' => array(array('' => M_PI,'/' => '2'), 'per 4 circle'),
  70. 'CIRCLE_2' => array(M_PI, 'per 2 circle'),
  71. 'FULL_CIRCLE' => array(array('' => M_PI,'*' => '2'), 'cir'),
  72. 'STANDARD' => 'RADIAN'
  73. );
  74. }