OsAngleBetween

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Add exemple)
Line 4: Line 4:
 
|delay=0
 
|delay=0
 
|function_syntax=float osAngleBetween(vector a, vector b);
 
|function_syntax=float osAngleBetween(vector a, vector b);
|ossl_example=
 
 
|description=returns a angle between 0 and PI
 
|description=returns a angle between 0 and PI
 +
|ossl_example=<source lang="lsl">
 +
//
 +
// osAngleBetween Script Example
 +
//
 +
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osAngleBetween usage.");
 +
    }
 +
 +
    touch_start(integer number)
 +
    {
 +
        vector input_a = <1.0, 2.0, 3.0>;
 +
        vector input_b = <3.0, 2.0, 1.0>;
 +
        float angle = osAngleBetween(input_a, input_b);
 +
 +
        llSay(PUBLIC_CHANNEL, "The angle (0.0 and PI) between " + (string)input_a + " and " + (string)input_b
 +
            + " is " + (string)(angle) + " in degrees and " + (string)(angle * DEG_TO_RAD) + " in radians.");
 +
    }
 +
}
 +
</source>
 
|additional_info=Implemented April 4, 2018 by Ubit Umarov in GIT# e031d79d48cb4cb42ccb160d2894d078f835eb10 - Commit e031d7
 
|additional_info=Implemented April 4, 2018 by Ubit Umarov in GIT# e031d79d48cb4cb42ccb160d2894d078f835eb10 - Commit e031d7
 
}}
 
}}

Revision as of 09:54, 26 November 2020

float osAngleBetween(vector a, vector b);
returns a angle between 0 and PI
Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osAngleBetween Script Example
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osAngleBetween usage.");
    }
 
    touch_start(integer number) 
    {
        vector input_a = <1.0, 2.0, 3.0>;
        vector input_b = <3.0, 2.0, 1.0>;
        float angle = osAngleBetween(input_a, input_b);
 
        llSay(PUBLIC_CHANNEL, "The angle (0.0 and PI) between " + (string)input_a + " and " + (string)input_b 
            + " is " + (string)(angle) + " in degrees and " + (string)(angle * DEG_TO_RAD) + " in radians.");
    }
}
Notes
Implemented April 4, 2018 by Ubit Umarov in GIT# e031d79d48cb4cb42ccb160d2894d078f835eb10 - Commit e031d7
Personal tools
General
About This Wiki