Special Shapes#
There are no pre-defined special shapes in the ASDF. All trajectories use the same underlying type of spline – see ASDF Splines.
Square#
Trajectories in the ASDF are smooth curves by default,
and a little extra effort is required to create movements with sharp corners.
There are two simple settings to get straight line segments:
tension="1"
or continuity="-1"
.
Both options are shown in square.asd
:
<asdf version="0.4">
<par>
<clip file="audio/marimba.ogg">
<channel id="one" />
<channel id="two" />
</clip>
<transform apply-to="one" tension="1">
<o pos="0 2" />
<o pos="-2 0" />
<o pos="0 -2" />
<o pos="2 0" />
<o pos="closed" />
</transform>
<transform apply-to="two" continuity="-1">
<o pos="0 2" />
<o pos="2 0" />
<o pos="0 -2" />
<o pos="-2 0" />
<o pos="closed" />
</transform>
</par>
</asdf>
Circle#
Non-rational cubic polynomial curves
– which is the type of curve the ASDF uses for position trajectories –
cannot exactly describe circles.
But this is no problem, because circles can be approximated very closely.
This can be done by providing the corner points of a square
and using a tension
value of about -0.66
.
However, there is actually a way to create exact circles:
by applying a rotation spline to a translated object.
The example scene circle.asd
shows both approaches:
<asdf version="0.4">
<par>
<clip file="audio/marimba.ogg">
<channel id="one" pos="0 2" />
<channel id="two" />
</clip>
<!-- this is a perfect circle: -->
<transform apply-to="one">
<o rot="-10" />
<o rot="-100" />
<o rot="-190" />
<o rot="-280" />
<o rot="closed" />
</transform>
<!-- this is extremely close to a circle: -->
<transform apply-to="two" tension="-0.66">
<o pos="0 2" />
<o pos="2 0" />
<o pos="0 -2" />
<o pos="-2 0" />
<o pos="closed" />
</transform>
</par>
</asdf>
In this example, the center of rotation is the origin.
If the center of rotation is supposed to be somewhere else,
it can be moved by applying a new <transform>
element
with the desired pos
attribute
to the <transform>
that does the rotation.
Helix#
A helical movement can be created by combining a (repeated)
circular movement (using one of the methods shown above)
with a linear movement perpendicular to the plane of the circle.
This is shown in helix.asd
:
<asdf version="0.4">
<par>
<clip id="ukulele" file="audio/ukewave.ogg" pos="-2 0" />
<transform id="circular-motion" apply-to="ukulele" repeat="10">
<o rot="0 0 0" />
<o rot="0 0 90" />
<o rot="0 0 180" />
<o rot="0 0 -90" />
<o rot="closed" />
</transform>
<transform id="forward-motion" apply-to="circular-motion">
<o pos="0 -2" />
<o pos="0 2" />
</transform>
</par>
</asdf>
In this example,
the <clip>
is offset to the left
and a rotation spline rotates this offset multiple times around the roll axis.
This circular motion is then translated along the default view direction.
In this case,
it doesn’t matter if forward-motion
is applied to circular-motion
or directly to ukulele
.
Sinusoidal Oscillation#
Sine waves are not directly supported by the ASDF,
but they can be approximated to some degree.
By setting speed="0"
at the desired maxima and minima,
something similar to sine and cosine oscillations can be created.
This is illustrated in sine-wave.asd
:
<asdf version="0.4">
<par>
<clip file="audio/marimba.ogg">
<channel id="one" />
<channel id="two" pos="0 2" />
</clip>
<transform id="left-right-motion" apply-to="one two" repeat="2">
<o pos="0 0" />
<o pos="2 0" speed="0" time="25%" />
<o pos="-2 0" speed="0" time="75%" />
<o pos="closed" />
</transform>
<transform id="forward-backward-motion" apply-to="one" repeat="2">
<o pos="0 2" speed="0" />
<o pos="0 -2" speed="0" time="50%" />
<o pos="closed" />
</transform>
</par>
</asdf>
Lissajous Figures#
Once we have sinusoidal oscillations (or at least something similar),
we can make Lissajous figures, as shown in lissajous.asd
:
<asdf version="0.4">
<par repeat="2">
<clip id="ukulele" file="audio/ukewave.ogg" vol="0.3" />
<par repeat="3">
<transform id="left-right" apply-to="ukulele">
<o pos="-2 0" speed="0" />
<o pos="2 0" time="50%" speed="0" />
<o pos="closed" />
</transform>
<seq repeat="3">
<transform id="front-back" apply-to="ukulele">
<o pos="0 0" />
<o pos="0 2" time="25%" speed="0" />
<o pos="0 -2" time="75%" speed="0" />
<o pos="closed" />
</transform>
</seq>
</par>
</par>
</asdf>