このページでは

vector4d QML Value Type

vector4d 型には、x、y、z、w の各属性があります。詳細...

Import Statement: import QtQuick

詳細な説明

vector4d 型には、x 、y 、z 、w 属性があり、それ以外はvector3d 型と同様です。

vector4d 型のプロパティは、デフォルトでゼロベクトルを持ちます。この場合、x 、y 、z 、およびw はすべて0 に設定されています。

詳細については、vector3d 型に関するドキュメントを参照してください。

vector4d 値を作成するには、「x,y,z,w」という文字列として指定するか、各成分を個別に定義するか、Qt.vector4d() 関数を使用して構成します。

vector4d 型には、QML から呼び出すことができる以下の冪等関数があります:

関数のシグネチャ説明例
real dotProduct(vector4d other)vector4d 型 `this ` と vector4d 型 `other ` の内積の結果である実数スカラーを返します
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.dotProduct(b);
console.log(c); // 70
vector4d times(matrix4x4 matrix)this のvector4dを、4x4のmatrix を用いて変換した結果のvector4dを返します。行列はベクトルの後に適用されます。
var a = Qt.vector4d(1,2,3,4);
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()); // QVector4D(120, 130, 140, 150)
vector4d times(vector4d other)this なvector4dとother なvector4dを乗算した結果のvector4dを返します。
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.times(b);
console.log(c.toString()); // QVector4D(5, 12, 21, 32)
vector4d times(real factor)this のvector4dとスカラーを乗算した結果のvector4dを返します。factor
var a = Qt.vector4d(1,2,3,4);
var b = 4.48;
var c = a.times(b);
console.log(c.toString()); // QVector3D(4.48, 8.96,
                                        13.44, 17.92)
vector4d plus(vector4d other)this vector4d とother vector4d の加算の結果である vector4d を返します。vector4d plus(vector4d other)
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.plus(b);
console.log(c.toString()); // QVector4D(6, 8, 10, 12)
vector4d minus(vector4d other)other ベクトル4D からthis ベクトル4D を引いた結果のベクトル4D を返します。
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(5,6,7,8);
var c = a.minus(b);
console.log(c.toString()); // QVector4D(-4, -4, -4, -4)
vector4d normalized()this ベクトルの正規化された形式を返します。
var a = Qt.vector4d(1,2,3,4);
var b = a.normalized();
console.log(b.toString());
// QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
real length()this vector3d の長さのスカラー実数値を返します。
var a = Qt.vector4d(1,2,3,4);
var b = a.length();
console.log(b.toString()); // 5.477225575051661
vector2d toVector2d()this ベクトル4dをvector2dに変換した結果をvector2dとして返します
var a = Qt.vector4d(1,2,3,4);
var b = a.toVector2d();
console.log(b.toString()); // QVector2D(1, 2)
vector3d toVector3d()this vector4d を vector3d に変換した結果を vector3d として返します。
var a = Qt.vector4d(1,2,3,4);
var b = a.toVector3d();
console.log(b.toString()); // QVector3D(1, 2, 3)
bool fuzzyEquals(vector4d other, real epsilon)this のvector4dがother のvector4dに近似して等しい場合、trueを返します。this の各属性が、other からepsilon 以内の範囲にある場合、この近似は真となります。epsilon はオプションの引数であり、デフォルトのepsilon は0.00001であることに注意してください。
var a = Qt.vector4d(1,2,3,4);
var b = Qt.vector4d(1.0001, 1.9998, 2.0001, 3.9999);
var c = a.fuzzyEquals(b);        // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true

この値型は、QtQuick インポートによって提供されます。

「QML 値型」も参照してください 。

© 2026 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.