Point4 クラスは、4D スペース(たとえば RGBA スペースなど)におけるポイントの特性を定義します。
これらの値には、4 要素の浮動小数点値が含まれており、赤、緑、青、アルファの値を要素とする浮動小数点カラー値を表現するのに使用できます。
また、Point4 値を含むパラメータのアニメーションを格納するため、いくつかの Point4 コントローラも導入されました。
リテラル
[<expr>, <expr>, <expr>, <expr>]
コンストラクタ
point4 <x> <y> <z> <w>
<color> as point4
プロパティ
<point4>.x: Float --the x component
<point4>.y: Float --the y component
<point4>.z: Float --the z component
<point4>.w: Float --the w component
演算子
<point4> == <point4>
<point4> != <point4>
<point4> + <point4_or_number>
<point4> - <point4_or_number>
<point4> * <point4_or_number>
<point4> / <point4_or_number>
標準のベクトル演算です。
2 番目のオペランドが数値の場合、演算は各コンポーネントの値に対して実行されます。
- <point4>
単項マイナス
<point4>[<integer>]
Point4 のコンポーネントを浮動小数点として返します。
インデックスで有効な範囲は 1 ~ 4 です。
<point4>[<integer>] = <float>
Point4 のコンポーネントを浮動小数点に設定します。
インデックスで有効な範囲は 1 ~ 4 です。
メソッド
copy <point4>
Point4 値の新しいコピーを作成します。
新しい値は入力 Point4 値のコピーを保持しており、入力 Point4 値からは独立しています。
例
oldValue = Point4 1.0 2.0 3.0 4.0--define a Point4 value [1,2,3,4] newValue1 = copy oldValue--create a copy of the value [1,2,3,4] newValue2 = oldValue--variable newValue2 points at the same value! [1,2,3,4] newValue2.x = 10.0--set the x component of the instance to 10 10.0 newValue2--see the result [10,2,3,4] oldValue--note that the original value was also changed! [10,2,3,4] newValue1--but the copy was independent and did not change! [1,2,3,4]
random <point4> <point4>
指定されたポイントの間に疑似乱数ポイントを生成します。
length <point4>
4D ベクトルの長さを返します。
distance <point4> <point4>
4D スペースのポイント間の距離を返します。
normalize <point4>
4D ベクトルの長さが 1 に等しくなるよう単位化された point4
値を返します。