0

GLKVector3 があり、x 値と y 値のみを CGPoints として読み取りたいとします。これを行うにはどうすればよいですか?

4

2 に答える 2

3

GLKVector3docには、型定義があります。

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 に答える