4.9.7.3 hermite - hermite( start, end, tan1, tan2, parameter )

One of the more complex functions within Xpressionist is the hermite function. It allows you to create a hermite spline that can be used for all kinds of purposes like custom transition between values or to move an object along its curve. This function uses five areguments: start, end, tan1, tan2 and parameter while the first four are vector arguments and the fifth argument is a floating point value.

The start and end argument define the start and end point in space. Tan1 and tan2 are the tangents that you use to shape the curve inbetween the start and end point. The tangents are always relative to the start and end point and guide the direction and shape of the curve.

The parameter argument controls which point of the curve will be calculated. The parameter value can be between 0 and 1. When the parameter argument is 0 or smaller the function will return the starting point of the curve. When the parameter is 1 or higher the function will return the end point of the curve. When the parameter is inbetween 0 and 1 the function returns a point on the hermite spline.

We use a linstep function as the parameter argument and four effectors as the start, end, tan1 and tan2 arguments. The tangent vector box effectors have been made children of the start and end point cross effectors - so the values in the examples show the relative offset of the tangents to the start and end points. We have switched the Spheres transition to implicit and control the Position channel of the Sphere.

sphere.Position = hermite( start.Position, end.Position, tan1.Position, tan2.Position, linstep( 0, 4, time );

To get a better overview over the values we have substituted the effectors position channels with custom vectors.

sphere.Position = hermite( vec( 0, 0, 0 ), vec( 4, 0, 0 ), vec( 0, 1, 0 ), vec( 0, -1, 0 ), linstep( 0, 4, time );

We preview the result:

The linstep function returns values between 0 and 1 from 0 to 4 seconds in the animation. The Sphere travels from the start point to the end point in four seconds. The curve is shaped by the tangents tan1 and tan2. The Sphere is guided into the direction of tan1 when it leaves the start point, travels along the hermite spline and is guided into the direction of tan2 at the end point.

We alter the statement to this:

sphere.Position = hermite( vec( 0, 0, 0 ), vec( 4, 0, 0 ), vec( 0, 1, 0 ), vec( 0, 1, 0 ), linstep( 0, 4, time );

Since we have altered the position of the second tangent the Sphere will travel along an s-curved shape because it will be guided into the direction of tan2 at the end of the curve.

We alter the statement to this:

sphere.Position = hermite( vec( 0, 0, 0 ), vec( 4, 0, 0 ), vec( 0, 0.5, 0 ), vec( 0, -2, 0 ), linstep( 0, 4, time );

The curve has a bulge on the right. This is because the length of the tangent controls its strength onto the shape of the curve. The wider the distance of the tangent to its corresponding point is the highre is its influence on the shape of the curve.

Every argument can be animated which leads to unlimited curve shape possibilities.

Xpressionist 3.5