이 페이지에서

vector2d QML Value Type

vector2d 유형에는 x 및 y 속성이 있습니다. 더 보기...

Import Statement: import QtQuick

상세 설명

vector2d 유형은 x 및 y 속성을 가지며, 그 외에는 vector3d 유형과 유사합니다.

vector2d 유형의 속성은 기본값으로 0 벡터를 가집니다. 이때 x 와 y 는 모두 0 로 설정됩니다.

자세한 내용은 vector3d 유형에 대한 문서를 참조하십시오.

vector2d 값을 생성하려면 "x,y" 형식의 문자열로 지정하거나, 각 성분을 개별적으로 정의하거나, Qt.vector2d() 함수를 사용하여 구성하십시오.

vector2d 유형에는 QML에서 호출할 수 있는 다음과 같은 항등 함수가 있습니다:

함수 시그니처설명예시
real dotProduct(vector2d other)this 의 vector2d와 other 의 vector2d 간의 내적 결과를 실수형 스칼라 값으로 반환합니다.
var a = Qt.vector2d(1,2);
var b = Qt.vector2d(3,4);
var c = a.dotProduct(b);
console.log(c); // 11
vector2d times(vector2d other)this vector2d와 other vector2d를 곱한 결과인 vector2d를 반환합니다.
var a = Qt.vector2d(1,2);
var b = Qt.vector2d(3,4);
var c = a.times(b);
console.log(c.toString()); // QVector2D(3, 8)
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 other)this vector2d와 other vector2d를 더한 결과인 vector2d를 반환합니다.vector2d plus(vector2d other)
var a = Qt.vector2d(1,2);
var b = Qt.vector2d(3,4);
var c = a.plus(b);
console.log(c.toString()); // QVector2D(4, 6)
vector2d minus(vector2d other)other 인 vector2d에서 this 인 vector2d를 뺀 결과를 vector2d로 반환합니다.
var a = Qt.vector2d(1,2);
var b = Qt.vector2d(3,4);
var c = a.minus(b);
console.log(c.toString()); // QVector2D(-2, -2)
vector2d normalized()this 인 vector2d의 정규화된 형태를 반환합니다.
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로 변환한 결과인 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와 대략적으로 동일한 경우 true를 반환합니다. this 의 각 속성이 other 의 epsilon 범위 내에 있을 때 대략적 일치로 간주됩니다. epsilon 는 선택적 인자이며, 기본값 epsilon 은 0.00001입니다.
var a = Qt.vector2d(1,2);
var b = Qt.vector2d(1.0001, 1.9998);
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.