Initializing spline data



  • 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



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

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

    Steve



  • 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!



  • 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))


Log in to reply