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

    modifying a spline / strange result

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 261 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 21/04/2010 at 13:07, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   r11 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi,

      i am trying to modify a spline but facing a problem while trying to just pass the point coordinates. so the result should look unchanged, right, but i am getting strange result (for example a circle is returned as a 4-leaves-flower)?

      heres my code:

        
      //get the spline  
                splineObj = (SplineObject* )userSpline->GetClone(COPY_NO_BITS, NULL);  
                padr = ToPoint(splineObj)->GetPointW();  
                pc = ToPoint(splineObj)->GetPointCount();  
      //cycle thru the points  
                    for (int j=0;j<pc;j++)  
                    {  
                        ust = splineObj->GetSplinePoint(j,0,NULL);  
                        padr[j] = ust;  
                    }  
                          
      

      another question i have is how i can access parametric splines as for now it only works with converted spline objects.

      thanks for any input..

      cheers,
      ello

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 23/04/2010 at 12:46, xxxxxxxx wrote:

        another spline problem i am facing is this (see screenshot).. what may be responsible for this thing?
        no matter if i use Tbspline or Tlinear or any other type.  interpolation it Inone (others dont change this, too)

        would be cool if someone could point me to what may be causing it..

        cheers and thanks in advance,
        ello

        btw, i've thought about a tangent problem, but setting the tangents to whatever value doesnt change anything here...

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 26/04/2010 at 02:34, xxxxxxxx wrote:

          I don't know what you are trying to accomplish. Your code actually makes little sense to me.

          Besides that it is not necessary to use ToPoint() on SplineObject objects. Also you are using GetSplinePoint() wrong. As first parameter you have to pass a Real value between 0.0-1.0, from start to end.

          Parametric splines can be accessed by converting them to their current state. Also have a look at the SplineHelp library.

          As for the last problem I have no idea what you are doing 🙂

          cheers,
          Matthias

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 28/04/2010 at 13:16, xxxxxxxx wrote:

            thank you for the input.

            i managed to create the new spline based on the linked one. below my script which generally works, aside from that it has a memory leak i cannot fix:

              
                  if(userSpline)      
                  {            
                      splineObj = (SplineObject* )userSpline->GetClone(COPY_NO_BITS, NULL);  
                      if (modifyUspline)  
                      {  
                          newSpline = SplineObject::Alloc(steps*10,Tlinear);  
                          sbc = newSpline->GetDataInstance();  
                          sbc->SetBool(SPLINEOBJECT_CLOSED,splineObj->GetDataInstance()->GetBool(SPLINEOBJECT_CLOSED));  
                          sbc->SetBool(SPLINEOBJECT_INTERPOLATION,Inone);  
                          padr = newSpline->GetPointW();  
                          for (int sc = 0; sc<steps*10; sc++)  
                          {  
                              ccpos = (1.0/(steps*10))*sc;  
                              vPosition = splineObj->GetSplinePoint(ccpos, 0, NULL);  
                              padr[sc] = vPosition;  
                          }  
                          splineObj = newSpline;  
                          //if (newSpline) blDelete(newSpline);  
                      }  
                  }  
            

            if i dont copy the newSpline over to splineObj i can use blDelete and the memory leaks are gone. however, newSpline is ment only as a helper spline and thus i want to copy the created newSpline to splineObj which is used afterwards in the plugin...

            what am i doing wrong?

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