I love More or Less on Radio 4. I did squee so much when it came back for a new series. It isn’t easy to make statistics both fun and intelligible.
Also, I got horribly sunburnt yesterday :-(. But only on the top of my arms and face and not where my watch goes so is both daft and painful. Grr.
Also, I have a TrainGame-derived maths problem: let’s say I have a three-dimensional Bezier curve (X(t), Y(t), Z(t)) defined for 0 <= t <= 1. In my case this defines a track segment and works admirably for rendering the track. However it also determines the position of the train on the track at some time t. The problem is, with the train travelling at a constant speed, it appears to speed up or slow down depending where it is on the curve. It turns out that most of the time this doesn’t really matter, but sometimes it does.
What I would like is for the t parameter to be linearly related to the distance travelled along the curve; so if A is the arc length between two points A(0, s) = s * A(0, 1). Unfortunately, Bezier curves don’t possess this property and there’s not even a closed-form solution to A. So I’ve had to write this crude and slow approximation to such a curve given a normal Bezier curve as input:
http://git.nickg.me.uk/?p=traingame.git;a=blob;f=include/BezierCurve.hpp;#l84
It works by assuming that (X(s), Y(s), Z(s)) should be sL units along the curve, where L is the length of this track segment. It then approximates the curve by lots of little straight lines and moves t along the curve summing lengths until it reaches sL. Then we evaluate the curve at (X(t), Y(t), Z(t)).
So the question is, mathematicians of the interwebs, is there a better way to do this??
this problem definitely have something to do with the letter s
April 10, 2011 @ 10:34 pm
seen this? posted last month, can maybe talk to?
http://algorithmist.wordpress.com/2011/03/10/path-arc-length-parameterization-preview-i/
intrinsic coordinates was the one blodgett thinking of
sleepy now
April 10, 2011 @ 10:49 pm
> seen this? posted last month, can maybe talk to?
Thanks for finding this! It looks really useful. I think I’m basically using the linear-approximation technique he describes but splitting it into quadratic curves sounds like it will improve things.
> intrinsic coordinates was the one blodgett thinking of
Oh yes! I seem to remember something about fitting different sized circles under the curve and the radius changing as you moved along it. Or is that something else?
April 14, 2011 @ 9:44 pm
hmm, don’t remember that part
think the ones we did define a point on curve by the angle of tangent and distance along curve. or something?
April 15, 2011 @ 1:59 pm