vector2d QML Value Type
vector2d型はx属性とy属性を持つ。詳細...
詳細な説明
vector2d
型はx
とy
属性を持ち、それ以外はvector3d
型に似ている。
vector2d
型のプロパティは、デフォルト値としてゼロベクトルを持ちます。これはx
とy
の両方が0
に設定されています。
詳細については、vector3d
タイプに関するドキュメントを参照してください。
vector2d
の値を作成するには、"x,y" の文字列として指定するか、コンポーネントを個別に定義するか、Qt.vector2d() 関数で合成します。
vector2d型にはQMLで呼び出すことのできる以下のようなべき等関数があります:
関数のシグネチャ | 説明 | 例 |
---|---|---|
real dotProduct(vector2d other) | this vector2d とother vector2d のドット積のスカラー実数結果を返す。 | |
vector2d times(vector2d other) | this vector2d とother vector2d との乗算の vector2d 結果を返します。 | |
vector2d times(real factor) | this vector2d にスカラーを乗算した vector2d の結果を返します。factor | var a = Qt.vector2d(1,2); var b = 4.48; var c = a.times(b); console.log(c.toString()); // QVector2D(4.48, 8.96) |
vector2d plus(vector2d その他) | this vector2d とother vector2d を加算した vector2d の結果を返します。 | |
vector2d minus(vector2d other) | this vector2d からother vector2d を減算した vector2d の結果を返します。 | |
vector2d 正規化() | this vector の正規化形式を返す | var a = Qt.vector2d(1,2); var b = a.normalized(); console.log(b.toString()); // QVector2D(0.447214, 0.894427) |
real length() | this vector2d の長さのスカラー実数値を返す | var a = Qt.vector2d(1,2); var b = a.length(); console.log(b.toString()); // 2.23606797749979 |
vector3d toVector3d() | this vector2dをvector3dに変換した結果を返す | var a = Qt.vector2d(1,2); var b = a.toVector3d(); console.log(b.toString()); // QVector3D(1, 2, 0) |
vector4d toVector4d() | this vector2d を vector4d に変換した vector4d 結果を返します。 | var a = Qt.vector2d(1,2); var b = a.toVector4d(); console.log(b.toString()); // QVector4D(1, 2, 0, 0) |
bool fuzzyEquals(vector2d other, real epsilon) | this vector2d がother vector2d とほぼ等しい場合に真を返します。近似値は、this の各属性がother のepsilon 以内にある場合に真となります。epsilon はオプション引数であることに注意してください。デフォルトのepsilon は 0.00001 です。 |
この値型はQtQuick インポートによって提供されます。
QML Value Typesも参照してください 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.