QML 基础类型 vector 和 matrix

来源:互联网 发布:北京信索咨询集团知乎 编辑:程序博客网 时间:2024/05/23 01:11

vector2D vector3D vector4D 和 matrix4x4 是QML中与opengl相关的一些基础类型。

vector2D vector3D vector4D几乎具有一致的借口和函数,主要用于保存一个点的信息。

matrix4x4 用来表示具有16个元素的数组,主要用来做opengl中的matrix计算,如修改坐标系,旋转,移动等操作。


vector*D 常用的函数:

Function Signature

Description

real dotProduct(vector2d other)

Returns the scalar real result of the dot product ofthis vector2d with theother vector2d

vector2d times(vector2d other)

Returns the vector2d result of multiplyingthis vector2d with theother vector2d

vector2d times(real factor)

Returns the vector2d result of multiplyingthis vector2d with the scalarfactor

vector2d plus(vector2d other)

Returns the vector2d result of the addition ofthis vector2d with theother vector2d

vector2d minus(vector2d other)

Returns the vector2d result of the subtraction ofother vector2d fromthis vector2d

vector2d normalized()

Returns the normalized form ofthis vector

real length()

Returns the scalar real value of the length ofthis vector2d




原创粉丝点击