by April Grow and Julie Rej
(agrow & jrej)
Our project animates yarn using a mix of procedural animation and physics animation. We were unable to meet our goals of collision detection and yarn-yarn or yarn-hook interaction. However, in lieu of those goals, we created other yarn-based animations using customizeable sine-wave based functions on a curve that can be drawn using bezier, bspline, or catmull-rom curve blending. We focused our efforts on the animation portion of the assignment and are pleased with the progress we were able to accomplish, even if it was not directly the same as our initial proposal.
There are a lot of them
// Activating Xbox Controller
m - Toggles whether the Xbox or Keyboard is used to move the control points
*****For debugging purposes with the Xbox controller
// Curve Selection:
1 - Use B-Spline to create curvepoints
2 - Use Nth degree Bezier curve to create curvepoints
3 - Use Catmull-Rom to create curvepoints
// Control Points
+/= - Increments forward along the yarn's control points.
***** If physics is on, it changes the pivot point.
***** If physics is off, it changes the control point the user can move.
***** XNA recognizes each of these keys as a single press. Shift doesn't matter.
-/_ - Decrements backward along the yarn's control points.
***** If physics is on, it changes the pivot point.
***** If physics is off, it changes the control point the user can move.
***** XNA recognizes each of these keys as a single press. Shift does not matter.
w - Move the selected control point up (Positive Y)
a - Move the selected control point left (Negative X or Z depending on the camera view)
s - Move the selected control point down (Negative Y)
d - Move the selected control point right (Positive X or Z depending on the camera view)
Space - Adds a new control point to the list
Backspace - Deletes a control point from the end of the list (if possible)
// Physics
q - Toggles influence of physics forces on/off
// Yarn Animation
f - Turns off all sine wave influence on the curve. Freezes the yarn in position if it is moving.
v - Turns on sine wave influence in the X and Y only (2D)
c - Turns on sine wave influence in the X, Y, and Z (3D)
y/t - Increases/decreases the Amplitude of the sine wave
h/g - Increases/decreases the wavelength of the sine wave. Will eventually cycle back around on itself.
n/b - Increases/decreases the rate/speed at which the sine wave goes up and down.
// Orientation
r Resets the curve points to a roughly equally spaced zig-zag pattern.
***** Useful if physics or user movement of the control points makes them unwieldly.
// Camera
Up arrow - Pans camera up
Down arrow - Pans camera down
Right arrow - Pans camera right
Left arrow - Pans camera left
Right shift - Zooms camera in
Left shift - Zooms camera out
Enter - Toggles between front and side view
The yarn is modeled using three different curves as part of our experiment to find the best
curve for use in demonstrating yarn. We use a bspline curve, an nth-order bezier curve, and a Catmull-Rom curve to show
the differences between interpolating and approximating control points and the effect control points have on continuity
of the curve.
Here are screenshots of the three curves, in the above order, using the same control points:
More images can be found here.
The user can manipulate the yarn using the WASD keys when the physics are active.
Much of the yarn's movement and positioning will be determined by the tension which may be expressed as,
In lieu of collision and animation of the yarn against itself and/or a hook, we decided to
model free-form yarn movement instead. Given the yarn is a curve, we use the sine wave function to
animate the yarn in various ways using different variables for amplitude, wavelength, and rate. In this way, we can
further illustrate the pros and cons of the differences in curves in different situations.
You can see a culmination of this animation in this video (Note: The lag in JING is horrid):
Download Full Size
And here are some other pictures using various curves and settings of the wave function:
Visit our CMPS 170 Sequence game website, Pattern, here! It inspired our work with curves and yarn!
We would like to acknowledge William Tuttle for his help with the nth degree Bezier design and primitive drawing in XNA 3.1, as well as Katarina Yang and her work in creating the yarn texture and background for the project.
http://en.wikipedia.org/wiki/Tension_%28physics%29 Tension wikipedia article showing fundamental physics ideas applied in our project.
http://en.wikipedia.org/wiki/B%C3%A9zier_curve Bezier curve description and details.
http://en.wikipedia.org/wiki/Cubic_Hermite_spline Catmull-Rom curve information.
http://en.wikipedia.org/wiki/B-spline Bspline curve information.
Computer Animation: Algorithms and Techniques by Rick Parent. 2nd Edition. Published by Morgan Kaufmann Publishers in Burlington, MA, in 2008. Very useful curve matrix information.
Our Technical paper has additional sources related directly to the content therein.