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 calc. tangent of a spline point [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 483 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 27/02/2015 at 01:30, xxxxxxxx wrote:

      I have a linear spline in the shape of a triangle.
      Now I want to change the interpolation of one of the points from hard to soft.
      How can I calculate the "soft interpolation" tangent of that point?

      Note: I do not want to use the c4d "Soft Interpolation" command.  
      I want to calculate the tangent in that point myself.

      -Pim

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

        On 01/03/2015 at 21:27, xxxxxxxx wrote:

        Hi pgroof,

        Could it be that SplineHelp.GetTangent(), which is the closest I could find when searching the help, is what you need?

        Otherwise, if the commands and methods supplied by Cinema 4D are not sufficient for your needs, you'll have to figure out the mathematical formulas yourself.

        Joey Gaspe
        SDK Support Engineer

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

          On 02/03/2015 at 00:30, xxxxxxxx wrote:

          Thanks, SplineHelp will do.

          -Pim

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

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

            Hi Pim,

            Thanks for letting me know, I'll close the topic as solved.  I had to truncate the name to fit in the solved tag.

            Joey Gaspe
            SDK Support Engineer

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

              On 03/03/2015 at 03:26, xxxxxxxx wrote:

              Hi Pim,

              I had this one in my script collection,
              if you want to calc it by your own to have more flexibility:

                
                #_______________________________________________________  
                #Soft interpolation  
                lenRight = (pointList[i+1] - pointList[i]).GetLength()  
                lenLeft = (pointList[i-1] - pointList[i]).GetLength()  
                lenAverage = (lenLeft + lenRight)/2  
                if lenAverage > lenRight:  
                    lenAverage = lenRight  
                elif lenAverage > lenLeft:  
                    lenAverage = lenLeft  
                orientation = (pointList[i+1] - pointList[i-1]).GetNormalized()  
                tangent = orientation * lenAverage / 4  
                spline.SetTangent(i, -tangent, tangent)  
              

              Best wishes
              Martin

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

                On 03/03/2015 at 03:34, xxxxxxxx wrote:

                Thanks Martin.
                Indeed it gives me more functionality.

                -Pim

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