Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Calculate third point position aligned with two points(edge dir)

    Cinema 4D SDK
    2023 python
    3
    4
    662
    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.
    • ymoonY
      ymoon
      last edited by

      There are three points. In the picture, I want to straighten the third point while keeping the edge length. What are the correct methods for vector and matrix arithmetic (Python/R2023)? Thank You.

      test.c4d

      Q.png

      1 Reply Last reply Reply Quote 0
      • chuanzhenC
        chuanzhen
        last edited by

        Here is one of the calculations:
        In world coordinates, get ab vector and the length of bc vector
        Then normalize the ab vector , then use the length of the bc vector to scale the length of the has normalized ab vector , use point b world position to offset the ab vector (that is, add the world position of the point b vector) to get the position of point C

        file use Xpresso to calculate C Position
        test.c4d

        相信我,可以的!

        ymoonY 1 Reply Last reply Reply Quote 0
        • ymoonY
          ymoon @chuanzhen
          last edited by ymoon

          @chuanzhen said in Calculate third point position aligned with two points(edge dir):

          Here is one of the calculations:
          In world coordinates, get ab vector and the length of bc vector
          Then normalize the ab vector , then use the length of the bc vector to scale the length of the has normalized ab vector , use point b world position to offset the ab vector (that is, add the world position of the point b vector) to get the position of point C

          file use Xpresso to calculate C Position
          test.c4d

          Thanks for the quick reply.
          How do I change this to run in the local coordinate system?
          I'm not familiar with the matrix. Thank you.

          ah... sorry forget it. remove * mg

          1 Reply Last reply Reply Quote 0
          • i_mazlovI
            i_mazlov
            last edited by

            Hi @ymoon,

            Thanks for reaching out to us. Glad your problem is solved!

            Here are some pointers to the docs with related toolset:
            c4d.Vector, c4d.Matrix, c4d.utils.

            Please note, there's Matrix Manual, although math questions are generally out of scope of the support on this forum.

            Cheers,
            Ilia

            MAXON SDK Specialist
            developers.maxon.net

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