c4d.utils.splinehelp



  • On 17/08/2015 at 08:18, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R16.050 
    Platform:     Mac  ;  Mac OSX  ; 
    Language(s) :

    ---------
    Hello all,

    Within c4d.utils.splinehelp,     the following functions seem to be wrongly implemented:
        GetNormal: gives Tangent
        GetTangent: gives CrossNormal
        GetCrossNormal: gives Normal

    Not an urgent issue, because all functions are there, they just don't seem to have the right name.
    A piece of code in which this became evident is attached below. It should be executed from a python generator, with a spline as its child.

    kind regards,

    Hermen

    PS: if this code is going to be updated, a nice extra feature would be the GetMatrix function as described below, which evaluates the matrix at any given offset.
    #################  python code  ###################
    import c4d
    import math as m
    #Welcome to the world of Python

    def GetMatrix(offset, segment, sh) :
        m1 = c4d.Matrix()
        """
        the following functions seem to be wrongly implemented:
        GetNormal  gives Tangent
        GetTangent gives CrossNormal
        GetCrossNormal gives Normal
        """
        m1.off = sh.GetPosition(offset, segment, realoffset=True)
        m1.v2  = sh.GetTangent(offset, segment, realoffset=True)
        m1.v3  = sh.GetNormal(offset, segment, realoffset=True) # not needed
        m1.v1 = sh.GetCrossNormal(offset, segment, realoffset=True)
        return m1

    def main() :
        spl = op.GetDown() # original spline
        sh  = c4d.utils.SplineHelp()
        sh.InitSpline(spl)
        
        N   = 2 * m.pi * 100  # op[c4d.ID_USERDATA,1] # N windings
        R   = 10 # op[c4d.ID_USERDATA,2] # Radius
        reverse = False #op[c4d.ID_USERDATA,3]
        phase   = 0. # op[c4d.ID_USERDATA,4]  
        d   = 6 * N                 # density
        if reverse: N = -N    
        newspl = c4d.SplineObject(d+1, 4)
        pts = range(d+1)

    for i in pts:
            #print i
            p = float(i)/d
            m0 = GetMatrix(p, 0, sh=sh)
            t = N * p + phase
            v = R * c4d.Vector(m.cos(t), m.sin(t), 0)
            pts _= m0*v
            if i==10000:
                disc = c4d.BaseObject(c4d.Odisc)
                disc[c4d.PRIM_AXIS] = 4 # z = tangent
                disc.SetMg(m0)
                disc.InsertUnder(newspl)

    newspl.SetAllPoints(pts)
        
        return newspl



  • On 19/08/2015 at 00:07, xxxxxxxx wrote:

    Hello,

    thanks for reporting this, a bug report was filed. SplineHelp already has a GetMatrix() function.

    Best wishes,
    Sebastian



  • On 19/08/2015 at 14:21, xxxxxxxx wrote:

    Jee, how could I have missed that?!? I only noticed the "GetVertexMatrix" and never found this one.
    Thanks for pointing it out,

    Regards,
     
    Hermen


Log in to reply