{Vector2d-of ordinate-type:Type} (クラス)
public final Vector2d-of
パッケージ: CURL.LANGUAGE.UNITS

不変の 2D ベクトル。

注意事項

ordinate-type は、double または Distance のような浮動小数点型でなければなりません。

コンストラクタ
default:コンポーネントから作成します。
コンストラクタ public {Vector2d-of.default x:ordinate-type, y:ordinate-type}
zero:値が 0 のフィールドを作成します。
ファクトリ public implicit inline {Vector2d-of.zero}:{this-class}

プロパティ
magnitude:この Vector2d-of の大きさを返します。
アクセサ public final Vector2d-of.magnitude:ordinate-type
u:Vector2d-of.x のシノニム
アクセサ public final inline Vector2d-of.u:ordinate-type
v:Vector2d-of.y のシノニム
アクセサ public final inline Vector2d-of.v:ordinate-type
x:ベクトルの最初の成分。
フィールド public constant Vector2d-of.x:ordinate-type
y:ベクトルの 2 番目の成分。
フィールド public constant Vector2d-of.y:ordinate-type
zero-magnitude?:ベクトルの大きさがゼロの場合は、true を返します。
アクセサ public final Vector2d-of.zero-magnitude?:bool

メソッド
direction:この Vector2d-of を正規化します (大きさで除算)。
public {Vector2d-of.direction
}:{Vector2d-of {compile-time-type-of {value let x:ordinate-type x / x} } }



コンストラクタ詳細
default (コンストラクタ)
public {Vector2d-of.default x:ordinate-type, y:ordinate-type}

コンポーネントから作成します。

説明

個々のコンポーネントからベクトルを作成します。


zero (ファクトリ)
public implicit inline {Vector2d-of.zero}:{this-class}

値が 0 のフィールドを作成します。

導入: バージョン 6.0



プロパティ詳細
magnitude (アクセサ)
アクセサ public final Vector2d-of.magnitude:ordinate-type

この Vector2d-of の大きさを返します。



u (アクセサ)
アクセサ public final inline Vector2d-of.u:ordinate-type

Vector2d-of.x のシノニム



v (アクセサ)
アクセサ public final inline Vector2d-of.v:ordinate-type

Vector2d-of.y のシノニム



x (フィールド)
public constant Vector2d-of.x:ordinate-type

ベクトルの最初の成分。



y (フィールド)
public constant Vector2d-of.y:ordinate-type

ベクトルの 2 番目の成分。



zero-magnitude? (アクセサ)
アクセサ public final Vector2d-of.zero-magnitude?:bool

ベクトルの大きさがゼロの場合は、true を返します。

説明

normalize によってスローされる例外を予想するために使用します。





メソッド詳細
direction (メソッド)
public {Vector2d-of.direction
}:{Vector2d-of {compile-time-type-of {value let x:ordinate-type x / x} } }

この Vector2d-of を正規化します (大きさで除算)。

注意事項

ベクトルの大きさが 0 の場合は、例外をスローします。

プログラミング注意事項

結果は単位なしです。v.magnitude * v.directionv は、浮動小数点エラーだけが異なります。