Difference between revisions of "LlEuler2Rot"
Jump to navigation
Jump to search
m |
m |
||
(15 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL Function | ||
|func_id=16|func_sleep=0.0|func_energy=10.0 | |func_id=16|func_sleep=0.0|func_energy=10.0 | ||
|func=llEuler2Rot|return_type=rotation|p1_type=vector|p1_name=v | |func=llEuler2Rot|return_type=rotation | ||
|p1_type=vector|p1_name=v|p1_desc=Angle | |||
|func_footnote | |func_footnote | ||
|func_desc | |func_desc | ||
|return_text=representation of Euler Angles | |return_text=representation of the {{Wikipedia|Euler Angles|w=n}} {{LSLP|v}}. | ||
|spec | |spec=The {{LSLGC|Euler}} angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes in Z, Y, X order. So <code>llEuler2Rot(<1.0, 2.0, 3.0> * [[DEG_TO_RAD]])</code> generates a rotation by first rotating 3 degrees around the global Z axis, then rotating the result around the global Y axis, and finally rotating that 1 degree around the global X axis. | ||
|caveats | |caveats | ||
|constants | |constants | ||
|examples=< | |examples=<source lang="lsl2">default | ||
default | |||
{ | { | ||
state_entry() | state_entry() | ||
{ | { | ||
vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD; | vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD; | ||
rotation rot = llEuler2Rot(input); | rotation rot = llEuler2Rot(input); | ||
llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot ); | llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot ); | ||
} | } | ||
} | }</source> | ||
</ | |||
|helpers | |helpers | ||
|also_functions={{LSL DefineRow||[[llRot2Euler]]|}} | |also_functions={{LSL DefineRow||[[llRot2Euler]]|}} | ||
|also_events | |also_events | ||
|also_tests | |also_tests | ||
|also_articles={{LSL DefineRow||{{Wikipedia| | |also_articles={{LSL DefineRow||{{Wikipedia|Euler Angles}}|}} | ||
|notes | |notes=<source lang="lsl2">v/=2; | ||
rotation k = <0.0, 0.0, llSin(v.z), llCos(v.z)> * <0.0, llSin(v.y), 0.0, llCos(v.y)> * <llSin(v.x), 0.0, 0.0, llCos(v.x)>;</source> | |||
|permission | |permission | ||
|negative_index | |negative_index | ||
|cat1=Math/3D | |cat1=Math/3D | ||
|cat2=Rotation | |cat2=Rotation | ||
|cat3= | |cat3=Euler | ||
|cat4 | |cat4 | ||
}} | }} |
Latest revision as of 15:46, 8 August 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation llEuler2Rot( vector v );16 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a rotation representation of the Euler Angles v.
• vector | v | – | Angle |
Specification
The Euler angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes in Z, Y, X order. So llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD)
generates a rotation by first rotating 3 degrees around the global Z axis, then rotating the result around the global Y axis, and finally rotating that 1 degree around the global X axis.
Caveats
Examples
default
{
state_entry()
{
vector input = <73.0, -63.0, 20.0> * DEG_TO_RAD;
rotation rot = llEuler2Rot(input);
llSay(0,"The Euler2Rot of "+(string)input+" is: "+(string)rot );
}
}
Notes
v/=2;
rotation k = <0.0, 0.0, llSin(v.z), llCos(v.z)> * <0.0, llSin(v.y), 0.0, llCos(v.y)> * <llSin(v.x), 0.0, 0.0, llCos(v.x)>;