SynopsisYour job will be to create a "paper doll" like the one shown, and then allow it to be manipulated with the mouse -- moved about the screen, and arms, legs and head to be repositioned (within limits).
Your application window should have one menu, the File menu. The menu is as follows, with the corresponding keyboard accelerators:
File Reset (Ctrl-R) ---- (divider) Quit (Ctrl-Q)
Reset should reset the doll to its original orientation.
Quit should exit the application.
Paper Doll Image
Construct your paper doll as a scene graph. Each node in the scene graph should define an affine transform so it draws itself in the correct location relative to its parent's coordinate system. This transform will be passed down to children so they always draw themselves relative to their parent's coordinate system. For example, if you want to draw the torso in a particular location, you will define a translation transform, set the Graphics2D to that transform, then draw the torso at (0,0). Since you set the Graphics2D transform to a translation matrix, the torso will not actually draw at (0,0) on the screen, but at the location defined by the translation matrix. Furthermore, the head will inherit the torso's coordinate system and simply draw relative to the torso and appear in the expected location relative to the torso.
The paper doll should be directly manipulable: You should be able to click on any body part and move it. The body parts should be manipulable according to the following constraints:
- The head can tilt left and right relative to the torso, but should not deviate more than 50 degrees in either direction from the primary axis defined by the torso. You may define where the rotation point is for the head (i.e., at the torso, or some other location, such as in the head).
- Clicking and dragging the torso should move the entire paper doll. The torso cannot be rotated.
- The upper arm is attached to the torso and may rotate an entire 360 degrees about its point of attachment to the torso. When rotating the upper arm, the lower arm should retain its same relative orientation to the upper arm. For example, if the lower arm is at a 30 degree angle relative to the upper arm, and the upper arm is rotated, the lower arm should retain its 30 degree angle relative to the upper arm.
- The lower arm should have a movement range of 135 degrees in either direction relative to the primary axis defined by the upper arm.
- The hand can pivot 35 degrees in either direction relative to the lower arm. It should maintain its same relative orientation to the lower arm independent of any rotations of the lower or upper arm.
- The upper leg can pivot 90 degrees in either direction relative to the primary axis defined by the torso.
- The lower leg can also pivot 90 degrees in either direction relative to primary axis defined by the upper leg.
- Assume the feet are attached at a 90 degree angle to the lower leg. Given this, they can pivot 35 degrees in either direction from this initial orientation.
- The upper and lower legs can each be "stretched" by scaling them along their primary axes. Other parts, such as the feet, however, should stay at the same scale (i.e., feet do not scale). Furthermore, scaling the upper leg should scale the corresponding lower leg simultaneously.
Rotating a body part is done by clicking on that body part and moving the mouse relative to the pivot point. For the body parts that support scaling, scaling is done by clicking on that body part and moving it nearer or further away from the pivot point, and you should be able to rotate and scale at the same time. The body part should not move until the mouse is moved, and it should transition smoothly from its current scale and rotation to the new scale and rotation: it should not "pop" into some default value when it's clicked. For part marks, you can instead present a widget-based interface for rotating and scaling, for example having buttons for rotating by five degrees.
This is a direct-manipulation interface, so you should be interacting with body parts directly. This implies that when you drag a body part with the mouse, it should stay positioned under the mouse cursor as it moves.
Implement one or more features totalling up to 15% from this section.
- Locate or draw images for a head, torso, upper and lower arm, hands, upper and lower leg, and
feet. These don't need to be fancy or perfectly cut out. In fact, roughly cut-out photographic
images, or hand-sketched components can have a pleasing aesthetic (5 marks).
Important note: You are free to choose any content for the paper doll as long as it is tasteful and respectful of any and all individuals or groups of individuals -- any submission not meeting these criteria will be dealt with according to Policy 33 or similar policies, and will run the risk of losing some or all marks. When in doubt, ask the prof if you have questions about your choice of content.
- The ability to save and load the current pose of the doll in a text-based format, using a JFileChooser meeting the same requirements as in Assignment 2 (5 marks). If you choose this enhancement, you may use a third-party JSON or XML library, BUT you must include it in your assignment, and your makefile should handle it appropriately (i.e. `make run` builds and runs with this jar file). This is the ONLY exception to the 'no third party libraries' rule below.
- A timeline, similar to the one implemented in Assignment 2. The timeline should have at least three buttons: one for playback, one for a "keyframe", and one for removing all keyframes. When the keyframe button is pressed, the current pose of the ragdoll is added as a point on the timeline. (Where the keyframe is added is up to you: you can have a timeline with a fixed length and the keyframe is inserted at the current position of the playback cursor, or you can extend the timeline and add a new keyframe.) When the play button is pressed, the doll should transition smoothly through each pose on the timeline, and moving the playback cursor between two poses should show the doll partway between those poses (15 marks). For part marks, the timeline simply goes between poses, instead of having a smooth transition between them (10 marks).
- Multiple ragdolls. There should be a second menu on the menu bar containing the different ragdolls the user can choose from using radio buttons. These ragdolls must have different "structures": they cannot simply be different textures on the human-like ragdoll from the core requirements. Instead, they should have different parts, such as an animal, or a tree, or something else interesting. You should have at least two new ragdolls along with the human-shaped ragdoll from the core requirements, and they should have their own rotation constraints (15 marks).
- Inverse Kinematics. When a hand on the ragdoll is clicked and dragged, it will move to make sure the point under the cursor stays under the cursor; if it can't do so just by rotating the hand, then the lower arm will rotate so that it may, and if it can't do so just by rotating the hand and lower arm, then it will rotate the upper arm as well. None of the body parts should move outside their ranges of motion. If a body part has to move outside its range of motion to keep the clicked point under the mouse, the ragdoll should get as close as it can, instead (15 marks). Note: This enhancement may be difficult if you have not done numerical computation before. You may use an existing algorithm for solving this problem as long as you implement the code yourself and cite the algorithm. "FABRIK" may be a good choice for simplicity.
The application must be built in Java SE 8 (8u101 or later). You may implement it on Windows, macOS or Linux.
You may use the vecmath.jar file, and any sample code provided in class. You may use any classes included in the Java SDK. You should not use any other external classes.
Submit the following to your personal git repository:
- All files required to build and run your project
- A Makefile that will build, then execute, your project by typing only "make run" from the command line
- A 'readme.txt' file that documents your application, icluding the platform you used for development and testing and any extensions or improvements that you made to the application
This assignment is graded out of 105%. The submission will be assessed roughly as follows:
- Deliverables: Appropriate makefile, readme.txt, compiles and runs.
- Basic functionality: Menus implemented as described; paper doll displayed in a visually pleasing manner
- Translation: The entire doll can be translated using the torso.
- Rotation: Head, arms, legs, etc. can be rotated, within the limits described.
- Scaling: The legs can be stretched, as described.
- Robustness: The interactions should be smooth, and not involve any "popping" or graphical glitches.
- 1.1. Feb 28. Initial draft.
- 1.2. Mar 1. Clarified single, non-resizable window. Adjusted grades for enhancements, and made assignment out of 105%.
- 1.3. Mar 7. Clarified the scaling the upper leg scales the lower leg simultaneously, but that scaling the lower leg has no effect on the upper leg.
- 1.4. Mar 15. Moved due date to Tues Mar 21 at 5:00 PM.