LlAtan2/ja

From Second Life Wiki
< LlAtan2
Revision as of 06:28, 20 April 2009 by MasterOf Perl (talk | contribs) (Initial translation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

要約

関数: float llAtan2( float y, float x );

y, x の"Wikipedia logo"arctangent2を float で返します。

• float y
• float x

通常のアークタンジェント (arctangent(y/x)) に似ていますが、象限を定めるために x と y の値を個別にとる点が異なります。x, y ともに 0 の場合 0 を返します。

サンプル

<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>//方向を示す vector 値を受け取り、その方角を文字で返す関数。 //by Ramana Sweetwater 2009/01, ご自由にお使いください。

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 タンジェント

記事

•  "Wikipedia logo"三角関数

特記事項

Search JIRA for related Issues

Signature

function float llAtan2( float y, float x );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。