This topic contains 4 replies, has 2 voices, and was last updated by yiwen 5 years, 10 months ago.

- AuthorPosts
- December 7, 2011 at 8:33 am #30703
OGLES_WINDOWS_X86EMULATION_2.09.29.0649

I would like to know the vector is deal with row vector or column vector in SDK?(You know it is very import to calculate vector with matrix).

It seems the matrix is prepared for row vector since I read the following from “PVRTVector.h”:

== BEGIN ==*/*!****************************************************************************

@Function Translation

@Returns a PVRTMat4 corresponding to the requested translation

@Description Calculates a 4×4 matrix corresponding to a transformation

of tx, ty and tz distance in each axis.

*****************************************************************************/

static PVRTMat4 Translation(const VERTTYPE tx, const VERTTYPE ty, const VERTTYPE tz)

{

return PVRTMat4(f2vt(1),0,0,0,

0,f2vt(1),0,0,

0,0,f2vt(1),0,

tx,ty,tz,f2vt(1));

}

== END ==

So the translation matrix will be:**1.0 0.0 0.0 0.0**

0.0 1.0 0.0 0.0

0.0 0.0 1.0 0.0

tx ty tz 1.0However another function I read from same file:

== BEGIN ==*/*!****************************************************************************

@Function *

@Input rhs a PVRTMat4

@Returns result of multiplication

@Description matrix multiplication operator PVRTVec4 and PVRTMat4

****************************************************************************/

PVRTVec4 PVRTVec4::operator*(const PVRTMat4& rhs) const

{

PVRTVec4 out;

out.x = VERTTYPEMUL(x,rhs.f[0])+VERTTYPEMUL(y,rhs.f[1])+VERTTYPEMUL(z,rhs.f[2])+VERTTYPEMUL(w,rhs.f[3]);

out.y = VERTTYPEMUL(x,rhs.f[4])+VERTTYPEMUL(y,rhs.f[5])+VERTTYPEMUL(z,rhs.f[6])+VERTTYPEMUL(w,rhs.f[7]);

out.z = VERTTYPEMUL(x,rhs.f[8])+VERTTYPEMUL(y,rhs.f[9])+VERTTYPEMUL(z,rhs.f[10])+VERTTYPEMUL(w,rhs.f[11]);

out.w = VERTTYPEMUL(x,rhs.f[12])+VERTTYPEMUL(y,rhs.f[13])+VERTTYPEMUL(z,rhs.f[14])+VERTTYPEMUL(w,rhs.f[15]);

return out;

}

== END ==

Thus it seems vector is deal with column when PVRTVec4 * PVRTMat4.

E.g. there is PVRTVec4 V(**A, B, C, 1.0**) and the above translation matrix M,

so V * M =

(**A*1.0 + B*0.0 + C*0.0 + 1.0*0.0,**

A*0.0 + B*1.0 + C*0.0 + 1.0*0.0,

A*0.0 + B*0.0 + C*0.0 + 1.0*0.0,

A*tx + B*ty + C*tz + 1.0*1.0

)Observably they are contradictory and I always got wrong resultOuch.

Please confirm that or correct me if I’m wrong.

December 8, 2011 at 11:07 am #35280Hi, I had a brief look at this and it does seem like there may be a problem. I’ve filed this as an issue in our system (BRN35318) for further investigation – you can look for this number in our release notes for a fix if there is no further post here.

December 8, 2011 at 1:39 pm #35281Thanks for your reply, I’ve modified the source on my side to get correct result. Could I access your bug trace system as customer to know more details?

December 8, 2011 at 2:20 pm #35282We don’t normally allow access to our bug tracking outside the company. If you are a customer of ours then you may have access to more details through the IPGear system.

May I ask, which function did you change in your own code?

December 20, 2011 at 2:30 am #35283sorry for so late reply.

I just modify the function*PVRTVec4 PVRTVec4::operator*(const PVRTMat4& rhs) const,*so that I can deal with vector and matrix correctly.I hope the developers will check all corresponding functions(for PVRTMat3 and PVRTMat4) similar as I posted in BRN35318.