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

    How to calculate the Matrix scale? [SOLVED]

    SDK Help
    0
    12
    968
    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
      Helper
      last edited by

      On 02/03/2015 at 09:45, xxxxxxxx wrote:

      Hey Dan, thanks for your reply. I'm trying to make sense of your tip, but it just won't make click. 😪
      Could you enlighten me a bit more?

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

        On 02/03/2015 at 10:42, xxxxxxxx wrote:

        The scales on each axial-basis vectors in the matrix are just the lengths of each vector v1,v2,v3 as you noted.

        To determine if there is a reflection ('negative' scaling), you need to get the determinant of the matrix.  A positive value is orientation-preserving while a negative value is orientation-reversing (mirror/flip/reflection).  Just because any of the axial-basis vectors is negative doesn't imply negative scaling.

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

          On 02/03/2015 at 10:54, xxxxxxxx wrote:

          Howdy,

          If the dot product is equal to 0, then the vectors are at 90º to each other
          If the dot product is greater than 0, then the vectors are generally pointing in the same direction
          If the dot product is less than 0, then the vectors are generally pointing in opposite directions.

          Let's take the X axis for example:
          Y cross Z will give you a positive X scale vector. If the dot product of the actual X axis and the positive X scale vector is greater than 0 then the scale of the X axis is positive. If the dot product is less than 0, then the scale of the X axis is negative.

          Adios,
          Cactus Dan

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

            On 02/03/2015 at 11:06, xxxxxxxx wrote:

            Hi Robert, thanks for chiming in. I know how to compute the determinant of a Matrix, but that only gives
            me one value. I wouldn't be able to deduce which components would be inverted from only one value?

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

              On 02/03/2015 at 11:09, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              Howdy,

              If the dot product is equal to 0, then the vectors are at 90º to each other
              If the dot product is greater than 0, then the vectors are generally pointing in the same direction
              If the dot product is less than 0, then the vectors are generally pointing in opposite directions.

              Let's take the X axis for example:
              Y cross Z will give you a positive X scale vector. If the dot product of the actual X axis and the positive X scale vector is greater than 0 then the scale of the X axis is positive. If the dot product is less than 0, then the scale of the X axis is negative.

              Adios,
              Cactus Dan

              That is starting to make sense to me, I'm going to try something and report back. Thanks 🙂

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

                On 06/03/2015 at 05:11, xxxxxxxx wrote:

                I'm not really getting there.. When either V2 or V3 is inverted, V2.Cross(V3) will yield a vector pointing
                into the opposite direction of V1 assuming V1 is not inverted, and in the same direction assuming V1
                is inverted.

                I appreciate the hints and I usually like finding the solution by myself by applying the tips instead of just
                getting it  in a reply, but I think I can't come with it this time. 😊

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

                  On 06/03/2015 at 11:24, xxxxxxxx wrote:

                  Hi Niklas,

                  this is an unsolvable equation, you can detect if there is a negative axis "x cross y = z, compare z with z" , but you won't know which axis is negative "x or y or z!!" , if 2 axes are negative, this even won't appear!! "it can be a rotation"

                  here is a simple link:
                  http://answers.unity3d.com/questions/689997/need-help-supporting-negative-values-when-extracti.html

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

                    On 06/03/2015 at 12:20, xxxxxxxx wrote:

                    Howdy,

                    Mohamed is correct. My post was only to determine whether or not the matrix has a negative scale on one of it's axes.

                    You cannot calculate a precise 3 axis positive/negative scale for a matrix without having some sort of starting reference, which is probably why an object stores its scale in a vector to be used for calculating the matrix.

                    Adios,
                    Cactus Dan

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

                      On 07/03/2015 at 04:32, xxxxxxxx wrote:

                      Oh my. I thought that would be deducable from the Matrix somehow and didn't think it would be
                      stored separately within the object. Using BaseObject::GetAbsScale() now.

                      Thanks Mohamed and Cactus. 🙂

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

                        On 09/03/2015 at 13:18, xxxxxxxx wrote:

                        Hi,

                        It looks like you guys solved the issue.  It's fun to see the C4D plugin dev community sharing knowledge, and I often learn a thing or two from these topics!  I'll close it as solved.

                        Joey Gaspe
                        SDK Support Engineer

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