THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 17:29, xxxxxxxx wrote:
Cinema 4D Version: 11.5
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C.O.F.F.E.E ;
I know how to get the coordinates (global or local) of a point along a spline.
But how can I get the plane that is perpendicular to that point in the spline?
Maybe its easier to understand with a picture:
I have a spline (the blue curve). Now imagine that I have the point located at 0.45 along the spline (using UniformToNatural...). How can I calculate the plane that is perpendicular to that specific point? (the red plane, in the picture, perpendicular to the tangent of the spline in that point).
I ask this because I need to calculate points on the surface of that plane (the green dots). Actually, I need to calculate a vector that is coplanar to that plane and that has its origin in the point of the spline that I'm calculating the perpendicular plane from.
Thank you very much in advance.
On 05/06/2010 at 17:59, xxxxxxxx wrote:
Better yet, if someone could point me in the right direction as to how to calculate the points of an helix along a spline, I believe I could do what I need.
On 05/06/2010 at 20:22, xxxxxxxx wrote:
I am pretty sure you need more than one point to find a plane.
On 06/06/2010 at 00:46, xxxxxxxx wrote:
I know I need, at least, three points or one point and a vector, to define a plane.
I do have one point and a vector (the tangent vector).
However, I arrived to the conclusion that all I need to know is how to calculate a spiral along a spline.
I have been searching for the source code of such expression but I could not find anything
I tried searching for "helix along spline", "helix along spline source code", "helix around spline", "spiral along spline", etc.
All I find are methods to do that using applications. What I need is the source code.
On 06/06/2010 at 09:49, xxxxxxxx wrote:
So, I believe that, for what I'm trying to create, I just need to know the code to do this:
I have been trying to get that information from the net but can't seem to find anything
So, I have a spline. I have access to the coordinates of any point along that spline. I also have access to the tangent vector of any point along that spline. What is the method to calculate the helix points around that spline?!? Anyone knows or could point me in the right direction?
On 06/06/2010 at 10:49, xxxxxxxx wrote:
Would this help?
This at least provides some formulas.
On 06/06/2010 at 10:53, xxxxxxxx wrote:
I had already been there, emberintherain. And, unfortunately, it doesn't help me much. I know how to create an helix along a line. Not along an arbitrary spline
On 06/06/2010 at 11:12, xxxxxxxx wrote:
My theoretical go at it would be to describe a regular circle (local sin x , cos y) around the
z direction ( of a matrix at spline position).
Iterating the position of that matrix along the spline while
calculating the circle would then describe a helix along the spline.
(The movement along the spline corresponding to the "t" in that Helix formula)
On 06/06/2010 at 15:47, xxxxxxxx wrote:
That sounds logic and I can see it in my mind.
The problem is how to make sure the "circle" gets mapped perpendicularly to the points along the spline.
The matrix of the spline gives me just that, the matrix of the position/rotation/scale of the spline object, not the matrix of the points along the spline.
On 06/06/2010 at 16:18, xxxxxxxx wrote:
You need to build a matrix. The position is given by the spline point position.
The rotation you build from the spline point position and the tangent position.
The GetSplineTangent(x,0) returns a position in space tangential to the
spline point position at distance x. (It doesn't give a angle).
Using VectorToHPB(splinepoint - tangentpoint) will give you the
basic rotation (skipping up vector to start with)
So you basically build a AlignToSpline function moving a tangential
matrix (instead of an object).
This matrix is what you have as a base for the circle calculation.
On 06/06/2010 at 16:35, xxxxxxxx wrote:
Mmmmm, ok, I will give it a try. Thank you Lennart.
On 06/06/2010 at 18:35, xxxxxxxx wrote:
So, this is a snippet of my code:
r1=50*sin(31.415*f); // just for testing
r2=50*cos(31.415*f); // just for testing
new_mat = new(Matrix);
vec = vector(r1,r2, 0.0);
new_vec = new_mat->GetMulP(vec);
Should this be it? Its not working as I expected
On 06/06/2010 at 19:00, xxxxxxxx wrote:
See if this rude set up might help.
// Put COFFEE Tag on an object to circle the spline
// Add a point spline in link field.
var tag = obj->GetFirstTag();
if (tag->GetType() == type) return tag;
tag = tag->GetNext();
var ctag = GetFirstTag(op,Tcoffeeexpression);
var udpos = ctag#ID_USERDATA:1;
var spline = ctag#ID_USERDATA:2;
var spos = spline->GetSplinePoint(spline->UniformToNatural(udpos),0);
var tpos = spline->GetSplineTangent(spline->UniformToNatural(udpos),0);
var srot = VectorToHPB(tpos);
var revs = 20; // revs along spline
var mym = new(Matrix);
mym = spline->GetMg()->GetMulM(mym);
R11.5 example scene
On 06/06/2010 at 19:41, xxxxxxxx wrote:
It helped me a lot but its still not working the way I want it to
I want to adjust the points of a spline so that it spirals around another spline.
If its not asking you too much, could you take a look at what I have come up so far?
Pay no attention to the User Data parameters of the COFFEE tag. For now, only the Spline, Number of Points and Radius are working.
Thank you very much in advance.
On 07/06/2010 at 08:10, xxxxxxxx wrote:
Hey guys. You must not add hpb rotations just like so
Its better generate a local rotation matrix and multiply it to the right of the tangent plane matrix.
Here is a piece of code which works pretty well in Ruis scene:
var m_spiral = new(Matrix);
var new_mat = new(Matrix);
var vec = vector(0.0,radii,0.0);
var new_vec = new_mat->GetMulP(vec);
On 07/06/2010 at 13:51, xxxxxxxx wrote:
Thanks Michael, that shaved a few lines off in my set up.
Making a little Spiral Gadget here
Rui, did you get it working now?
On 07/06/2010 at 18:40, xxxxxxxx wrote:
Yes, its working fine now. Well, I still have to add a few more options but the main part is already working.
Thank you all for the help