>>Hi,
>>
>>Think I'm going to get out of my depth here but...
>>
>>Given a Bezier spline (that I've defined so I know the end and control points) how can I determine the slope of the tangent at a particular point on the spline?
>>
>>Actually I *think* I can do that - but it's over simpifying the requirement. What I really need, given a secant of the spline from a known start point and of known length, is to determine its end point (or slope)
>>
>>I could use a cardinal spline instead of a Bezier if it was easier to obtain the result but that looks more difficult to me...
>
>Good grief, you have to get the prize for most complex math question I've ever seen asked here on the UT ;)
>
>I knew very little about Bezier splines before poking around on the Web a bit, now I feel like I know even less <g>.
>
>One general approach you might be able to look into would be something like this:
>
>1. If you can describe the spline as y = F(x), where F is "some function" of x (this is probably a heck of a big "if"), then
>
>2. The slope of the curve at any point x is simply the first derivative of F(x) with respect to x (elementary differential calculus).
>
>UPDATE: the following link goes into the math somewhat and shows the formulae for first derivative ("velocity") and second derivative ("acceleration"):
http://www.everything2.com/index.pl?node_id=922415>
>Out of general interest, what is it you're trying to do? And is it in Fox (I've seen you on the .Net forum from time to time).
Hi,
I think I need to base this on a Bezier curve rather than one described by a function because (a) the user has to be able to define the curve, (b) I can use GDI to draw the curve rather than doing it myself and (c) my brain can't cope with the calculus of a curve defined by a function <g>
Here's a link that has an animation which helped me to visualize how the control points and calculations work for a Bezier curve:
http://www.saltire.com/applets/advanced_geometry/spline/spline.htmThe other option of a cardinal spline, whilst easy to draw, would, I think, be harder for the user to grasp. And I can't find a glimmer of how the curve is actually calculated :-(
All I'm really trying to do is to produce text that follows the defined curve so I'll be writing the text character by character. Knowing the width of each character I need to rotate it so that it's baseline in tangential to the underlying portion of the curve (but as mentioned it will actually need to be a secant line since the end point must also lie on the curve as the starting point for the next character). I did the same type of thing for a circle a year or so ago - but that's much simpler....
This ones going to be C# on .Net 2005.
Best,
Viv