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

    Initializing spline data

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 355 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 15/04/2014 at 11:55, xxxxxxxx wrote:

      So in my development of my python plugin I have the following code.

      self.sd = c4d.SplineData()
             self.sd.MakeLinearSplineBezier(3)

      self.sd.SetRound(1.0)
             self.sd.SetRange(xmin=0, xmax=1, xsteps=.1, ymin=0, ymax=1, ysteps=.1)
             self.sd.SetKnot(index=0, vPos= c4d.Vector(0,0, 0))                  
             self.sd.SetKnot(index=1, vPos= c4d.Vector(.50,1, 0))                
             self.sd.SetKnot(index=2, vPos= c4d.Vector(1,0, 0))

      This creates a linear graph representation, I am looking more for a graph representation that looks like

      y= 2 - (-x)^2

      I guess more of a curve.

      Any help would be much appreciated.
      Jimmy

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

        On 16/04/2014 at 00:49, xxxxxxxx wrote:

        You need to set the tangents for each knot to get a curve.

        Steve

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

          On 16/04/2014 at 08:01, xxxxxxxx wrote:

          Steve,
          Thank you, can you elaborate a bit more?  I'm still a bit lost as to how to do that?  Would you be so kind as to supply a code example perhaps?
          Thank you!

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

            On 16/04/2014 at 08:27, xxxxxxxx wrote:

            So I modified the code in this fashion to make the y= 2 - (-x)^2 curve.

            self.sd = c4d.SplineData()
                   self.sd.MakeLinearSplineBezier(3)

            self.sd.SetRound(1.0)
                   self.sd.SetRange(xmin=0, xmax=1, xsteps=.1, ymin=0, ymax=1, ysteps=.1)
                   self.sd.SetKnot(index=0, vPos= c4d.Vector(0,0, 0))                   
                   self.sd.SetKnot(index=1, vPos= c4d.Vector(.50,1, 0),vTangentLeft=c4d.Vector(-.10, 0, 0), vTangentRight=c4d.Vector(.10, 0, 0))                  
                   self.sd.SetKnot(index=2, vPos= c4d.Vector(1,0, 0))

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