You are not logged in.
Pages: 1
Hi, all
I have a set of x,y points that define a curve (path) that was delivered by a Hermite polynomial.
Anyway, I need to find the rotation angle for each x,y point so that if an arrow moves along
this curve it will always point to the direction of the curve.
Here is a flash animation of what I am trying to implement (see the sprite rotates along path)
http://www.developingwebs.net/flash/orient.php
Any ideas,
Cheers
Offline
I haven't really ever made too many graphical programs, so my help may be limited. It sounds like you want your object to be facing in the direction of the tangent to your curve. I can tell you what the tangent is, at least.
You say you have a Hermite polynomial, but you didn't mention which Hermite polynomial, so I'll give you the general equation. All you need to do is take the derivative of Rodrigue's formula for Hermite polynomials:
Its derivative is
Just plug in the appropriate n for your Hermite polynomial's degree and you'll have the equation for the tangent. Ask more questions if your needs aren't satisfied with this.
Edit: After reading my post and then yours again, I don't feel that I answered your actual question. I apologize. Hopefully this might be helpful to you though, and as I said, feel free to ask for other things.
Last edited by Zhylliolom (2006-08-08 22:25:16)
Offline
Thank you for your answer. This is the polynomial I am using.
It sounds like you want your object to be facing in the direction of the tangent to your curve.
That's it
Offline
So you're good? No further assistance is required as of now?
What are you trying to make this for? What is the end product supposed to be?
Offline
Actually, I am bit confused by the derivative formula you have mentioned.
This is what I was doing but I am NOT satisfied with the results I need more accuracy
dx := p1.x - p0.x;
dy := p1.y - p0.y;
theta := 180 - 180/pi * arctan2(dy,dx);
Then this theta angle is used to rotate the points of the circle accordinly on the Z axis in order to follow the path.
The problem is that I get some strange rotation values throughout the path.
I am trying to produce a circle to extrude along a spline in 3D space
Last edited by akoutsou (2006-08-08 22:50:31)
Offline
I'm a bit confused about your equation myself .
Could you post a link to some information about it? (It looks like it's from a Wikipedia page, so if it is just post that link)
Offline
http://en.wikipedia.org/wiki/Cubic_Hermite_spline
Offline
Oh, the problem is that we are considering two entirely different things. The Hermite polynomials I was talking about are the kind from differential equations.
I've never heard of this "spline technology", but maybe I can try to help still. I have questions though. What do the start/end points and the start/end tangents do for us? Is this something that creates a curve defined by one polynomial between two points, then another curve defined by another polynomial between the next points, and so on?
Offline
Once again thank you for your answer. Yes, that it. You have a number of start/end points and start/end tangents and then you produce a 2D curve (that was the initial set of x,y points coords I was talking about)
Last edited by akoutsou (2006-08-08 23:16:29)
Offline
What role do the tangents play in the construction of the curve though? What exactly is the equation
telling us? In other words, how do we know what to draw from the equation?
Offline
p.x := round((h1 * p1.x) + (h2 * p2.x) + (h3 * t1.x) + (h4 * t2.x));
p.y := round((h1 * p1.y) + (h2 * p2.y) + (h3 * t1.y) + (h4 * t2.y));
This is what you actually drawing a point derived from x,y coords of p1,t1,t2,p2 and then next set starting from last point p2 t3 t4 p3
Offline
I think I'm too tired to understand anything right now(it's 6:30 AM now, I've been kept up by an intense theorem). Sorry. There are a few members on this forum who are much more accomplished programmers than I'll ever be, and I think that they will be better suited to help you out. Maybe after I have rested my mind will be working better and I'll be a better help. Until then, good luck.
Offline
Thanks mate.
Offline
Pages: 1