Mesh data structures. Abstract. 1 Introduction. 2 Method. 2.1 Implement the half edge mesh LIU TNM

Similar documents
THE HALF-EDGE DATA STRUCTURE MODELING AND ANIMATION

CS 177 Homework 1. Julian Panetta. October 22, We want to show for any polygonal disk consisting of vertex set V, edge set E, and face set F:

Lectures in Discrete Differential Geometry 3 Discrete Surfaces

Chapter 23. Geometrical Optics (lecture 1: mirrors) Dr. Armen Kocharian

CSE 554 Lecture 6: Fairing and Simplification

MA 323 Geometric Modelling Course Notes: Day 36 Subdivision Surfaces

The Law of Reflection

Polar Coordinates. 2, π and ( )

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

How shapes are represented in 3D Graphics. Aims and objectives By the end of the lecture you will be able to describe

Angles of Polygons. Essential Question What is the sum of the measures of the interior angles of a polygon?

CS 468 (Spring 2013) Discrete Differential Geometry

Voronoi Diagrams and Delaunay Triangulations. O Rourke, Chapter 5

Basics of Computational Geometry

(Discrete) Differential Geometry

Reflection and Mirrors

7. The Gauss-Bonnet theorem

Convex Hulls (3D) O Rourke, Chapter 4

Study Guide for Test 2

Differential Geometry: Circle Patterns (Part 1) [Discrete Conformal Mappinngs via Circle Patterns. Kharevych, Springborn and Schröder]

Computational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm

Surface Mesh Generation

Geometric Modeling Assignment 3: Discrete Differential Quantities

Geometry Definitions and Theorems. Chapter 9. Definitions and Important Terms & Facts

Lecture Notes (Reflection & Mirrors)

Recovering Primitives in 3D CAD meshes

Generalized barycentric coordinates

CS3621 Midterm Solution (Fall 2005) 150 points

Math 6, Unit 8 Notes: Geometric Relationships

Warm-Up Exercises. 1. If the measures of two angles of a triangle are 19º and 80º, find the measure of the third angle. ANSWER 81º

Curvature Berkeley Math Circle January 08, 2013

Chapter 23. Geometrical Optics: Mirrors and Lenses and other Instruments

: Mesh Processing. Chapter 2

General Physics II. Mirrors & Lenses

Optics II. Reflection and Mirrors

Area rectangles & parallelograms

Review of Trigonometry

Parameterization with Manifolds

1 Trigonometry. Copyright Cengage Learning. All rights reserved.

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z

Math 308, Section 101 Solutions to Study Questions for Final Exam (Thursday, December 16, 2004)

Light: Geometric Optics

Select the best answer. Bubble the corresponding choice on your scantron. Team 13. Geometry

Computer Aided Engineering Design Prof. Anupam Saxena Department of Mechanical Engineering Indian Institute of Technology, Kanpur.

Geometry of Flat Surfaces

Section 2 Flat Mirrors. Distinguish between specular and diffuse reflection of light. Apply the law of reflection for flat mirrors.

Chapter 34. Images. In this chapter we define and classify images, and then classify several basic ways in which they can be produced.

Estimating normal vectors and curvatures by centroid weights

Propagation and Reflection of Light

SPECIAL TECHNIQUES-II

A TESSELLATION FOR ALGEBRAIC SURFACES IN CP 3

Planar Graphs. 1 Graphs and maps. 1.1 Planarity and duality

CS 468 (Spring 2013) Discrete Differential Geometry

Grade VIII. Mathematics Geometry Notes. #GrowWithGreen

Trigonometry Review Day 1

Reflection & Mirrors

Geodesics in heat: A new approach to computing distance

CLEP Pre-Calculus. Section 1: Time 30 Minutes 50 Questions. 1. According to the tables for f(x) and g(x) below, what is the value of [f + g]( 1)?

Bands: A Physical Data Structure to Represent Both Orientable and Non-Orientable 2-Manifold Meshes

Conics, Parametric Equations, and Polar Coordinates. Copyright Cengage Learning. All rights reserved.

Pre-Algebra, Unit 10: Measurement, Area, and Volume Notes

Geometry: Semester 2 Practice Final Unofficial Worked Out Solutions by Earl Whitney

Physics 11. Unit 8 Geometric Optics Part 1

From the SelectedWorks of Harish Chandra Rajpoot H.C. Rajpoot. Harish Chandra Rajpoot Rajpoot, HCR. Summer April 6, 2015

Lecture Outlines Chapter 26

Total. Math 2130 Practice Final (Spring 2017) (1) (2) (3) (4) (5) (6) (7) (8)

Light: Geometric Optics (Chapter 23)

DISCRETE DIFFERENTIAL GEOMETRY: AN APPLIED INTRODUCTION Keenan Crane CMU /858B Fall 2017

Pre-Algebra Notes Unit 10: Geometric Figures & Their Properties; Volume

coding of various parts showing different features, the possibility of rotation or of hiding covering parts of the object's surface to gain an insight

274 Curves on Surfaces, Lecture 5

Lecture 5 CLASSIFICATION OF SURFACES

SNAP Centre Workshop. Introduction to Trigonometry

Appendix E. Plane Geometry

Name Date. FINAL EXAM STUDY GUIDE Pre-Algebra Course 3

Conics, Parametric Equations, and Polar Coordinates. Copyright Cengage Learning. All rights reserved.

Light and Mirrors MIRRORS

34.2: Two Types of Image

GAUSS-BONNET FOR DISCRETE SURFACES

Parameterization of triangular meshes

Chapter Seventeen. Gauss and Green. We shall do this by computing the surface integral over each of the six sides of B and adding the results.

SOME PROPERTIES OF TRIGONOMETRIC FUNCTIONS. 5! x7 7! + = 6! + = 4! x6

Physics 1C Lecture 26A. Beginning of Chapter 26

05 - Surfaces. Acknowledgements: Olga Sorkine-Hornung. CSCI-GA Geometric Modeling - Daniele Panozzo

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Contents. MATH 32B-2 (18W) (L) G. Liu / (TA) A. Zhou Calculus of Several Variables. 1 Homework 1 - Solutions 3. 2 Homework 2 - Solutions 13

Parallel Transport on the Torus

Surfaces: notes on Geometry & Topology

Background for Surface Integration

AP Physics: Curved Mirrors and Lenses

Video: The Mirror. Unit #3 - Optics. Geometric Optics. A) The Law of Reflection. applications Mirrors.

Shape Modeling and Geometry Processing

Chapter 4: Trigonometry

Study Guide and Review

Nicholas J. Giordano. Chapter 24. Geometrical Optics. Marilyn Akins, PhD Broome Community College

Flat Surfaces, Teichmueller Discs, Veech Groups, and the Veech Tessellation

12:40-2:40 3:00-4:00 PM

CS 523: Computer Graphics, Spring Shape Modeling. Differential Geometry of Surfaces

Length and Area. Charles Delman. April 20, 2010

Lecture Notes (Geometric Optics)

Transcription:

Mesh data structures Fredrik Salomonsson fresa517@student.liu.se LIU TNM079 2010-05-28 Abstract When dealing with meshes containing large amount of triangles or quadrilaterals one need to have some kind structure of the data to speed up normal calculation for vertices, area and volume calculation, efficient way of finding neighbor vertices and faces for a certain vertex. Therefore the simple data structure for a mesh (containing only faces and vertices) does not suffice, and a more efficient data structure is needed. In this lab report I am going to talk about how to implement the half edge data structure for a more efficient way of handling searching for adjacent vertices and faces. Also to achieve a stable smoothing using mean curvature. 1 Introduction In this lab report I am going to talk about how to implement half edge data structure, use it to implement efficient and fast search for neighboring faces and vertices. Also using the neighboring search to calculate vertex normals, total area of the mesh, volume of the mesh, classify the genus of the mesh, calculate mean and Gaussian curvature and use the mean curvature for a more stable smoothing. 2 Method All the functions described below can be found in the file HalfEdgeMesh.cpp if nothing else is said. And I will switch to we instead of I, since it was me and my lab partner who implemented the different assignment, so that I will not confuse anybody. 2.1 Implement the half edge mesh To solve this assignment we first added the three vertices in the AddFace function to the function Addertex, which returned indices to where in the vertex list the vertices were placed. After the vertices were added to the vertex list we needed to create edges for the half edge data structure, we used the already implemented function AddHalfEdgePair that takes two vertex indices and return two indices for the inner and outer edge that it created for the vertex pair. We called the function for each vertex pair in a counter clock wise (CCW) order. The inner edge indices were then used to connect the inner ring of edges. Each edge has a pointer to the next edge and to its previous edge, these pointers where assign with the next edge and the previous edge in a CCW order. After that we create a face for the edges, since the half edge only required that the face only knows one edge of the triangle and from that it can reach the other edges by the edge s next and previous pointer, we only needed to add one edge to the face. We chose to add the first edge but any of the three edges will do because they all belong to the same edgeloop. The face was then pushed on the face vector, mface, using the function push_back. The face index was retrieved from the Face

vector for use in the function FaceNormal, that does a cross product between two of the face edges and normalize the result, to calculate the face normal for the face. The last thing before the half edge mesh was finished were to connect the inner edges to the face, this was only a simple operation of assigning the face to the inner edge face pointer. 2.2 Implement neighbor access To find neighbor faces and neighbor vertices are quite similar to each other when using half edge mesh. Every vertex contains a pointer to an edge and the edge contains a pointer to the connecting vertex and face; this can be used to efficiently find both neighbor faces and vertices. And therefore only one of the algorithms will be explain in detail. 2. Add that edge s vertex to the vector of neighbor vertices 3. Jump to next edge and go to its pair and jump to its next edge. 4. Check to see if the vertex that belongs to that edge is not equal to the first position in the vector of neighbor vertices. If it is not then go to 2, if it is equal to the first position then it means that the algorithm has found all the neighboring vertices. The find faces function is quite similar to the find vertex neighbors; the main difference is that we store the faces connecting to the edges instead of the vertices. 2.3 Calculate vertex normals In order to get smoother shading for the meshes we can use vertex shading, but for that the mesh needs to have a normal at each vertex instead of just having them on each face. In this assignment we implemented just this, by using the method called mean weighted equally (MWE) to calculate the vertex normal at each vertex, see equation 1. MWE is defined as the normalized summation of the adjacent face normals, meaning that that the vertex normal is the average of the 1- ring neighborhood (N1) face normals. Figure 1: the finding the 1-ring neighborhood of vertex v0 N vi = n j N 1 (i) n fj (1) To find the neighbors for the vertex we used the EdgeIterator class for iterating through the edges. The following is how the algorithm works 1. Get the edge connected to the vertex, v0 in figure 1. Jump to the next edge connecting to the vertex. To find the neighborhood face normals we used the already implemented function FindNeighborFaces, section 2.2. 2.4 Calculate surface area of a mesh We solve this assignment using the fact that any integral can be approximated by a A s = da A(f i ) S i S (2)

Riemann sum, explained in [1]. Because of that the area of a mesh can be approximated by the sum of the areas of each individual face of the mesh. The area of each face was calculated by taking the half magnitude of the cross product between two edges in the triangle, ½ (v2-v1)x(v3-v1). 2.5 Calculate volume of a mesh In [1] they used the divergence theorem to relate the surface and the volume integral, equation 3. Same as in the area integral, the surface integral of the volume can be approximated by a Riemann sum over all faces, where the f i denote the i:th face of the mesh. 3 = S F(f i ) i S F dτ = F n da n f i A(f i ) (6) S F n da = F dτ (3) By choosing a vector field, F with constant divergence, that is F = c, the volume integral becomes a constant c times the olume, equation 4. This shows that the volume can be calculated using this integral, and with the divergence theorem shown in equation 3, it link the volume integral to the surface integral. F dτ = c dτ = c dτ = c (4) To calculate the constant c they chose the vector field to be (x,y,z) and the divergence will be equal to three. F = x, y, z = x x + y y + z z = 3 (5) In [1] they chose to have the centroid of the triangle to represent the vector field, but any point on the face will work. i S 3 = (v 1 + v 2 + v 3 ) fi 3 n f i A(f i ) (7) We implemented the equation 7 in the assignment to calculate the volume in the function olume. Simply by calling the function FindNeighborFace to get the 1-ring neighborhood faces. Iterate through all of them, taking the scalar product of the triangle centroid of the face and the face s normal. Multiply it by the face s area and sum them all together. When the iteration was finish we divided the sum with three before returning the volume. 2.6 Implement and visualize curvature In this assignment we copy the curvature function from the SimpleMesh to the HalfEdgeMesh. That had implemented the Gaussian curvature, equation 8 with voronoi area, see equation 13,

K = 1 A (2π j N 1 (i) When the K is positive meaning that the angles are less than 2π the surface will be non-smooth, if the value is equal to zero the surface will be a plane. And for a value less than zero the surface will be smooth. 2.7 Classify the genus of a mesh To classify the genus of a mesh we used the Euler-Poincaré formula With denoting number of vertices, E number of edges, F number of faces, L number of loops in the mesh, S number of shells and G is genus. In [1] they mention that in a mesh consist of triangles the number of loops equals number of faces, which simplify the Euler- Poincaré formula and the loop counting a lot. And with this assignment we only work with one shell And with some rearranging we ended up with this formula to calculate the genus of a mesh We simply checked the size of the vertex, face and the edge vector to get the number of faces, vertices and edges in that mesh, one thing keep in mind is that the half edge mesh has inner and outer edges, to get the right number of edges we divided the number of edges we got from the edge vector by two, then we calculated the genus of the mesh. θ j ) (8) E + F L F 2 S G = 0 (9) E + F 2 1 G = 0 (10) G = E + 2 F 2 (11) 2.8 Calculate mean curvature and do smoothing In the function ertexcurvature, we replaced the Gaussian curvature with the mean curvature 1 4A j N 1 (i) Hn = (cot α j + cot β j )(v i v j ) (12) The area A is the total area of the 1-ring neighborhood, in our case the total area were calculated using a voronoi area 1 8 j N 1 (i) A v = (cot α j + cot β j ) (v i v j ) 2 (13) We were also interested to distinguish between if the curvature is convex or concave and this maps to the positive and negative of the magnitude, since the normal has the magnitude one we will get the curvature, H by taking the magnitude of Hn, this is what we return. And to smooth the surface we simply need to move in the opposite direction of the normal times the mean curvature. To move the vertex in the opposite direction of the normal we used an explicit forward Euler integration X t+1 = X Hndt (14)

H is the curvature, X is the vertex position and n is its normal. Why we subtract the curvature instead of adding it to the vertex position is that we want a stable and smooth visualization and if we had added the curvature the sharper parts would become sharper and the smoother parts would have become smoother, now we got a more even smooth over the mesh. And if we iterate further and moving the vertices along the normals the cow will eventually become a sphere of some kind since the curvature will smooth every sharp detail on the mesh. 4 Conclusion In table 1 the area of the approximation gets closer to the numeric calculated value when the triangles size decrease which implying that the calculation is converging when the triangles size goes to zeros as the Riemann sum predicts. This can also be seen in the approximated volume. The difference in loading speed between a simple mesh with relative high triangle count and the same mesh loaded using half edge are a tremendous difference. The half edge takes a few seconds to load, and the simple mesh takes a couple of minutes to load. This is due to in the half edge data structure each vertex can reach its 1-ring neighborhood quite efficient, but the simple mesh has no information about the adjacent vertices and have to do an exhaustive search through the whole face list, comparing each vertex in the face with itself. And this has to be done for calculating normals, area and volume. Sphere radius 1.0 0.5 0.1 Figure 2: A cow with vertex shading on, with smooth estimating using mean curvature. Calculated area Approximated area 12.5108 3.1276 0.1249 12.5664 3.1416 0.1257 3 Result The half edge data structure is a powerful tool to speed up calculations and searching in a mesh. By using the Riemann sum to approximate both the total area and the volume of meshes as seen in table 1, as approximated area and volume, shows that they are close to the real area and volume, which shows that it is a good approximation. Calculated volume Approximated volume 4.1518 0.5190 0.0041 4.1888 0.5236 0.0042 Table 1, containing the approximated and numerical calculated area and volume for three different spheres The mean curvature also gave a stable smooth as seen in figure 2.

Grade Since we implemented all assignments that was required for grade 5 and I have shown that I understood the theory behind them, I deserve grade 5 for this lab assignment Refrences [1] Gunnar Johansson, Ola Nilsson and Andreas Söderström. Mesh data structures. 2009.