Docsity

Morphing Animation: Four-Point Subdivision and Interpolation, Assignments of Computer Graphics

Toggle sidebar
bg1
P04Writeup.txt
P04 - Morphing between polyloops
1. A four-point subdivision works by iterating through every segment
in a polyloop, creating another point in the middle of said segment.
It then bulges that point out 1/8th the distance between itself, and
the midpoint of an edge segment spanning between the points in the
original loop both prior, and succeeding the points comprising the
endpoints of the original line segment. In short, we are taking a
weighted average of four points (hence the name), and creating a fifth
point based on this. We are weighting the points by -1/16th for the
outside most points, and 9/16s for the inner points
2. A series of keyframes were generated by the user. Each of these is
a series of points. The four-point algorithm was used to interpolate
between a point's location in each keyframe, and its position in the
next keyframe, generating intermediate points. This was done for every
point, at which point, we had a series of intermediate polyloops,
depicting intermediate frames of the animation. To then show the
animation, we just show one polyloop at a time, and iterate across
them.
Extra Credit:
1. A linear interpolation method was also implemented.
2. I thought it'd likely be possible to avoid squashing by separating
the transformation of the object over time from its position. This
could be achieved by describing each keyframe by how it morphs, and,
separately, by angle and position. First, we pick two arbitrary points
in our polyloop that we will use to determine orientation (such as the
first point, and the point that is at total number of points/2). The
vector between these is the orientation of our frame, and the midpoint
of the line between these two points is our 'center'. For our actual
interpolation, we first take the points we're using to determine our
angle vector, and store them. We then take our keyframes, and remove
all changes in angle and position, so that only the change in morphing
is retained. We do this by rotating the figure so that the angle
vector (as determined above) is the same across all keyframes (we can
easily do this by rotating every figure by the negative of the angle
of the vector, thus making it so its angle vector is now perfectly
horizontal). We also translate all points in the frame by a given
amount, such that the 'center' (again, as determined above) falls on a
specific location (again, for simplicities sake, we could say the
center point is 0,0, and figure out what vector we must transpose the
center by to get it there; this then is added to every point in the
frame). When we finish this step, we have a set of frames whose
difference is only in morphology; and a set of tuples of points,
denoting the location of the first point of the corresponding
polyloop, and the point halfway through the polyloop.
Page 1
pf2

Partial preview of the text

Download Morphing Animation: Four-Point Subdivision and Interpolation and more Assignments Computer Graphics in PDF only on Docsity!

P04Writeup.txt P04 - Morphing between polyloops

  1. A four-point subdivision works by iterating through every segment in a polyloop, creating another point in the middle of said segment. It then bulges that point out 1/8th the distance between itself, and the midpoint of an edge segment spanning between the points in the original loop both prior, and succeeding the points comprising the endpoints of the original line segment. In short, we are taking a weighted average of four points (hence the name), and creating a fifth point based on this. We are weighting the points by -1/16th for the outside most points, and 9/16s for the inner points
  2. A series of keyframes were generated by the user. Each of these is a series of points. The four-point algorithm was used to interpolate between a point's location in each keyframe, and its position in the next keyframe, generating intermediate points. This was done for every point, at which point, we had a series of intermediate polyloops, depicting intermediate frames of the animation. To then show the animation, we just show one polyloop at a time, and iterate across them.

Extra Credit:

  1. A linear interpolation method was also implemented.
  2. I thought it'd likely be possible to avoid squashing by separating the transformation of the object over time from its position. This could be achieved by describing each keyframe by how it morphs, and, separately, by angle and position. First, we pick two arbitrary points in our polyloop that we will use to determine orientation (such as the first point, and the point that is at total number of points/2). The vector between these is the orientation of our frame, and the midpoint of the line between these two points is our 'center'. For our actual interpolation, we first take the points we're using to determine our angle vector, and store them. We then take our keyframes, and remove all changes in angle and position, so that only the change in morphing is retained. We do this by rotating the figure so that the angle vector (as determined above) is the same across all keyframes (we can easily do this by rotating every figure by the negative of the angle of the vector, thus making it so its angle vector is now perfectly horizontal). We also translate all points in the frame by a given amount, such that the 'center' (again, as determined above) falls on a specific location (again, for simplicities sake, we could say the center point is 0,0, and figure out what vector we must transpose the center by to get it there; this then is added to every point in the frame). When we finish this step, we have a set of frames whose difference is only in morphology; and a set of tuples of points, denoting the location of the first point of the corresponding polyloop, and the point halfway through the polyloop.

Page 1

P04Writeup.txt

Next, we interpolate across the stored tuples of points, generating the 'animation' of each point separately. This will generate a series of points, similar to the normal 4-point interpolation, but now, there are only two points per frame. We also interpolate across the stored frames, generating the transposition of each point separately. We now have a series of changed frames, whose 'center' points are all the same, and whose vector between the first point, and the point halfway around the polyloop, are the same. So it depicts simply the way the shape morphs, without any change of location or orientation (except that inherent in the morph).

To draw our animation, we iterate across each entry in the interpolated keyframes depicting morphology, and rotate it by the vector between the two points stored in the corresponding entry in our tuple array. We then transpose the keyframe (or, rather, transpose every point in the keyframe) by the amount it takes to move the keyframe's center point (again, the midpoint of a line between the first point of the polyloop, and the point midway around it) to the center point between the two points in the tuple array.

I have not attempted to implement this, as I did not feel like attempting to build it from scratch, nor attempting to add it to the professor's code (which I find extremely cumbersome to work with). I do, however, believe the algorithm will achieve satisfactory results. If my explanation is a bit vague, please contact me, and I will endeavor to demonstrate more effectively what it does.

Page 2