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
    • Recent
    • Tags
    • Users
    • Login

    how to XOR

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 571 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

      On 19/04/2014 at 07:09, xxxxxxxx wrote:

      I can XOR a vector

      pxvec = pxvec ^ vecmask

      how do I XOR a single axis

      pxvec.x = pxvec.x  ????  vecmask.x

      tia

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

        On 19/04/2014 at 09:42, xxxxxxxx wrote:

        pxvec.x = pcvec.x * vecmask.x
        

        Vector XOR just multiplies componentwise.

        -Niklas

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

          On 22/04/2014 at 04:35, xxxxxxxx wrote:

          thanks

          I couldn't make sense of the SDK syntax '__rxor__(self,other)'

          or the example

          I thought % was a modulo operator?

          Vector.\__rxor\_\_(self, other)[](file:///Users/paultaylor/Documents/Media/3D/Programming/Python/CINEMA4DR15037PYTHONSDKHTML20130823.zip%20Folder/help/modules/c4d/Vector/index.html?highlight=xor#Vector.__rxor__)

          Multiplies two vectors together componentwise and set the left hand vector to the result:

          import c4d
          v_result = c4d.Vector(1,2,3)%c4d.Vector(2,3,4)
          #v_result => Vector(2,6,12)
          
          _<_t_<__<_t_>_<_<_t_>_lgroup>Param : The other argument.
          Return type: Vector[URL-REMOVED]

          Retu_<_t_>_


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

            On 22/04/2014 at 09:09, xxxxxxxx wrote:

            Well, that's a typo in the docs. The modulo operator performs the cross product.
            Thanks for the notice.

            -Niklas

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

              On 23/04/2014 at 11:43, xxxxxxxx wrote:

              So how do you form this with the example above pls?

              can't figure the syntax

              __rxor__(self,other)

              xvec.x = pcvec.x__rxor__(vecmask.x)

              tia

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

                On 24/04/2014 at 03:15, xxxxxxxx wrote:

                I don't get what you are trying to do. Vector.__rxor__() is only called in some special cases, see

                https://docs.python.org/2/reference/datamodel.html#object.\__rxor\_\_

                If you want to multiply two vectors componentwise, use the ^ operator. The * operator on Vectors
                performs the dot-product. If you want to multiply one component of a vector with another, use
                the * operator. You can't multiply a  vector component componentwise as there is only one component
                which is the value itself.

                -Niklas

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