Imagination PowerVR SDK Blog

Row Vector or Column Vector?



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 4x4 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,

== 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.0

However another function I read from same file:
== BEGIN ==
 @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 =
A1.0 + B0.0 + C0.0 + 1.00.0,
0.0 + B1.0 + C0.0 + 1.00.0,
0.0 + B0.0 + C0.0 + 1.00.0,
tx   + Bty   + Ctz   + 1.0*1.0


Observably they are contradictory and I always got wrong resultOuch.

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


Hi, 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.


Thanks 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?


We 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?


sorry 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.