# Spline tangent and vectors...

 08 August 2006 Mike Abbott ... Mike Abbott United Kingdom Spline tangent and vectors... Struggling to get to grips with this - I'm no programmer and haven't quite got my head around vectors and matrices yet... I've got a ThinkingParticles set up - based on the 'TP spline emitter' object in the library using a spline on the XZ plane. I can basically understand the 'TP sline emitter' set up - how the emitter is distributed over the spline length etc. However... What I want the emitter to do is to emit from the spline - but at right angles to the tangent of the spline at each individual location. That's where I'm having difficulty. I can see that the spline node has a tangent output port available - outputting vector data (is this a velocity vector?). So what I want to do is add "90 degrees" (or approx 1.57 radians) to that direction, without adjusting the emission speed. Can someone tell me how to change just that angle? Thanks, Mike A. share quote
 08 August 2006 Srek Some guy   portfolio CGConnect Member Björn Dirk Marl Technical Design Maxon Computer GmbH Friedrichsdorf, Germany There is no single right angle to a tangent. A tangent is just a vector in a 3D space and there are unlimited other vectors that have a 90° angle to it. You will need an additional fixed point beside the vector to define a specific direction. Cheers Björn __________________ - www.bonkers.de - The views expressed on this post are my personal opinions and do not represent the views of my employer. share quote
 08 August 2006 Mike Abbott ... Mike Abbott United Kingdom I thought you might say that So let me be more specific: How would I do this on the basis that the spline lines flat on the XZ plane and my other point of reference is Y ("up")? Mike share quote
 08 August 2006 Srek Some guy   portfolio CGConnect Member Björn Dirk Marl Technical Design Maxon Computer GmbH Friedrichsdorf, Germany The vector cross product is what you are looking for. Using it on the tangent and a second vector that points to +y (0,1,0 should be sufficent in global space) will give you a new vector that is at a right angle to the plane described by the two vectors. Keep in mind that this is only a direction vector not a point vector. Cheers Björn __________________ - www.bonkers.de - The views expressed on this post are my personal opinions and do not represent the views of my employer. share quote
 08 August 2006 Mike Abbott ... Mike Abbott United Kingdom Originally Posted by Srek: The vector cross product... will give you a new vector that is at a right angle to the plane described by the two vectors. Keep in mind that this is only a direction vector not a point vector. Thanks Björn, OK - but could you educate me on the difference between a direction and point vector? and how I could create one if I have the other? Mike share quote
 08 August 2006 tcastudios Steady now!   ... Sweden Direction is like North South, up, down etc. Pointvector is like a specific place on a map in relation to onother place. Rotation would only have direction vectors. Placing an object need a point vector, "place this object at xyz in relation to xyz. Cheers Lennart __________________ MSA | OSX | xfiles ...Cinema4D Tools share quote
 08 August 2006 Mike Abbott ... Mike Abbott United Kingdom Thanks Lennart I'm sorry to labour this guys, but I just want to make sure I'm on the right track... As an example: If, in Xpresso, I take a Global Matrix and wire it to a Matrix2Vectors node I get Offset V1 V2 V3 on the output side. Am I right in thinking that Offset defines the common position (the 'tail' or 'origin') of all 3 vectors, and that V1,V2 & V3 define the location of the 'head' of each of the vectors along the X, Y & Z axis respectively? So are V1,V2 & V3 direction vectors? Mike share quote
 08 August 2006 Srek Some guy   portfolio CGConnect Member Björn Dirk Marl Technical Design Maxon Computer GmbH Friedrichsdorf, Germany Yes, V1 to V3 are the directions defining a local rectangular coordinate system. Usualy they are normals with the length one, except if you scaled the object axis. Offset or V0 is the position information. Maybe check XPresso Anonymous for more http://www.bonkers.de/xpa/coordinates.html Whenevery you need a local direction pointing along one of the objects axis you can use V1-V3 for this. This can be pretty handy for some setups. Cheers Björn __________________ - www.bonkers.de - The views expressed on this post are my personal opinions and do not represent the views of my employer. share quote
08 August 2006
Anyone care to take a look at the attachment - a simple set up showing emission at 90 degrees to the tangent of a spline.

It OK if I manipulate the points of the spline - or move or scale the spline as a whole,
but whatever I do I can't get it to work correctly when I rotate the spline as a whole (in the XZ plane only) - the emission retains it's original direction, or if I set up local coordinates in the spline node, the emission and spline part company...

Can anyone clue me in as to what's wrong?

On an associated note:

I may well be in the market to hire an Xpresso / TP expert for some ad-hoc work, training and hand-holding in the comming week. So if anyone is interested, please contact me.

Thanks,

Mike A.
Attached Files
 EmitAt90ToTangent_001.zip (7.2 KB, 17 views)

 08 August 2006 Srek Some guy   portfolio CGConnect Member Björn Dirk Marl Technical Design Maxon Computer GmbH Friedrichsdorf, Germany Hi, you are mixing up global and localvectors and coordinates here. Particles always use global coordinates, but to maintain your tangential emission you will need to calculate it in the local coordinates of the spline and then convert emission position and velocity to global space. For this purpose you will find the presets "Global Point" and "Global Vector" in the Matrix XPool. Use them to convert the position and velocity information, set the spline node to local coordinates and it should work as expected. http://www.bonkers.de/download/Emit...Tangent_002.c4d Hope this helps Björn __________________ - www.bonkers.de - The views expressed on this post are my personal opinions and do not represent the views of my employer. share quote
 08 August 2006 Mike Abbott ... Mike Abbott United Kingdom Originally Posted by Srek: Hi, you are mixing up global and localvectors and coordinates here.... Hope this helps Björn, Many, many thanks. I really appreciate your input on this. I thought it was a global / local coordinates issue, but I had no idea why. I can now go away and study the example and manual some more ...and drop me a line if you're interested in some evening work Thanks again Last edited by Mike Abbott : 08 August 2006 at 11:01 AM. share quote
 08 August 2006 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.