[osg-users] Animation with Cubic Bezier path

91 views
Skip to first unread message

daniele argiolas

unread,
Oct 19, 2010, 11:04:26 AM10/19/10
to osg-...@lists.openscenegraph.org
Hi,

I tried to understand "osganimationmakepath" example.

I can't understand how to make an animation if I would use simple points like these:
v[0] = osg::Vec3(0, 0, 0);
v[1] = osg::Vec3(20, 0, 0);
v[2] = osg::Vec3(40, 0, 0);
v[3] = osg::Vec3(60, 0, 0);

I want an animation without stops between points and with a constant speed. What keys I have to add on path?

I don't understand the relationship between control points of bezier and the making of animation.

Is there anybody who can me explain?

Thank you!

Cheers,
daniele

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32861#32861

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC

unread,
Oct 20, 2010, 9:54:42 AM10/20/10
to osg-...@lists.openscenegraph.org
Daniele,

Bezier Curves are parametric functions that are defined by their control
points. The number of control points will determine the degree of the curve
minus 1 so four control points will yield curve of degree three (cubic). The
control points can be specified in whatever dimension you want (i.e. 2D or
3D) and whatever coordinate system you want. The resulting curve will lie
within the control point polygon (the convex hull) where the curve will
interpolate the first control point at t=0 and the last control point at
t=1. As the parameter "t" varies between 0 and 1, the curve will trace out a
smooth path from the first to the last control point. The animation will be
controlled by the parameter "t" as input and the resulting point (x,y,z) on
the curve will be given as output for a position.

Without going into too much detail mathematically on Bezier curves and
splines, may I suggest you look at the book "Curves and Surfaces for
Computer Aided Geometric Design" by Gerald Farin to get more information if
you want to learn more about Bezier curves.

Hopefully this will answer your question on how the example works when using
Bezier curves to generate an animation path...

-Shayne

daniele argiolas

unread,
Oct 20, 2010, 10:41:14 AM10/20/10
to osg-...@lists.openscenegraph.org
Thank you, but I know how bezier curves work.

I don't understand why in my animation (and also in the standard example osganimationpath) I have not a costant speed.

If I create a straight line with bezier I can have no control point (control point equal to main point).


thanks
daniele

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=32910#32910

daniele argiolas

unread,
Oct 22, 2010, 7:03:28 AM10/22/10
to osg-...@lists.openscenegraph.org
I've a pratical case, can anybody help me??

I've 4 keyframes:

v[0] = osg::Vec3(0, 0, 0);
v[1] = osg::Vec3(20, 0, 0);
v[2] = osg::Vec3(40, 0, 0);
v[3] = osg::Vec3(60, 0, 0);

in times 0,2,4,6

How to move along this keyframes with a constant speed from 0,0 to 60,0???

thanks

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=32978#32978

Robert Osfield

unread,
Oct 22, 2010, 7:29:52 AM10/22/10
to osg-...@lists.openscenegraph.org
Hi Daniele,

Have you looked at the osganimation example?

Robert.

daniele argiolas

unread,
Oct 22, 2010, 7:44:35 AM10/22/10
to osg-...@lists.openscenegraph.org
yes, I've looked all examples.

I need a bezier path animation with constant speed from first to last keyframe.
Is it more clear?

How?

thanks

robertosfield wrote:
> Hi Daniele,
>
> Have you looked at the osganimation example?
>
> Robert.
>

> On Fri, Oct 22, 2010 at 12:03 PM, daniele argiolas <> wrote:
>
> > I've a pratical case, can anybody help me??
> >
> > I've 4 keyframes:

> > v[0] = osg::Vec3(0, 0, 0);
> > v[1] = osg::Vec3(20, 0, 0);
> > v[2] = osg::Vec3(40, 0, 0);
> > v[3] = osg::Vec3(60, 0, 0);
> >

> > in times 0,2,4,6
> >
> > How to move along this keyframes with a constant speed from 0,0 to 60,0???
> >
> > thanks
> >

> > ------------------
> > Read this topic online here:

> > http://forum.openscenegraph.org/viewtopic.php?p=32978#32978
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> >

> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
>

> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=32981#32981

Jason Daly

unread,
Oct 22, 2010, 11:53:10 AM10/22/10
to osg-...@lists.openscenegraph.org
daniele argiolas wrote:
> yes, I've looked all examples.
>
> I need a bezier path animation with constant speed from first to last keyframe.
> Is it more clear?
>

You might need to implement it yourself if OSG's spline interpolation
doesn't provide a constant velocity. Here's a link I found on the topic:

http://community.spinxengine.com/content/19-constant-speed-cubic-spline-interpolation.html

--"J"

Reply all
Reply to author
Forward
0 new messages