|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have an animation with balls rolling over an isosurface. My algorithm
essentially moves the surface tangent point around, and draws a sphere
with center surfacepoint+Normal*radius. It looks ok with uniform
textures, but I want the balls to roll.
In 1D, it's easy.
rotate <0, 0, distancerolled.x*360/2/pi/radius>
In 2D, it's not that hard (is this right)?
rotate <distancerolled.z*360/2/pi/radius, 0,
distancerolled.x*360/2/pi/radius>
I've tried all kinds of tricks for 3D, and nothing looks right. The
problem is with a surface with a y component (rolling hills). If it
drops a great amount in y, it should roll more, if it drops less in y,
it rolls less.
Anyone ever addressed this problem?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <396F6E26.A9FFDE42@my-dejanews.com>,
gre### [at] my-dejanewscom wrote:
>I've tried all kinds of tricks for 3D, and nothing looks right. The
>problem is with a surface with a y component (rolling hills). If it
>drops a great amount in y, it should roll more, if it drops less in y,
>it rolls less.
What you want is not how far it drops in y, but how far it rolls. That
is, if it is rolling on a straight line, what is the length of that
line? If it is rolling on a curve, what is the length of that curve?
If the curves aren't simple circular curves (for which I think there is
a function; perhaps the arcsin/arccos/arctan functions?), but you know
the points anywhere on the surface (which you must, since you're putting
the balls there?), you could approximate small triangles to get an
approximation of the distance rolled.
I wrote something about trig functions in POV
(http://www.hoboes.com/html/NetLife/POV/Trig/) but you can probably use
the vector functions to do what you want.
Jerry
Post a reply to this message
|
|
| |
| |
|
|
From: Greg M Johnson
Subject: Re: Rolling balls, appropriate rotation equation.
Date: 15 Jul 2000 16:04:58
Message: <3970c3ea@news.povray.org>
|
|
|
| |
| |
|
|
I have an isosurface that is rolling hills based on the noise3d function.
At time increment n, I know the tangent is at pt x1,y2,z1.
At time increment n+1, I know the tangent is at pt. x2,y2,z2.
I know the distance between the two, and the time increment is so small that
I don't think I'll be harmed by assuming it's a straight line. Even with a
straight line on an inclined plane, I have no idea how the ball should
roll. The 1d & 2d solutions are trivial.
What is the rotation
Jerry wrote:
> In article <396F6E26.A9FFDE42@my-dejanews.com>,
> gre### [at] my-dejanewscom wrote:
> >I've tried all kinds of tricks for 3D, and nothing looks right. The
> >problem is with a surface with a y component (rolling hills). If it
> >drops a great amount in y, it should roll more, if it drops less in y,
> >it rolls less.
>
> What you want is not how far it drops in y, but how far it rolls. That
> is, if it is rolling on a straight line, what is the length of that
> line? If it is rolling on a curve, what is the length of that curve?
>
> If the curves aren't simple circular curves (for which I think there is
> a function; perhaps the arcsin/arccos/arctan functions?), but you know
> the points anywhere on the surface (which you must, since you're putting
> the balls there?), you could approximate small triangles to get an
> approximation of the distance rolled.
>
> I wrote something about trig functions in POV
> (http://www.hoboes.com/html/NetLife/POV/Trig/) but you can probably use
> the vector functions to do what you want.
>
> Jerry
Post a reply to this message
|
|
| |
| |
|
|
From: Chris Colefax
Subject: Re: Rolling balls, appropriate rotation equation.
Date: 15 Jul 2000 21:59:43
Message: <3971170f@news.povray.org>
|
|
|
| |
| |
|
|
Greg M. Johnson wrote:
> I have an isosurface that is rolling hills based on the noise3d function.
>
> At time increment n, I know the tangent is at pt x1,y2,z1.
> At time increment n+1, I know the tangent is at pt. x2,y2,z2.
>
> I know the distance between the two, and the time increment is so small
that
> I don't think I'll be harmed by assuming it's a straight line. Even with a
> straight line on an inclined plane, I have no idea how the ball should
> roll. The 1d & 2d solutions are trivial.
The simple answer is that you need to rotate the ball around the axis
perpendicular to the direction of travel and the normal of the surface
you're rolling on, by the angle (in degrees) given by the
360*distance_travelled/ball_circumference.
The tricky part is finding the right axis to rotate about, which depends on
exactly how you want to simulate the ball's behaviour. Perhaps the easiest
option is to assume the ball has a preferred orientation (i.e. one axis that
always points in the direction of travel). Then you can simply rotate
around the rolling axis first, followed by a rotation around the "up" axis
to the direction of travel, finished by a rotation (so the up axis points to
the surface normal) and translation to the final position, e.g. assuming the
balls starts centred at the origin, pointing to +z:
#declare BallUp = vnormalize(SurfaceNormal);
#declare BallDir = vnormalize(p2 - p1);
#declare BallRight = vnormalize (vcross(BallUp, BallDir));
#declare BallLoc = SurfacePoint + (BallUp*BallRadius);
object {Ball
rotate x*360*(vlength(p2 - p1)+PreviousDistance)/(2*pi*BallRadius)
matrix <BallRight.x, BallRight.y, BallRight.z,
BallUp.x, BallUp.y, BallUp.z,
BallDir.x, BallDir.y, BallDir.z,
BallLoc.x, BallLoc.y, BallLoc.z>}
If, on the other hand, you want the ball to be able to roll around any axis
you could recalculate the rolling axis at each step and add the rotation
around it to the previous rotations - but it seems to me what you'd get is a
ball that always points in one global direction, rather than always pointing
forwards, and I don't know that this would look very effective...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Greg M. Johnson who wrote:
>I have an isosurface that is rolling hills based on the noise3d function.
>
>At time increment n, I know the tangent is at pt x1,y2,z1.
>At time increment n+1, I know the tangent is at pt. x2,y2,z2.
>
>I know the distance between the two, and the time increment is so small that
>I don't think I'll be harmed by assuming it's a straight line. Even with a
>straight line on an inclined plane, I have no idea how the ball should
>roll. The 1d & 2d solutions are trivial.
>
>What is the rotation
>
It should be rather like the 2d case, except that you would sum
sqrt((x2-x1)^2 + (y2-y1)^2) and sqrt((z2-z1)^2 + (y2-y1)^2)
instead of using (x2-x1) and (z2-z1).
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|