GLKVector3 があり、x 値と y 値のみを CGPoints として読み取りたいとします。これを行うにはどうすればよいですか?
1028 次
2 に答える
3
GLKVector3
docには、型定義があります。
union _GLKVector3
{
struct { float x, y, z; };
struct { float r, g, b; };
struct { float s, t, p; };
float v[3];
};
typedef union _GLKVector3 GLKVector3;
3 つのオプションがあります。
GLKVector3
の配列であるのv
属性float[3]
{x,y,z}
すなわち:
GLKVector3 vector;
...
float x = vector.v[0];
float y = vector.v[1];
float z = vector.v[2];
CGPoint p = CGPointMake(x,y);
次に、float 属性x,y,z
、関連性が低い属性、またはr,g,b
ベクターs,t,p
型のさまざまな用途もあります。
CGPoint p = CGPointMake(vector.x,vector.y);
于 2013-10-20T21:36:47.347 に答える