Mini-project 1: Mesh Hello World
Due: Tues, Feb 11 (11:59 PM)
This project should be easy. The goal is to implement a simple mesh warping function Twist()
which twists the vertices of a mesh (or
feel free to experiment with other mesh warpings of your choice).
This will make sure everyone can build, load, save meshes, and perform some simple operations on mesh vertices.
Starter Code
The C++ starter code can be used if you desire (you can also use your own code but I may not be as helpful if
you get stuck).
Open the solution or run make
to build meshpro
and mesh_view
. Now running mesh_view
on a .off
mesh will view it. I have included one mesh in the meshes
subdirectory but more are available in a zip file. You can also download meshes from elsewhere and convert them to .off
using programs such as
trimesh2 or meshlab.
Your goal is to implement a simple warping operation in the method R3Mesh::Twist(double theta)
, in src/R3Mesh.cpp
. One possible way to do this is:
- Use the instance variable
bbox
to retrieve the mesh bounding box.
- Compute zf, a z coordinate normalized to be in [0, 1], based on the z extent of the bounding box.
- Rotate x, y around the center of the x, y bounding box by an angle zf·θ
After doing this you should be able to 'twist' any input mesh with the command meshpro input.off output.off -twist theta
.
Policies
Feel free to collaborate on solving the problem but write your code individually.
Submission
Submit your assignment in a zip file named yourname_project1.zip
. Include your code and a screenshot of a warped mesh.
Submit your zip to UVA Collab.