亚联社

您的位置 >> 首页 > 科技 > 列表

Computer Lab 代做、代写C++编程语言

时间:2024-04-26  |   来源:互联网  


Computer Lab Assignment #3, S1 2024
Date Issued: see Wattle page
Due Date: see Wattle page
Weighting: 12
Instruction:
All homework assignments must be completed individually. We encourage you to discuss the
assignments with other students. However, you should not share any of your codes with anyone
else. Each student is responsible for implementing the assignment on their own. You may assist
other in debugging their codes, but you should not copy and paste. ANU is using TurnItIn to
detect possible duplications. Consulting with previous year students who enrolled in this course
on specific assignment is also not allowed. You may use the internet as a resource for learning the
materials, but you should not borrow any existing codes found online.
The homework assignments involve a significant amount of C++ programming. However, for most
cases, a skeletal code base is provided, and you only need to fill in the missing parts, and/or fix
bugs if any.
You will submit a single ZIP file as your submission, which must contain the following files:
(1) All source codes (ending in .h, or .hpp, or .cpp), and your Makefile, CMakeLists.txt. Please
include all needed source codes for successful compilation. Please also remove all intermediate
files (such as ./vs. ./build. ) that are not needed for the compilation – Failing to do so will
lead to penalty to the marks.
(2) A written CLab3 Lab Report (minimum 10-point font size, single column, in PDF format,
with task statement, methods used, any new features that you have implemented, any known
bugs in your code, answer any questions that have been asked in the task, instruction for
the tutor to use your code, example experiment results. )
Your ZIP file must be named as “COMPX610 2024 HW3 UID.zip”. Replace ‘X’ with 4 or 8.
Replace the UID with your Uxxxxxxxx; Please submit your ZIP file to Wattle before the deadline.
Late submission will lead to penalty as per the ANU policy. Later-than-one-week submission will
1
not be accepted, which may result zero mark, unless a pre-approval for special consideration is
obtained in written before the submission deadline.
In C-Lab-3, you will be practising how to efficiently process 3D meshes. Specifically, there are
two tasks to complete: T1: half-edge data structure, and T2: mesh simplification. We
provide the general code framework for completing these two tasks and it is highly recommended
to use it. However, you’re also welcomed to build up your own pipeline as long as it satisfy all the
requirements.
Task-1: half-edge data structure
In this task, you will build upon your knowledge of C++ and graphics by creating a half-edge
data structure from interlinked pointers, and then compute important geometry and topology
properties, and visualize your mesh using MeshLab or Blender.
Steps to take:
(1) Use the two OBJ meshes provided in ”model” folder (bigguy2.obj, teeth.obj) to conduct the
following experiments and report their results. You are also welcomed to download other
complex 3D meshes in OBJ file format from the internet to test your algorithms. Make sure
that each of the meshes satisfies the following properties:
• The mesh contains a single connected component.
• The mesh must be watertight, i.e., a valid manifold surface that encloses a volume.
(2) Complete the following implementations in task1.cpp:
• Load the mesh in OBJ file format and represent the loaded mesh in the memory
by a half-edge data structure. In this step, you’ll need to implement the function
Mesh::convert obj format to mesh();
• Iterate all half edges that points away from given vertex by implementing the function
Vertex::neighbor half edges();
• Iterate all member vertices of given face by implementing Face::vertices().
• Compute its topology properties (genus number). You’ll have to implement the function
Mesh::compute genus();
• Compute its volume by implementing Mesh::compute volume();
• Compute its surface areas by implementing Mesh::compute surface area()
• Compute the average degree of all the vertices by implementing
Mesh::compute average degree().
(3) Your lab report should contain the following contents:
2
• Put the screenshot of the mesh represented by half-edge data structure
• Brief introduction describing the process of your conversion (a pseudo-code will be best
for clarification)
• Show the geometric properties (e.g. number of vertices, faces, half-edges and edges) of
the mesh as well as your topology computation results with the screenshot from the
terminal output.
Hint:
Half-edge data structure consists of four basic components: Vertex, Face, HalfEdge, and
Edge. The format of the half-edge data structure is outlined below, and basic class member
variables are already provided in include/mesh components.hpp. (Additional member
variables and member functions are used in task2, you can ignore it for now.)
Reference guide:
https://cs418.cs.illinois.edu/website/text/halfedge.html
https://cs184.eecs.berkeley.edu/sp24/docs/half-edge-intro
The Vertex class contains variables for the following information:
• A Vector3 for storing its (x, y, z) position;
• A pointer to one of the HalfEdges that points away from this Vertex;
• A unique integer identifier for the Vertex.
The Face class contains variables for the following information:
• A pointer to one of the HalfEdges that lies on this Face;
• A unique integer identifier for the Face.
The HalfEdge class contains variables for the following information:
• A pointer to the next HalfEdge in the loop of HalfEdges that lie on this HalfEdge’s Face;
• A pointer to the HalfEdge that lies parallel to this HalfEdge and which travels in the
opposite direction and is part of an adjacent Face, i.e., this HalfEdge’s symmetrical
HalfEdge;
• A pointer to the Edge on which this HalfEdge represents;
• A pointer to the Face on which this HalfEdge lies;
• A pointer to the Vertex that this HalfEdge originates from;
• A unique integer identifier for the HalfEdge.
The Edge class contains variables for the following information:
• A pointer to one of the HalfEdges that represents this Edge;
• A unique integer identifier for the Edge.
In your Lab report, you should clearly visualise the mesh, and list key results to demonstrate your
solutions.
3
Task-2: Simplify the mesh using quadratic error metrics
Purpose:
The goal of this task is to load a mesh and to simplify the mesh down to a specified number
of triangles. You will learn about modern mesh simplification algorithms with a half-edge data
structure.
Description:
In this task, we will perform mesh simplification algorithm based on quadric error metric (QEM),
you may read the following paper for reference:
https://www.cs.cmu.edu/˜
./garland/Papers/quadrics.pdf
To perform surface simplification, you should use the half-edge data structure implemented in
task1 to achieve a pair-contraction operator for the mesh. This pair-contraction operation should
preserve the topology of the surface.
To reduce the difficulty of the implementation, we’ll simplify the algorithm in the original paper
introduced as follows:
4
(1) When choosing valid pairs (v1, v2) and perform contraction, we only consider cases where
(v1, v2) form an edge. Without loss of generality, we’ll use the term “pair contraction” and
“edge collapse” interchangeably.
(2) We will not use the point-to-plane distance as discussed in the paper that computes the
distance to adjacent planes to act as error metric, because degenerate cases may make the
problem more difficult to solve. Instead, we will use distance to adjacent vertices with the
derivation below. You should collapse edges in the order dictated by the error function below
and place new vertices at the minimizer of this error function:
• Let E(v) = Pn
i=1(v − vi)
2 be the error function associated with each vertex v of the
mesh, where {vi
, i = 1. . . n} are the neighbours of v. If we expand this quadratic,
we find that E(v) = nvT
v − 2v
T Pn
i=1 vi +
Pn
i=1 v
T
i
vi
, whose minimizer is given by
v =
Pn
i=1 vi/n.
• We can further rewrite E(v) as vector dot product form, which is: E(v) =

n
Pn
i=1 vi
Pn
i=1 v
T
i
vi
T

v
T
v −2v 1

. Therefore, all we need to store to represent
this quadratic is the coefficient q =

n
Pn
i=1 vi
Pn
i=1 v
T
i
vi

, which is a 5-d vector.
• The benefit of this representation is that when creating the combined quadratic for
the union of two vertices, we simply need to sum the two vectors, each containing 5
numbers, together for the two different vertices.
You should perform edge-collapse operations using the error function above until you achieve the
desired number of polygons or there are no more edges that can be collapsed safely. The processing
time must be below one minutes. Your report should display the original and simplified surface
and also report the number of vertices, faces and edges respectively.
You must disallow edge collapses if they create illegal topology. While you should work
independently, it is a good idea to compare your results with other students, to verify code
correctness. You should assure in your input OBJ all the polygons are triangles and
the input surface is closed.
Steps to take:
Perform mesh simplification in task2.cpp. We already provide the code framework for this
function and all you need to do is to complete the missing functions as specified in the code.
However, you’re also welcomed to implement the whole pipeline in your own way as long as it
successfully achieves the simplification functionality and generate the same results. Complete the
following functionalities:
(1) Vertex::compute qem coeff() to compute the coefficient vector q that represent the
quadratic coefficient of this vertex.
(2) Edge::compute contraction() to compute the following results for this edge (v1, v2),
which will be used later to perform edge collapse:
• The optimal contraction target v

;
5
• The quadratic error metrics E(v

) which is the combined quadratic for the union of
v1, v2. Note that the computed results will become the cost of contracting this edge.
(3) Edge::edge contraction() to perform edge-collapse, which we will write as (v1, v2) →
v

. It contains the following steps:
• Moves the vertex v1 to the new position v*, remember to update all corresponding
attributes
• Connects all incident edges of v1 and v2 to v*, and remove the vertex v2
• Any faces, half edges, and edges associated with this collapsed edge will be removed.
(4) Your lab report should contain the following contents:
• Use the two OBJ meshes provided in ”model” folder to demonstrate the results.
• Display the original mesh as well as the simplified mesh with MeshLab or Blender.
• Take the screenshot of the mesh geometric information as well as the verification results
from the terminal output to demonstrate the correctness of your implementation.
More example mesh surfaces can be found here: happy, teddy
Your ZIP file must be named as "COMPX610 2024 HW3 UID.zip".
== END OF CLAB-3 ==

 

请加QQ:99515681  邮箱:99515681@qq.com   WX:codinghelp