Row Vector or Column Vector?

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30703

    yiwen
    Member

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

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

    #35280

    Gordon
    Moderator

    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.

    #35281

    yiwen
    Member

    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?

    #35282

    Gordon
    Moderator

    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?

    #35283

    yiwen
    Member

    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.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.