+ All Categories
Home > Documents > PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display...

PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display...

Date post: 21-Dec-2015
Category:
View: 220 times
Download: 6 times
Share this document with a friend
15
1 PA1 Supplementary notes Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges, faces, boundaries, and compute Euler characteristic and number of genus Corresponding to function Mesh::DisplayMeshInfo() 2. Compute normal at each vertex Corresponding to function Mesh::ComputeVertexNormals() 3. Compute mean curvature at each vertex Corresponding to function Mesh::ComputeVertexCurvatures()
Transcript
Page 1: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

1

PA1 Supplementary notes

Programming assignment

You need to implement the following:

1. Display basic mesh Information Find the number of vertices, edges, faces, boundaries,

and compute Euler characteristic and number of genus Corresponding to function Mesh::DisplayMeshInfo()

2. Compute normal at each vertex Corresponding to function

Mesh::ComputeVertexNormals()

3. Compute mean curvature at each vertex Corresponding to function

Mesh::ComputeVertexCurvatures()

Page 2: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

2

PA1 Supplementary notes

Programming assignment

4. Explicit umbrella smoothing Corresponding to function

Mesh::UmbrellaSmooth ()

Implicit umbrella smoothing Corresponding to function

Mesh::ImplicitUmbrellaSmooth ()

Page 3: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

3

PA1 Supplementary notes

Wavefront OBJ file format comment

three vertices of each face

coordinates of vertex 1

v1

v2

v3

v4

counter-clockwise order as you look at the face from outside

Page 4: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

4

PA1 Supplementary notes

How to modify program arguments

1) Select the menu item “Project Property”

Page 5: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

5

PA1 Supplementary notes

How to modify program arguments

2) Select the “Debugging” tag

3) Type your arguments here

4) Press enter to comfirm

Page 6: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

6

PA1 Supplementary notes

Normal at a vertex

From Siggraph 2000 subdivision course notes, the normal vector at an interior vertex of valence k can be computed as t1 x t2, where ti are tangent vectors computed as:

Example: for valence four, the masks are

[1, 0, –1, 0] and [0, 1, 0, –1].

1

02

1

01

2sin

2cos

k

ii

k

ii

k

i

k

i

pt

pt

1 -1

0

0

0 0

-1

1

t1

t2

Masks for valence four

Page 7: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

7

PA1 Supplementary notes

Normal at a vertex

At a boundary vertex p with valence k, the normal is computed as talong x tacross computed as follows:

p0

p1

pk-1

p

)1/(

4sin)2cos2()(sin

3

22

2

110

1

10

10

kwhere

ki

k

k

k

iik

across

kalong

ppp

pp

ppp

t

ppt

Page 8: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

8

PA1 Supplementary notes

Mean curvature at a vertex

From Siggraph99 Desbrun et al , the discrete mean curvature at an interior vertex p with valence k can be computed as the L2-norm of

where A is the sum of areas of all the triangles sharing the vertex p

1

0

))(cot(cot4

1 k

jjjjAppn

p

pj

p

pj-1

pj

Pj+1

one term of the summation, corresponding to edge p pj

Page 9: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

9

PA1 Supplementary notes

Explicit Umbrella Smoothing

Fairing operator

In matrix form

In your implementation you do not need to build the matrix

1

0

1 k

jiji xx

kx -

iinewi xxx

)L(XXX tt1t

t1t L)X(IX λ

Drawbacks: small time step for large mesh slow

Where t is time stamp

Page 10: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

10

PA1 Supplementary notes

Implicit Umbrella Smoothing Explicit updating

Allows large time step In your implementation setting to 1 is okay You can use biconjugate gradient (BCG)

method to solve the linear system

)L(XXX tt1t 1

t1t XL)X(I λ

t1t XL)(IX 1 λ

λ

You need to solve a sparse linear system

Page 11: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

11

PA1 Supplementary notes

Sparse Linear System

You need to build the sparse linear system by create a Matrix object Use Matrix::AddElement to add an element Use Matrix::SortMatrix to sort the elements after

adding all of them

You need to implement the function Matrix::BCG() to solve the linear system Use Matrix::Multiply to compute b = Ax Use Matrix::PreMultiply to compute bT = xTA

Page 12: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

12

PA1 Supplementary notes

Using Boundary Half-edge

For open meshes, you can also maintain boundary half-edges such that the searching and updating will be much more easy. (every things are circular list, also no need to handle NULL pointers)

Here the boundary half-edges are shown in red as the triangles are being loaded.

Page 13: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

13

PA1 Supplementary notes

Useful Classes and Functions Classes OneRingHEdge and OneRingVertex

provide an interface to access the one-ring neighboring half-edges and vertices of a given vertex.

Function Vertex::Valence() let you know the valence (# of neighboring vertices) of a vertex.

Page 14: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

14

PA1 Supplementary notes

Rendering in OpenGL (Flat)

One normal for a triangle

Page 15: PA1 Supplementary notes 1 Programming assignment You need to implement the following: 1. Display basic mesh Information Find the number of vertices, edges,

15

PA1 Supplementary notes

Rendering in OpenGL (Smooth)

One normal for each vertex


Recommended