michael Posted October 10, 2003 Share Posted October 10, 2003 I have a curve that I'm using as a path object and i'd like to get the slope of the curve where the object is along that path in order to drive some other parameters... I haven't been able to find much in the docs on getting this info...anyone have any ideas? thanks Quote Link to comment Share on other sites More sharing options...
edward Posted October 10, 2003 Share Posted October 10, 2003 Try exhelp primduv. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted October 10, 2003 Share Posted October 10, 2003 Add UVTexture SOP (Rows&Columns, Point texture) Add AttribCreate SOP (name: slope, class: Point, type: Vector) valuex: primduv("../"+opinput(".", 0), 0, "P", 0, $MAPU, $MAPV,1,0) valuey: primduv("../"+opinput(".", 0), 0, "P", 1, $MAPU, $MAPV,1,0) valuez: primduv("../"+opinput(".", 0), 0, "P", 2, $MAPU, $MAPV,1,0) Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 10, 2003 Share Posted October 10, 2003 Assuming you have the displacement vector (Not as in Displacement Shader) of the object at any point on the curve, I guess slope would be y/(hypot(x,z)) (oops, Maya talk) OR y/sqrt(x^2+z^2) Shuffle the components around depending on which axis you want the slope relative to ... I think correct me if i'm wrong please oh atan (y/sqrt(x^2+z^2) ) would give you the angle if thats what you want Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 10, 2003 Share Posted October 10, 2003 OR better yet Object Chop: Target -> Obj on path Reference-> Null at 0,0,0 | | Slope Chop (Frame Samples) Quote Link to comment Share on other sites More sharing options...
michael Posted October 10, 2003 Author Share Posted October 10, 2003 thanks guys...I'll give those suggestions a try when I get home... Quote Link to comment Share on other sites More sharing options...
michael Posted October 11, 2003 Author Share Posted October 11, 2003 hmm... well I tried th suggestions but while I'm getting results I : a) don't know what to do with the values , and the values don't seem to be changing with the position on the path of my obj. am I thinking of something else when I talk of 'slope'? - from what remember of high school math - a slope of 0 is just flat on the XZ plane, where a slope of 1 would be perpendicular to that - straight up in Y. if I draw a random curve in the viewport in xzy, every point on that curve will have a different slope between 0-1.... Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 11, 2003 Share Posted October 11, 2003 Slope in Math (2D) is defined as change in y/ change in x . Which is basically the first differential of y in x so on a p-t graph (thats position-time) slope would give you the velocity of your object at any given time. Same way the second differential would give you change in velocity/ change in time = acceleration. both primduv and the slope chop are doing pretty much the same thing the slope chop's pop-up help explains this pretty well so you can calculate 1st differential = velocity 2nd " = acceleration 3rd = change in accel What exactly do you want to get and how do you want to use it. Maybe slope isn't what you really want PS: Does'nt the slope chop give you a ( non-straight-line graph??, I'm getting one here ) Also note: A slope of 1 would be a vector angled at 45 deg from x, Not straight up in Y Quote Link to comment Share on other sites More sharing options...
michael Posted October 11, 2003 Author Share Posted October 11, 2003 hmmm...there are two or three nurons firing here....they're old and not connected to anything what I'm doing is: I have a butterfly on a path the wing flapping is being driven by a wave chop I'd like to control the amplitude of the wave chop with the position of the butterfly on the path - so as the butterfly moves up in Y (path gets steeper) the amplitude increases, as it goes down the amplitude decreases, giving the effect of it's wings flapping more to gain altitude | less to loose altitude... I thought it would be easy to find the values I need, though I didn't know how..., am I after the wrong thing? ...so the slope of a curve would reach infinity as it got steeper? - that seems vaguely familiar.... Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted October 11, 2003 Share Posted October 11, 2003 maybe you could use a geometry chop to get the y position of any point of your butterfly, and export it to the wave chop. Maybe the area and slope chops can do something usefull in there as well. Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 11, 2003 Share Posted October 11, 2003 geometry chop target - butterfly reference- null at origin slope chop (set to acceleration) will give you accel in all three axes, you need y, so isolate it. slope (1st derivative) of this y channel can be used as a multiplier for your wave. might be worth a shot, will have to verify myself Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 11, 2003 Share Posted October 11, 2003 its amazing how my incessant rambling can turn around and bite me in the butt Very crude newbie-ish idea but might just help u find what you're after... i hope butterfly.hipnc Quote Link to comment Share on other sites More sharing options...
michael Posted October 12, 2003 Author Share Posted October 12, 2003 thanks...getting there edit - I think I have this worked out > I'm using the object chop > delete to bring in and isolate the butterfly's TY, then using that to drive a multiply on the second wave chop.... but I think I can get what I want if I can use a slope chop right after the delete to drive the period of my original wave chop... so.... 1) is there a chop that will output the abs() of it's input 2) I've tried to hook up the export to the period param of the wave chop, but it's not doing anything - not giving me the orange channel. there's something goofy about the 'path' field in the export chop...it's a string but seems to not like ch() references.... have to keep plugging away on this, but it's getting really close Quote Link to comment Share on other sites More sharing options...
stevenong Posted October 13, 2003 Share Posted October 13, 2003 Hey arctor, 1) is there a chop that will output the abs() of it's input Math CHOP -> Channel Pre OP (Positive) 2) I've tried to hook up the export to the period param of the wave chop, but it's not doing anything - not giving me the orange channel. there's something goofy about the 'path' field in the export chop...it's a string but seems to not like ch() references....have to keep plugging away on this, but it's getting really close Use ch() in the parameter you want to reference the Wave CHOP's Period parameter instead of the Export CHOP. Also, the Path in the Export CHOP is the name of the parameter instead of the path to the OP. Therefore, Channels -> *, Node -> /obj/geo1, Path -> ty will export the channel to geo1's ty. You can only export channel(s) from CHOPs & not parameters of the CHOPs. I hope the above helps! Cheers! steven Quote Link to comment Share on other sites More sharing options...
tallkien Posted October 13, 2003 Share Posted October 13, 2003 Here's a slight modification to the file i posted. At least it helps to better visualise the final wave, and tweaking the flaps is a lot easier when you have seperate waves as opposed to multiplying the periods. Besides, it also leaves room for animating the wave properties for some interesting possibilities. I used the trigger there coz it picks out places in the input where the slope is rising which is what you want anyway. butterfly.zip Quote Link to comment Share on other sites More sharing options...
michael Posted October 13, 2003 Author Share Posted October 13, 2003 thanks... I have to figure out exactly what I need and then build in the thngs I'll need...but at least now i have a good start thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.