LlAtan2/ko
< LlAtan2
설명
함수: float llAtan2( float y, float x );반환되는 값은 y, x의 Error creating thumbnail: Unable to save thumbnail to destination arctan2.
| • float | y | |||
| • float | x |
사분면을 결정하기 위해 x와 y의 부호를 이용하는 것을 제외하고는 arctan(y/x)과 유사하다. x와 y가 영일 경우 영을 반환한다.
예제
<lsl>default {
state_entry()
{
float num1 = llFrand(100.0);
float num2 = llFrand(100.0);
llOwnerSay("y = " + (string)num1);
llOwnerSay("x = " + (string)num2);
llOwnerSay("The arctangent of y divided by x is " + (string)llAtan2(num1, num2));
}
}</lsl><lsl>//특정 방향 벡터를 입력값으로 하고 물체의 위치에서 본 해당 벡터의 방향을 반환하는 함수. //by Ramana Sweetwater 2009/01, any use allowed license :-)
string compass (vector target) {
vector me = llGetPos(); float distance = llVecDist(me, target); list DIRS =["W","NW","N","NE","E","SE","S","SW","W"]; return llList2String(DIRS,llCeil(4.5-((4*llAtan2((target.y-me.y)/distance,(target.x-me.x)/distance))/PI)));
}</lsl>
함께 보기
함수
| • llSin | llAsin | – | 사인과 역사인 | |
| • llCos | llAcos | – | 코사인과 역코사인 | |
| • llTan | – | 탄젠트 |
문서
| • | Error creating thumbnail: Unable to save thumbnail to destination Atan2 | |||
| • | Error creating thumbnail: Unable to save thumbnail to destination 역삼각함수 |
이 글이 유용하지 않으세요? LSL Wiki의 관련항목이 도움을 줄 수 있을 지도 모릅니다.