Point2 クラスは、2D スペースにおけるポイントの特性を定義します。
このクラスは Point3 の 2 次元版で、パラメータを配置するユーティリティ ロールアウトや、Bitmap 値にアクセスする場合などに使用されます。
「2 次元および 3 次元ポイント リテラル」も参照してください。
リテラル
[<expr>, <expr>]
例:
[x, y] [10, 20] [sin x, cos x]
コンストラクタ
point2 <x> <y>-- x and y are numbers
<point3> as point2-- created from the x and y components of the point3
プロパティ
<point2>.x: Float
<point2>.y: Float
演算子
<point2> == <point2>
<point2> != <point2>
<point2> + <point2_or_number>
<point2> - <point2_or_number>
<point2> * <point2_or_number>
<point2> / <point2_or_number>
標準のベクトル演算です。2 番目のオペランドが数値の場合は、ベクトルにスカラー算術が適用されます。
-<point2>
単項マイナス
<point2>[<integer>]
Point2 のコンポーネントを浮動小数点として返します。インデックスで有効な範囲は 1 ~ 2 です。
<point2>[<integer>]=<float>
Point2 のコンポーネントを浮動小数点に設定します。インデックスで有効な範囲は 1 ~ 2 です。
メソッド
copy <point2>
point2 値の新しいコピーを作成します。
例
newPoint = copy oldPoint
新しい値には、入力値 point2 のコピーが保持されます。このコピー値は入力値 point2 から独立しています。
random <point2> <point2>
指定されたポイントの間に疑似乱数ポイントを生成します。
length
ベクトルの長さを返します。
distance <point2> <point2>
ポイント間の距離、つまり(point 2 - point 1)の長さを返します。
normalize <point2>
ベクトルの長さが 1 に等しい、平均化された point2
値を返します。