首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写Mesh Simplification程序 代写python esh
项目预算:
开发周期:
发布时间:
要求地区:
Assignment 3 - Mesh Simplification
In this assignment you will build a half edge data structures for triangle meshes loaded from .obj files and
simplify these meshes using the quadratic error scheme described in class Garland and Heckbert 1997.
There is a framework of provided code to get you started. It loads a mesh with trimesh, just like the previous
assignment, and sets up a viewing canvas and user interface. Notice that there are keyboard controls
associated with the UI buttons and check boxes (e.g., N and T for walking to next and twin half edge). You
should look through the four provided python files to familiarize yourself with the classes, members, methods,
and the comments left in the code (see likewise the descriptions below).
The provided code also includes a few geometry shaders (not covered in this course) to help with certain
aspects of the visualization. For your optional edification, notice that the glsl shaders to draw the mesh
include a geometry shader that computes the face normals for flat shading. There is also glsl shaders to draw
a half edge with "fancy lines" using ray tracing, and a module for rendering text (e.g., triangle and vertex
indices to help you debug your code).
You are also provided in a data folder a number of sample triangle meshes that will be useful for testing your
program. All meshes are triangular manifolds without boundary.
Getting Started
You can use the same python and environment that you set up in the previous assignment as this assignment
has most of the same module requirements. New for this assignment, you must install the SortedContainers
module:
python -m pip install sortedcontainers
Provided Code
Download the provided code from MyCourses. It is a working program that will load one of the meshes and
will draw it. Beyond that, many of the UI controls will do nothing or cause the program to crash until you
implement the associated objectives. The following classes and functions of interest are included in the
provided py files:
HalfEdge
The half-edge class is simple, and provided for you. Half-edges can be drawn to help you verify that your
program is working. For your convenience, it also contains a tail method to get the starting vertex for this
half-edge.
Face
The face class contains one of its half edges, and its index within the Nx3 numpy array of face data (this is
faces of the SimplificationViewer class, which is associated with the index buffer object ibo). The other
README.md 2025-10-24
2 / 4
members of the class are used to cache information for the draw_debug method, which will draw the index of
each face on the face.
Vertex
The vertex class is simply a container to hold the position of the vertex, and information for the quadric error
metric. It holds a reference to one of the half-edges that has this vertex as head. It also has a method for
drawing vertex indices to potentially help with debugging.
EdgeCollapseData
This class is a container for edge specific information common to the two half edges, and specifically the cost
for collapsing the edge and its optimal vertex position. It has members for storing the quadric error metric for
collapsing the edge, the optimal vertex position, and the error. It also points back to one of its half edges. The
class implements the less than and equality operations so that you can use it in a sorted list.
build_heds()
The heds.py file contains a function for building the half edge data structure, and this is where you start (i.e.,
the first objective). This function build a list of half-edges and a list of Faces that will be returned to permit
further processing within the viewer class.
SimplificationViewer
This a larger class because it handles viewer widget setup, mesh loading, shader loading, viewing and
projection setup, UI methods (e.g., mouse interaction), and methods for the UI to call (e.g., next half edge,
twin half edge, LOD control, etc.). You will need to do most of your work near the bottom of the file (i.e., the
collapse method). That said, there are some important details to keep in mind so that your code works as
intended with the viewing framework.
The LOD slider slowly grows in range as you collapse edges, letting you view different levels of
simplification once you've completed objective 3.
Each collapse creates a new Vertex and adds it to the end of the vert_objs list, while also adding the
vertex position into the vertex buffer object (for drawing). This permits easy rendering of different LODs
where it is only the face indices that need to be updated to reference the old vertices or the new vertex.
Each collapse removes 2 faces, and you must swap entries in the faces and face_obj members to put
these faces at the end of the list of faces of the current LOD level. That is, your first collapse "moves"
your removed faces to the end of the list, and your second collapse will move the next two removed
faces to the next two spots (i.e., 4th last and 3rd last). This is so that for any given LOD you simply need
to draw the number of faces of the mesh at that level (i.e., the original number of faces minus two times
the current_LOD).
Finally, note that changing the LOD slider will cycle through the list of changes, either undoing or
redoing the collapse until arriving at the desired LOD. This is not changing your half edge data
structure, which will remain in a state where it represents the coarsest mesh after a sequence of
collapses. Instead it simply changes the vertex indicies for the set of faces affected by the collapse.
Objectives
README.md 2025-10-24
3 / 4
1. (2 marks) Half Edge Data Structure.
Write code that builds the half edge data structure. You will probably want to keep track of the
half edges you create as you make them so that you can easily connect each half edge with its
twin (refer to the discussion from class, and consider using a dictionary of 2-tuples).
Test that your structure is correct by using the UI to walk around the data structure (next, twin,
next, etc.).
2. (2 marks) Edge Collapse.
Implement code to collapse the current half edge when C or the corresponding button is
pressed. Given you've not yet implemented the quadric error metric yet, you can test by
collapsing to the edge midpoint.
See the the provided code creates the new vertex, using he.next.twin as its associated half
edge, which is returned at the end of the method.
Recall (from above) that you must do swaps to edit the faces and face_objs members to
ensure the removed faces are at the end of the current LOD's faces.
Test that you can collapse edges and still correctly walk around the mesh.
3. (2 marks) Undo / Redo
Create the correct CollapseRecord to permit the face indices of affected faces to be done or
undone to change between levels of detail.
Note that CollapseRecord contains Face objects rather than integer face indices. This is
because the face indices will change as you go through the simplification process (i.e., always
moving the collapsed faces to the end of the current LOD's faces).
Note that when collapse is called it sets the LOD to be the current max_LOD. This ensures the
state of the face and face_objs members are representing the coarsest level so as to match the
current state of the half edge data structure.
4. (2 marks) Avoid Topological Problems.
Write code to check if a collapse will cause topological problems using the following heuristics.
That is, check if the 1-rings of the edge vertices have more than 2 vertices in common.
Note that a mesh will not simplify beyond a tetrahedron because the methods that call Collapse
check that there are more than 6 edges in the mesh before calling collapse.
If you do not maintain the half edge data structure in a valid state, then you will quickly
encounter problems on subsequent edge collapse operations!
5. (3 marks) Quadric Error Minimum.
Write code to compute the quadric error matrix for faces, vertices, and complete the constructor
for EdgeCollapseData which solves the quadratic equation for the given edge. Use your
preferred technique for handling rank deficient matrices.
README.md 2025-10-24
4 / 4
6. (2 marks) Mesh Simplification.
Once you've implemented the constructor for EdgeCollapseData, the
compute_edge_collapse_costs() method will insert the edges into the sorted_edge_list.
You will be able to jump to the best half edge with the J key or associated button, and likewise
collapse this best edge (without jumping) with B.
You will need to make sure your code in the collapse function updates the sorted_edge_list
correctly at each collapse. EdgeCollapseData of edges adjacent to the collapsing edge must be
removed from the sorted list, and those edges adjacent to the new vertex will need to have new
EdgeCollapseData positions and costs computed and re-added to the sorted_edge_list.
Note that the quadric error of the new vertex is simply the sum of the Q for the adjacent vertices.
That is, it does not contain any regularization, and is not reconstructed based on the planes of
the new faces surrounding the vertex. That is, the Q at this vertex reflects the desired position
given the shape of the original mesh as opposed to the shape at the current level of detail.
With this objective complete, you should be able to collapse all to simplify meshes to a
tetrahedron. You can view all levels of detail with the LOD slider, and can likewise couple a
heuristic scaling to show the mesh at smaller sizes for smaller meshes. You might look at the
code and notice the scaling heuristic used to link scale with the LOD.
Finished?
Great! Submit your python implementation and log file, and optionally a readme file as a zip archive to
MyCourses (only use zip format). Use the comments at the top of the files you submit to list your name and
student number, and likewise add your name and student number to the title of the main application window.
Recall the readme can be used to request a late penalty waiver following the mechanism described in the first
lecture slides.
Note that you are encouraged to discuss assignments with your classmates, but not to the point of sharing
code and answers. All code and written answers must be your own. Please see the course outline and the fine
print in the slides of the first lecture.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dl-fall-25 kaggle contes...
2025-10-28
代写eden4027 translation stu...
2025-10-28
代写bien 290: bioengineering...
2025-10-28
代写qbus6860 group assignmen...
2025-10-28
代做comp4920 applied ethics:...
2025-10-28
代写bism7202 information sys...
2025-10-28
代写bism7202 information sys...
2025-10-28
代做pubpol 522 – autumn 202...
2025-10-28
代做accy231 2025 final asses...
2025-10-28
代写math2070/2970: optimisat...
2025-10-28
代做accfin5024 international...
2025-10-28
代做com62204 – visual commu...
2025-10-28
代做info1112 a2: trivia.net ...
2025-10-28
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!