⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extmath.as

📁 Flash8.0 ActionScript2.0 Math类的扩展
💻 AS
字号:
class as.com.ExtMath extends Math
{
    function ExtMath()
    {
        super();
    } // End of the function
    static function distance(x1, y1, x2, y2)
    {
        var _loc2 = x2 - x1;
        var _loc1 = y2 - y1;
        return (Math.sqrt(_loc2 * _loc2 + _loc1 * _loc1));
    } // End of the function
	static function distance2(x1, y1, x2, y2)
    {
        var _loc2 = x2 - x1;
        var _loc1 = y2 - y1;
        return (_loc2 * _loc2 + _loc1 * _loc1);
    } // End of the function
    static function degreesToRadians(angle)
    {
        return (angle * 1.745329E-002);
    } // End of the function
    static function radiansToDegrees(angle)
    {
        return (angle * 5.729578E+001);
    } // End of the function
    static function sinD(angle)
    {
        return (Math.sin(angle * 3.141593E+000 / 180));
    } // End of the function
    static function asinD(ratio)
    {
        return (Math.asin(ratio) * 5.729578E+001);
    } // End of the function
    static function cosD(angle)
    {
        return (Math.cos(angle * 3.141593E+000 / 180));
    } // End of the function
    static function acosD(ratio)
    {
        return (Math.acos(ratio) * 5.729578E+001);
    } // End of the function
    static function tanD(angle)
    {
        return (Math.tan(angle * 3.141593E+000 / 180));
    } // End of the function
    static function atan2D(y, x)
    {
        return (Math.atan2(y, x) * 5.729578E+001);
    } // End of the function
    static function angleOfLine(x1, y1, x2, y2)
    {
        return (ExtMath.atan2D(y2 - y1, x2 - x1));
    } // End of the function
    static function fixAngle(angle)
    {
        angle = angle % 360;
        return (angle % 360 < 0 ? (angle + 360) : (angle));
    } // End of the function
    static function cartesianToFlash(o)
    {
        o._y = o._y * -1;
        o._rotation = o._rotation * -1;
    } // End of the function
    static function flashToCartesian(o)
    {
        return (ExtMath.cartesianToFlash(o));
    } // End of the function
    static function cartesianToPolar(p)
    {
        var _loc3 = Math.sqrt(p.x * p.x + p.y * p.y);
        var _loc2 = ExtMath.atan2D(p.y, p.x);
        return ({r: _loc3, t: _loc2});
    } // End of the function
    static function polarToCartesian(p)
    {
        var _loc3 = p.r * ExtMath.cosD(p.t);
        var _loc2 = p.r * ExtMath.sinD(p.t);
        return ({x: _loc3, y: _loc2});
    } // End of the function
	
    static var __proto__ = Math;
	
} // End of Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -