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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    c4d.utils.splinehelp

    Scheduled Pinned Locked Moved Bugs
    3 Posts 0 Posters 760 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 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

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

        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

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

          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

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