Vector2 — Aspose.3D FOSS for Java

Example

Vector2 は、倍精度の2成分ベクトルで、 x および y 成分です。主にUVテクスチャ座標および2D計算に使用されます。.

Example: com.aspose.threed

import com.aspose.threed.*;

Vector2 uv = new Vector2(0.5, 0.75);

Example

ExampleExample
Vector2()ゼロベクトルを作成します (0, 0)
Vector2(double x, double y)2つの成分から作成します
Vector2(Vector2 other)コピーコンストラクタ

公開フィールド

Vector2 使用します 公開フィールド コンポーネントへのアクセス用(getter/setter メソッドではなく):

ExampleExampleExampleExample
xdoublev.xX 成分
ydoublev.yY 成分

計算プロパティ

ExampleExampleExampleExample
lengthdoublegetLength()ユークリッド長、読み取り専用
length2doublegetLength2()二乗長、読み取り専用

Example

Example戻り値の型Example
dot(Vector2 rhs)double他のベクトルとのドット積 Vector2
normalize()Vector2単位長さのコピーを返す
set(double x, double y)void両方のコンポーネントをその場で設定
compareTo(Vector2 other)int辞書式比較: -1、0、または1を返す

Example

import com.aspose.threed.*;

Vector2 a = new Vector2(1.0, 0.0);
Vector2 b = new Vector2(0.0, 1.0);

double dot = a.dot(b);           // 0.0
Vector2 norm = a.normalize();     // Vector2(1.0, 0.0)
System.out.println(a.getLength());  // 1.0

参照

 日本語