vector3d QML Value Type

x, y, z属性を持つ値。詳細...

詳細説明

vector3d 型は、xyz 属性を持つ値を指します。

vector3d タイプのプロパティは、デフォルトでゼロベクトルを持ちます。これにはx,y,z0 に設定されています。

vector3d 値を作成するには、"x,y,z" 文字列として指定します:

Rotation { angle: 60; axis: "0,1,0" }

またはQt.vector3d() 関数で指定します:

Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }

または、xyz の各コンポーネントとして指定します:

Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }

vector3d 値の各属性は、内部的には単精度浮動小数点数 (float) として保存されます。

C++ と統合する場合、C++ から QML に渡された QVector3D の値は自動的にvector3d の値に変換されます。

vector3d型は以下のようなべき等関数を持ち、QMLから呼び出すことができます:

関数のシグネチャ説明
vector3d crossProduct(vector3d other)this vector3d とother vector3d の cross product の vector3d 結果を返します。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(4,5,6);
var c = a.crossProduct(b);
console.log(c.toString()); // QVector3D(-3, 6, -3)
real dotProduct(vector3d other)this vector3d とother vector3d との内積のスカラー実数結果を返します。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(4,5,6);
var c = a.dotProduct(b);
console.log(c); // 32
vector3d times(matrix4x4 matrix)this vector3d を 4x4 で変換した vector3d の結果を返しますmatrix 行列を適用したポストベクトル
var a = Qt.vector3d(1,2,3);
var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,
                     12,13,14,15,16,17,18,19);
var c = a.times(b);
console.log(c.toString());
// QVector3D(0.774194, 0.849462, 0.924731)
vector3d times(vector3d other)this vector3d とother vector3d を乗算した vector3d の結果を返します。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(4,5,6);
var c = a.times(b);
console.log(c.toString()); // QVector3D(4, 10, 18)
vector3d times(real factor)this vector3d にスカラーを乗算した vector3d の結果を返します。factor
var a = Qt.vector3d(1,2,3);
var b = 4.48;
var c = a.times(b);
console.log(c.toString()); // QVector3D(4.48, 8.96, 13.44)
vector3d plus(vector3d その他)this vector3d とother vector3d を加算した vector3d の結果を返します。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(4,5,6);
var c = a.plus(b);
console.log(c.toString()); // QVector3D(5, 7, 9)
vector3d マイナス(vector3d other)this vector3d からother vector3d を減算した vector3d の結果を返します。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(4,5,6);
var c = a.minus(b);
console.log(c.toString()); // QVector3D(-3, -3, -3)
vector3d 正規化()this vector の正規化形式を返します。
var a = Qt.vector3d(1,2,3);
var b = a.normalized();
console.log(b.toString());
// QVector3D(0.267261, 0.534522, 0.801784)
real length()this vector3d の長さのスカラー実数値を返す
var a = Qt.vector3d(1,2,3);
var b = a.length();
console.log(b.toString()); // 3.7416573867739413
vector2d toVector2d()this vector3d を vector2d に変換した結果を返します。
var a = Qt.vector3d(1,2,3);
var b = a.toVector2d();
console.log(b.toString()); // QVector2D(1, 2)
vector4d toVector4d()this vector3d を vector4d に変換した vector4d の結果を返します。
var a = Qt.vector3d(1,2,3);
var b = a.toVector4d();
console.log(b.toString()); // QVector4D(1, 2, 3, 0)
bool fuzzyEquals(vector3d other, real epsilon)this vector3d がother vector3d とほぼ等しい場合に真を返します。近似値は、this の各属性がotherepsilon 以内にある場合に真となります。epsilon はオプション引数であることに注意してください。デフォルトのepsilon は 0.00001 です。
var a = Qt.vector3d(1,2,3);
var b = Qt.vector3d(1.0001, 1.9998, 2.0001);
var c = a.fuzzyEquals(b);        // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true

この値型は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.