Difference between revisions of "LlRot2Axis"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
|func=llRot2Axis|sort=Rot2Axis
|func=llRot2Axis|sort=Rot2Axis
|return_type=vector|p1_type=rotation|p1_name=rot
|return_type=vector|p1_type=rotation|p1_name=rot
|func_footnote=Use in conjunction with {{LSLG|llRot2Angle}}.<br/>To undo use {{LSLG|llAxisAngle2Rot}}.
|func_footnote=Use in conjunction with {{LSLG|llRot2Angle}}.<br/>To undo use {{LSLG|llAxisAngle2Rot}} or {{LSLG|llAxes2Rot}}.
|func_desc
|func_desc
|return_text=the rotation axis represented by '''rot'''
|return_text=the rotation axis represented by '''rot'''
Line 9: Line 9:
|caveats
|caveats
|constants
|constants
|examples=<lsl>default
|examples
{
    state_entry()
    {
        rotation rTest=llAxisAngle2Rot(<0.0, 0.0, 1.0>, (90.0*DEG_TO_RAD));
        vector eTest=llRot2Euler(rTest)*RAD_TO_DEG;
 
        llOwnerSay((string) eTest);
 
        //Says <0.0, 0.0, 90.0> since it is rotating 90 degrees on the Z axis caused by the 1.0 placed in the Z vector spot.
    }
 
}</lsl>
 
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llRot2Angle]]}}
|also_functions={{LSL DefineRow||[[llRot2Angle]]}}
Line 41: Line 28:
|cat3
|cat3
|cat4
|cat4
|deepnotes=<source lang="lsl2">vector llRot2Axis(rotation a) {
    if(a.s < 0)
        return -llVecNorm(<a.x, a.y, a.z>);
    return llVecNorm(<a.x, a.y, a.z>)
}</source>
<source lang="lsl2">vector llRot2Axis(rotation a) {
    return llVecNorm(<a.x, a.y, a.z>) * (1 | -(a.s < 0));
}</source>
}}
}}

Latest revision as of 14:34, 22 January 2015

Summary

Function: vector llRot2Axis( rotation rot );

Returns a vector the rotation axis represented by rot

• rotation rot

Use in conjunction with llRot2Angle.
To undo use llAxisAngle2Rot or llAxes2Rot.

Examples

See Also

Functions

•  llRot2Angle
•  llAxisAngle2Rot
•  llRot2Left
•  llRot2Fwd
•  llRot2Up

Articles

•  Slerp

Deep Notes

vector llRot2Axis(rotation a) {
    if(a.s < 0)
        return -llVecNorm(<a.x, a.y, a.z>);
    return llVecNorm(<a.x, a.y, a.z>)
}
vector llRot2Axis(rotation a) {
    return llVecNorm(<a.x, a.y, a.z>) * (1 | -(a.s < 0));
}

Search JIRA for related Issues

Signature

function vector llRot2Axis( rotation rot );