Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    LMatrix->Matrix and Matrix->LMatrix?

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 552 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 03/10/2007 at 15:58, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R8.2-R10 
      Platform:   Windows  ; Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Okay, how does one convert from one to the other so that the compiler doesn't throw errors, ala:

      F:\3D Graphics\Cinema 4D\C++ SDK\Projects\interPoser Pro\source\IPPBase.cpp(3615) : error C2440: 'type cast' : cannot convert from 'const struct Matrix' to 'struct LMatrix'

      F:\3D Graphics\Cinema 4D\C++ SDK\Projects\interPoser Pro\source\IPPBase.cpp(3643) : error C2440: 'type cast' : cannot convert from 'struct LMatrix' to 'struct Matrix'

      Should I be using dynamic_cast or something? Again, from ages past, what is the use of Quaternions if one cannot convert a Matrix into an LMatrix and back?

      Help, now, please?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 03/10/2007 at 16:16, xxxxxxxx wrote:

        Here, add this to the SDK, please:

        > LMatrix MatrixToLMatrix(Matrix mat)
        > {
        >      LMatrix     lmat;
        >      lmat.off.x =     (LReal)mat.off.x;
        >      lmat.off.y =     (LReal)mat.off.y;
        >      lmat.off.z =     (LReal)mat.off.z;
        >      lmat.v1.x =          (LReal)mat.v1.x;
        >      lmat.v1.y =          (LReal)mat.v1.y;
        >      lmat.v1.z =          (LReal)mat.v1.z;
        >      lmat.v2.x =          (LReal)mat.v2.x;
        >      lmat.v2.y =          (LReal)mat.v2.y;
        >      lmat.v2.z =          (LReal)mat.v2.z;
        >      lmat.v3.x =          (LReal)mat.v3.x;
        >      lmat.v3.y =          (LReal)mat.v3.y;
        >      lmat.v3.z =          (LReal)mat.v3.z;
        >      return lmat;
        > }
        > Matrix LMatrixToMatrix(LMatrix lmat)
        > {
        >      Matrix     mat;
        >      mat.off.x =          (Real)lmat.off.x;
        >      mat.off.y =          (Real)lmat.off.y;
        >      mat.off.z =          (Real)lmat.off.z;
        >      mat.v1.x =          (Real)lmat.v1.x;
        >      mat.v1.y =          (Real)lmat.v1.y;
        >      mat.v1.z =          (Real)lmat.v1.z;
        >      mat.v2.x =          (Real)lmat.v2.x;
        >      mat.v2.y =          (Real)lmat.v2.y;
        >      mat.v2.z =          (Real)lmat.v2.z;
        >      mat.v3.x =          (Real)lmat.v3.x;
        >      mat.v3.y =          (Real)lmat.v3.y;
        >      mat.v3.z =          (Real)lmat.v3.z;
        >      return     mat;
        > }

        This is really the only way to do it. LMatrix and Matrix are not related so static_cast, const_cast, dynamic_cast return errors. Same for LVector and Vector. Sooooo, you have to convert at the LReal to Real stage.

        Is it really that difficult to add these conversions (and those for LVector<->Vector)? Come on!

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 03/10/2007 at 16:38, xxxxxxxx wrote:

          Thanks Robert, I will see what can be done about simpler conversion between Matrix/LMatrix.

          cheers,
          Matthias

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 04/10/2007 at 01:49, xxxxxxxx wrote:

            Öhm, why not using const

            const LMatrix LM(const Matrix& m);
            const Matrix SM(const LMatrix& m);

            😉 Or am I missing something?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 04/10/2007 at 05:54, xxxxxxxx wrote:

              good point Samir 😉

              cheers,
              Matthias

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 04/10/2007 at 07:13, xxxxxxxx wrote:

                'Cause I can never find them in the SDK docs! 😉

                Thanks!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post