osg.Vec4d
简介
osg.Vec4d是OpenSceneGraph中用于表示4维双精度向量的类,其中包含了四个双精度浮点数。
成员变量
该类包含了四个双精度浮点数作为其成员变量,分别是:
- double _v[4]: 数组形式存储的向量坐标,下标从0到3依次为x、y、z、w。
构造函数
- osg::Vec4d(): 创建一个初始值为0的向量。
- osg::Vec4d(double x, double y, double z, double w): 创建一个指定坐标值的向量。
成员函数
- void set(double x, double y, double z, double w): 设置向量坐标值。
- double& operator[](const int i): 获取指定位置(0到3,分别为x、y、z、w)的坐标值。
- const double& operator[](const int i) const: 获取指定位置(0到3,分别为x、y、z、w)的坐标值,只读。
- bool operator==(const Vec4d& rhs) const: 判断两个向量是否相等。
- bool operator!=(const Vec4d& rhs) const: 判断两个向量是否不相等。
- double* ptr(): 获取向量数组的指针。
- const double* ptr() const: 获取向量数组的指针,只读。
- double length() const: 获取向量长度。
- void normalize(): 归一化向量。
- double* operator*(): 获取向量数组的指针。
- const double* operator*() const: 获取向量数组的指针,只读。
参考资料
- OpenSceneGraph 3.6.5 Documentation - Vec4d