how to XOR



  • 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



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

    pxvec.x = pcvec.x * vecmask.x
    

    Vector XOR just multiplies componentwise.

    -Niklas



  • 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](file:///Users/paultaylor/Documents/Media/3D/Programming/Python/CINEMA4DR15037PYTHONSDKHTML20130823.zip%20Folder/help/modules/c4d/Vector/index.html?highlight=xor#c4d.Vector)

    Retu_<_t_>_



  • 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



  • 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



  • 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


Log in to reply