Spline tangents...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/10/2003 at 10:23, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C++ ;---------
Hi,
I am aligning objects on the tangent of a spline on a certain position of the spline. This doesn´t work correctly though. This is how I am doing it:subdiv = 10; spline->InitLength(0,NULL); length = spline->GetLength(); interpolation = length/subdiv; [...] Vector rot = VectorToHPB(spline->GetSplineTangent(spline->UniformTonatural(i*interpolation/length),0));
I am then setting the rotation of the objects. But I encounter problems. When for example using the arrange function in Cinema 4D I get the result on the left and with my code I get the result on the right. You can see that in the upper part, the rotation is wrong (and at position-y == 0 it´s most of the time completely messed up). Does anybody know how to fix this behavior or what is wrong? I thought GetSplineTangent should already give me the correct result.
Thank you! -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/10/2003 at 01:10, xxxxxxxx wrote:
All of the red arrows in the left picture point along the tangent, as do the blue arrows in the right picture. So nothing is wrong with GetSplineTangent().
Your problem is that VectorToHPB() cannot know how to rotate the object around the tangent, since the full rotation isn't specified just by one direction. From your picture it looks like it decides that the green axis should point upwards. Of course it cannot know that at the bottom of your circle up is actually down.
As you can see, this is more of a math problem that an SDK problem. I suggest that you do this by build a matrix instead of by using VectorToHPB(). Then you'll set the tangent as the Z-axis and use cross-products to get the other directions. Not for the faint of heart, though I can tell you more details if you want to go this route. (This problem is at heart of MSA.) -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/10/2003 at 11:48, xxxxxxxx wrote:
Quote: Originally posted by Mikael Sterner on 12 October 2003
>
> * * *
>
> All of the red arrows in the left picture point along the tangent, as do the blue arrows in the right picture. So nothing is wrong with GetSplineTangent().
>
> Your problem is that VectorToHPB() cannot know how to rotate the object around the tangent, since the full rotation isn't specified just by one direction. From your picture it looks like it decides that the green axis should point upwards. Of course it cannot know that at the bottom of your circle up is actually down.
>
> As you can see, this is more of a math problem that an SDK problem. I suggest that you do this by build a matrix instead of by using VectorToHPB(). Then you'll set the tangent as the Z-axis and use cross-products to get the other directions. Not for the faint of heart, though I can tell you more details if you want to go this route. (This problem is at heart of MSA.)
>
> * * *
Ah I see! I will try to use a matrix instead. If I run into problems I know where to reach you (but it shouldn´t be too hard....I´m always saying that ;).
Thank you so far! -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2003 at 10:13, xxxxxxxx wrote:
Hi Mikael,
I just re-read your answer and it seems GetSplineTangent is wrong. Because at the right picture the blue axis arrows at y=0 does NOT point along the tangent! So what can I do about it?
Thanks in advance
Best
Samir -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2003 at 12:24, xxxxxxxx wrote:
I'm pretty sure that GetSplineTangent() returns the right value at this point as well. The problem is in VectorToHPB(), which has a singularity at +Y. As I said, you'll have to use matrix methods to get more robust results.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/10/2003 at 11:49, xxxxxxxx wrote:
Got it now. Thanks again! Would Have never thought of it being the problem.
Best
Samir