Setting tangents



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

    On 31/05/2005 at 03:57, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.x 
    Platform:   Windows  ; Mac  ;  
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    I'm trying to set the tangents of a point on a spline, like this:

      
    if (!instanceof(spline,PointObject))return;  
    cnt = spline->GetPointCount();  
    if (!cnt)return;  
    p = spline->GetTangents();  
    if(sizeof(p)<point)return;  
    p[point*2]=tangent1;  
    p[point*2+1]=tangent2;  
    spline->SetTangents(p);  
    spline->Message(MSG_UPDATE);  
    

    spline is the object pointer
    point is the point index
    tangent1 and tangent2 are vectors.
    Why isn't it working?
    Thank you in advance for any help.

    Rui Batista



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

    On 31/05/2005 at 11:44, xxxxxxxx wrote:

    I added a test to see if the SetTangents works. 
      var tf = spline->SetTangents(p);
      if (tf == FALSE) println("SetTangents failed");
    This call fails. I didn't discover why yet.
    When editing tangents by hand one must be in Scale mode, so I set Scale Mode using CallCommand(200000089); to see if that made a difference but still no success.
    Richard



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

    On 31/05/2005 at 16:38, xxxxxxxx wrote:

    Thank you for checking it out, Richard. Maybe it is a bug. Its really weird.
    Oh, by the way, do you have a list of those nice commands as in CallCommand(200000089) ;-)

    Rui Batista



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

    On 01/06/2005 at 10:50, xxxxxxxx wrote:

    In R9 the call to spline->SetTangents(p) should fail if spline->GetPointCount()==0, the internal C++ spline->GetTangent() call fails, sizeof(p) != 2*spline->GetPointCount(), or if the array doesn't contain vectors in all positions.
    Do you know if the problem is there in R9? Otherwise, it could be that there was some bug before. Does it matter if the spline had proper tangents before your call?



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

    On 01/06/2005 at 13:33, xxxxxxxx wrote:

    I am using C4D 9.1. Windows XP. So whether this information is exactly true for Macs with rel 8.x I cannot say. I did verify that all the vectors in the points array and all the vectors in the tangents array are present and correct, so that is not the problem.
    Richard
    p.s. no I don't have a list of the CallCommand Numbers. I get them one by one as required from the Command Manager.



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

    On 02/06/2005 at 21:48, xxxxxxxx wrote:

    Did some more investigation and found that the tangents are not tangents at all but vectors.  You need to give the position of the end terminator of the purple adjuster in relative x,y,z coordinates not a tangent value.
    Setting the array
    p[point*2]=vector(x,y,z);
    caused the spline->SetTangents(p); to work rather than fail and the altered point moved in the viewscreen.
    Tested in C4D 9.1 only. Hope this works for you in 8 on a MAC
    Richard



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

    On 03/06/2005 at 03:15, xxxxxxxx wrote:

    Thank you for your time in investigating it, Richard. I could now make it work (my mistake was elsewere because my tangent1 and tangent2 were already vectors).
    I made it even more powerful now since I can use any object to control the tangents now :)
    Once again, thank you both.

    Rui Batista



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

    On 11/02/2009 at 18:46, xxxxxxxx wrote:

    HELLOOO! First post here and first tries with C.O.F.F.E.E. as soon you'll see...
    Well, I'm trying too to get some controll over tangents during animation by means of controller Nulls but... although I've  been studing :), I have some doubts for which I have not found an explanation or solution yet... First... What the heck is an hermite??? Is it something like an array? Cause this is the first time I heard for such a term and I've not found so much info in the docs... The other doubt about the Rui's code of the first post is... how can I define that point varible? Cause it seem that is not enough to call an op- >GetPointCount(); to obtain that "point index" that you said, isn't? Sould I try with a bucle like "for(i = 0; i < cnt; i++)" to obtain that "poit index" variable or something like that?
    Oh... How I'd love to be able to make run that little first post example to start to test with some ideas, but... I'm still a little/totally lost here :P, so... THANKS in advance for any help!



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

    On 11/02/2009 at 20:37, xxxxxxxx wrote:

    A Hermite is a type of spline curve.

    I imagine that Rui just forgot to include the getting of the point array:

    point = spline->GetPoints();

    And despite the shock of the one poster, tangents are always described as vectors (or lines). :) Maybe confusing 'tangent point' (the point at which a tangent intersects) with an actual tangent. In this case, the tangent vector is with respect to its given point. And there are two for Hermite splines (which are C0 continuous - meaning that the tangents on each side of the point may not be colinear).

    Welcome to 'Math World'.



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

    On 12/02/2009 at 18:01, xxxxxxxx wrote:

    Oh, THANK YOU! With that, I have moved a little step forward and now I can see some results over the tangents! :D Still a long road ahead but something is better than nothing...
    Well, I'm now "studing" THIS wonderfull C.O.F.F.E.E. tag to see what lines and ideas could I take advantage of it, really adding the ability of manage Tangents with son nulls (in a similar way that "CollieTools - Spline Controller" does) would make it simply perfect! And it souldn't be so complicated to add at last, isn't? Or I hope so... Well, the case is I'm still really quite amazed about all this kind of C.O.F.F.E.E. posibilities! But it's a pity that all that Maths "paraphernalia" be SO alien to me... Ahhh... if I only could find someone a little more experimented on this matters than me (easy thing...) that be interested too in develop such a nice tool :), cause you can't deny that it'd be a incredible useful feature that, at the moment, Cinema 4D lacks...
    Anyway I'll continue posting here some doubts and progress... (if any) cause this little helps that you bring comes to me like a total godsend, so thanks for don't let me alone!


Log in to reply