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

    Python Vector Math

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 423 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 07/10/2010 at 18:30, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      Mac OSX  ; 
      Language(s) :       PYTHON  ;

      ---------
      Hi Sebastian,  i think I may have stumbled on a bug bug it could be I don't know what i am doing.

      Take this example
      vec = c4d.Vector (0,0,10)
      vec - vec * vec
      print vec 
      I would expect the result to be (0,0,100)  but instead I get (100,100,100)
      same result happens if I use vec.__mul__(vec)

      If I do division:
      vec = vec /2
      I get (0,0,5), which is what I would expect.

      regards,
      jonah

      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 08/10/2010 at 07:21, xxxxxxxx wrote:

        Hi jonahtobias,

        the __mul__ (* ) operator for the Vector class returns the dot product.
        It should return a float value and no Vector. Please use
        Vector(...).Dot(Vector(...))  for the dot product calculation which works fine.

        Cheers, Sebastian

        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 08/10/2010 at 08:21, xxxxxxxx wrote:

          Thank Sebastian,

          So if I wanted to multiply 2 Vectors i.e.
          Vector(10,2,2) * Vector(10,2,2) so the result is == (100,4,4)
          how would I do this?
          right now python gives (108,108,108)

          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 08/10/2010 at 08:26, xxxxxxxx wrote:

            Use the __xor__ operator for this: Vector(1,2,3) ^ Vector(4, 5, 6)

            Multiplies two vectors together componentwise

            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 08/10/2010 at 08:29, xxxxxxxx wrote:

              Terrific!  Thank you.

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