OsAngleBetween

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|permissions=true
 
|permissions=true
 
|delay=0
 
|delay=0
|function_syntax=integer 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 not -pi to pi.
+
|ossl_example=<source lang="lsl">
|additional_info=Implemented April 4, 2018 in httptests branch by Ubit Umarov in GIT# e031d79d48cb4cb42ccb160d2894d078f835eb10 - Commit e031d7
+
//
 +
// osAngleBetween Script Example
 +
// Author: djphil
 +
//
 +
 +
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
 
}}
 
}}

Latest revision as of 05:26, 3 January 2021

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
// Author: djphil
//
 
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