Mesh final pzn_geo1004_2015_f3_2017

37
1 Challenge the future Boundary Representations Polygon Mesh Models Geo1004, Geomatics Master, Directed by Dr. Ir. Sisi Zlatannova Dr. Ir. Pirouz Nourian Assistant Professor of Design Informatics

Transcript of Mesh final pzn_geo1004_2015_f3_2017

1Challenge the future

Boundary Representations

Polygon Mesh Models

Geo1004, Geomatics Master, Directed by Dr. Ir. Sisi Zlatannova

Dr. Ir. Pirouz NourianAssistant Professor of Design Informatics

2Challenge the future

General Idea

Representing Higher-Dimensional Objects with their Lower-Dimensional Boundary

e.g. representing a box only with a 6-face container; i.e. not representing the inner

volume.

3Challenge the future

What do we mean by representation

anyway?

Representing Higher-Dimensional Objects with their Lower-Dimensional Boundary

e.g. representing a box only with a 6-face container; i.e. not representing the inner

volume.

Representing a triangular surface by storing its border triangle; i.e. the triangle that

marks the boundary between what is in and out of this 2D space is itself a 1D space.

4Challenge the future

On terminology

โ€ข Geometry: Point (0D), Line(1D), Polygon(2D), Polyhedron (3D)

โ€ข Geometry: Point (0D), Curve(1D), Surface(2D), Solid (3D)

โ€ข Topology: Vertex(0D), Edge(1D), Face(2D), Body(3D)

โ€ข Graph Theory: Node, Link, (and n-Cliques)

5Challenge the future

Boundary Representations

โ€ข 0D: Point

โ€ข 1D: Curve (represented by boundary Points)

โ€ข 2D: Surface (represented by boundary Curves)

โ€ข 3D: Solid (represented by boundary Surfaces)

6Challenge the future

Boundary Representations & n-

Manifolds

โ€ข 0D: Point (the space therein everywhere resembles a 0-dimensional Euclidean Space)

โ€ข 1D: Curve (the space therein everywhere resembles a 1-dimensional Euclidean Space)

โ€ข 2D: Surface (the space therein everywhere resembles a 2-dimensional Euclidean Space)

โ€ข 3D: Solid (the space therein everywhere resembles a 3-dimensional Euclidean Space)

7Challenge the future

Boundary Representations

โ€ข 0D: Point

โ€ข 1D: Curve (represented by boundary Points)

โ€ข 2D: Surface (represented by boundary Curves)

โ€ข 3D: Solid (represented by boundary Surfaces)

โ€ข Parametric surfaces (e.g.

NURBS)

โ€ข Triangulated Irregular Networks

(TINS)

โ€ข Grid (Networks)

โ€ข Constrained Triangulation

โ€ข Subdivision Surfaces

โ€ข Polygon Meshes

8Challenge the future

Boundary Representations

โ€ข 0D: Point

โ€ข 1D: Curve (represented by boundary Points)

โ€ข 2D: Surface (represented by boundary Curves)

โ€ข 3D: Solid (represented by boundary Surfaces)

โ€ข Parametric surfaces (e.g.

NURBS)

โ€ข Triangulated Irregular Networks

(TINS)

โ€ข Grid (Networks)

โ€ข Constrained Triangulation

โ€ข Subdivision Surfaces

โ€ข Polygon Meshes

9Challenge the future

Nota Bene!

โ€ข All these objects might be โ€˜embeddedโ€™ geometrically in a 3D

space. Geometrically they are all 3D objects (3D point, 3D

curve, 3D surface, 3D solid); but their โ€˜inner spaceโ€™ has

different topological dimensionality

โ€ข The concept of manifold is adopted from differential

geometry and it is essentially about continuous space; here

we are talking about approximations of continuous objects

and generalized notions of manifold-ness.

โ€ข In this course, we are focused on 2-Manifold Boundary

Representations modelled as โ€˜polygon meshesโ€™ and NOT

polyhedral meshes.

10Challenge the future

โ€ข Example:

โ€ข Important note:

the geometry of faces is not stored; only rendered when needed!

What you see on the screen is not necessarily what you store!

Mesh RepresentationA light-weight model composed of points and a set of topological

relations among them.

Points >Vertices Lines > Edges Polygons > Faces Mesh

T1: {0,4,3}T2:{0,1,4}Q1:{1,2,5,4}

11Challenge the future

โ€ข The geometry of a Mesh can be represented by its points (known as [geometrical] vertices

in Rhino), i.e. a โ€˜listโ€™ of 3D points in โ„3

โ€ข The topology of a Mesh can be represented based on its [topological] vertices, referring

to a โ€˜setโ€™ of 3D points in โ„3, there are multiple ways to describe how these vertices are

spatially related (connected or adjacent) to one another and also to edges and faces of the

Mesh

โ€ข Same topology and different geometries:

MeshMesh Geometry versus Mesh Topology

T1: {0,4,3}T2:{0,1,4}Q1:{1,2,5,4}

T1

T2Q1

T1

T2Q1

0

3

1

45

2 0

3

1

4 5

2

12Challenge the future

Triangulated MeshesSome preliminary definitions: fan, star, strip

A triangle strip=:ABCDEF

ABC, CBD, CDE, and EDF

A

B

C

D

E

F

A Closed Triangle Fan or a โ€˜starโ€™=:ABCDEF

A

B

C

D

E

F

ABC, ACD, ADE, and AEF

A Triangle Fan=: ABCDE

AB

CD

E

ABC, ACD, and ADE

13Challenge the future

Mesh BasicsSome preliminary definitions: free* vertices, free* edges

โ€ข If an edge has less than two faces adjacent to it then it is considered free;โ€ข If a vertex is part of such an edge it is considered as free too.

* In Rhinocommon free vertices/edges are referred to as naked.

14Challenge the future

Mesh BasicsSome preliminary definitions: border denoted as ๐œน

โ€ข A 1D border is the set of connected edges incident to only one face of a 2-manifold, i.e. composed of free edges. We can conclude that:

โ€ข If every vertex has a closed fan (i.e. a star), or there is no edge of valence (number of neighbors) less than 2, the given manifold has no border. Example: a box!

non-manifold border manifold borderno [1D] border

15Challenge the future

โ€ข if a Mesh is supposed to be a 2D manifold then it should meet these criteria:

1. each edge is incident to only one or two faces; and

2. the faces incident to a vertex form a closed or an open fan.

Non manifold Mesh examples: (note why!)

Images courtesy of Dr. Ching-Kuang Shene from Michigan Technological University

Manifold MeshA 2-manifold [everywhere] locally resembles a flat surface

โ€ข if a Mesh is supposed to be orientable then, it should be possible to find

โ€˜compatibleโ€™ orientations for any two adjacent faces; in which, for each pair of

adjacent faces, the common edge of the two faces has opposite orders.

โ€ข Example: Mรถbius band is a 2D manifold Mesh that is non-printable.

16Challenge the future

Mesh Topology: HomeomorphismEuler-Poincare Characteristic: key to homeomorphism

โ€ข N-Manifold: Each point of an n-dimensional manifold has a neighborhood

that is homeomorphic to the Euclidean space of dimension n

โ€ข Riddle: The above definition implies that for mapping some local geographic features 2D maps

are fine. What about the whole globe? That is not homoeomorphic to a rectangular surface!

How do we do it then?

17Challenge the future

Image Source: http://prateekvjoshi.com/2014/11/16/homomorphism-vs homeomorphism/

Mesh Topology: Homeomorphismclay models that are all topologically equal!

Images courtesy of Dr. Ching-Kuang Shene from Michigan Technological University

Two 2-manifold Meshes A and B are homeomorphic if their surfaces can be transformed to one another by topological transformations (bending, twisting, stretching, scaling, etc.) without cutting and gluing.

18Challenge the future

Image Source: https://www.shapeways.com/blog/archives/21752-a-3d-printed-topology-joke.html

Mesh Topology: Homeomorphismclay models that are all topologically equal!

Images courtesy of Dr. Ching-Kuang Shene from Michigan Technological University

Two 2-manifold Meshes A and B are homeomorphic if their surfaces can be transformed to one another by topological transformations (bending, twisting, stretching, scaling, etc.) without cutting and gluing.

This is how!

19Challenge the future

Mesh Topology: HomeomorphismEuler-Poincare Characteristic: key to homeomorphism

Only for 2D boundary representations*

Images courtesy of Dr. Ching-Kuang Shene from Michigan Technological University

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 2 1 โˆ’ ๐‘” โˆ’ ๐›ฟ

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 2 1 โˆ’ 2 โˆ’ 0 = โˆ’2

* The Euler characteristic equation will take the form of V-E+F-B

โ€ข ๐›ฟ is the number of [connected] borders

โ€ข ๐‘” is the number of โ€œgeneraโ€ (pl. of genus) or handles

โ€ข Irrespective of tessellation!

20Challenge the future

Mesh Topology: HomeomorphismEuler-Poincare Characteristic: key to homeomorphism

โ€ข Irrespective of tessellation!

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = โˆ’2 ๐‘“๐‘œ๐‘Ÿ ๐‘‘๐‘œ๐‘ข๐‘๐‘™๐‘’ ๐‘ก๐‘œ๐‘Ÿ๐‘–(โ„Ž๐‘œ๐‘š๐‘’๐‘œ๐‘š๐‘œ๐‘Ÿ๐‘โ„Ž๐‘–๐‘ ๐‘ก๐‘œ ๐‘ ๐‘œ๐‘™๐‘–๐‘‘๐‘  ๐‘ค๐‘–๐‘กโ„Ž 2 โ„Ž๐‘œ๐‘™๐‘’๐‘ )

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 0 ๐‘“๐‘œ๐‘Ÿ ๐‘ก๐‘œ๐‘Ÿ๐‘– (โ„Ž๐‘œ๐‘š๐‘’๐‘œ๐‘š๐‘œ๐‘Ÿ๐‘โ„Ž๐‘–๐‘ ๐‘ก๐‘œ ๐‘ ๐‘œ๐‘™๐‘–๐‘‘๐‘  ๐‘ค๐‘–๐‘กโ„Ž 1 โ„Ž๐‘œ๐‘™๐‘’)

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 1 ๐‘“๐‘œ๐‘Ÿ ๐‘‘๐‘–๐‘ ๐‘˜๐‘  (โ„Ž๐‘œ๐‘š๐‘’๐‘œ๐‘š๐‘œ๐‘Ÿ๐‘โ„Ž๐‘–๐‘ ๐‘ก๐‘œ ๐‘ ๐‘ข๐‘Ÿ๐‘“๐‘Ž๐‘๐‘’๐‘ )

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 2 ๐‘“๐‘œ๐‘Ÿ ๐‘๐‘Ž๐‘™๐‘™๐‘  (โ„Ž๐‘œ๐‘š๐‘’๐‘œ๐‘š๐‘œ๐‘Ÿ๐‘โ„Ž๐‘–๐‘ ๐‘ก๐‘œ ๐‘ ๐‘œ๐‘™๐‘–๐‘‘๐‘  ๐‘ค๐‘–๐‘กโ„Ž๐‘œ๐‘ข๐‘ก โ„Ž๐‘œ๐‘™๐‘’๐‘ )

21Challenge the future

Mesh Topology: HomeomorphismEuler-Poincare Characteristic: key to homeomorphism

Images courtesy of Dr. Ching-Kuang Shene from Michigan Technological University

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 2 1 โˆ’ ๐‘” โˆ’ ๐›ฟ

โ€ข ๐›ฟ is the number of borders

โ€ข ๐‘” is the number of โ€œgeneraโ€ (pl. of genus) or holes

โ€ข Irrespective of tessellation!

๐œ’ ๐‘€ = ๐‘‰ โˆ’ ๐ธ + ๐น = 2 1 โˆ’ 2 โˆ’ 0 = โˆ’2

22Challenge the future

Poincare Dualitya pairing between k-dimensional features and dual

features of dimension n-k in โ„๐‘›

PRIMAL DUAL

0D vertex (e.g. as a point) 1D edge

1D edge (e.g. as a line segment) 0D vertex

PRIMAL DUAL

0D vertex (e.g. a point) 2D face

1D edge (e.g. a line segment) 1D edge

2D face (e.g. a triangle or a pixel) 0D vertex

PRIMAL DUAL

0D vertex (e.g. a point) 3D body

1D edge (e.g. a line segment) 2D face

2D face (e.g. a triangle or a pixel) 1D edge

3D body (e.g. a tetrahedron or a voxel) 0D vertex

โ„

โ„3

โ„2

23Challenge the future

Poincare Dualitya pairing between k-dimensional features and dual

features of dimension n-k in โ„๐‘›

PRIMAL DUAL

0D vertex (e.g. as a point) 1D edge

1D edge (e.g. as a line segment) 0D vertexโ„

A hypothetical street network: a Junction-to-Junction adjacency graph (left) versus a Street-to-Street adjacency graph (right), both โ€˜undirectedโ€™, after Batty (Batty, 2004): red dots

represent graph nodes, and blue arcs represent graph links.

Batty, M., 2004. A New Theory of Space Syntax. CASA Working Paper Series, March.

24Challenge the future

Poincare Dualitya pairing between k-dimensional features and dual

features of dimension n-k in โ„๐‘›

PRIMAL DUAL

0D vertex (e.g. a point) 2D face

1D edge (e.g. a line segment) 1D edge

2D face (e.g. a triangle or a pixel) 0D vertex

โ„2

A Voronoi tessellation of 2D space and its dual that is a Delaunay triangulation

25Challenge the future

Poincare Dualitya pairing between k-dimensional features and dual

features of dimension n-k in โ„๐‘›

PRIMAL DUAL

0D vertex (e.g. a point) 3D body

1D edge (e.g. a line segment) 2D face

2D face (e.g. a triangle or a pixel) 1D edge

3D body (e.g. a tetrahedron or a voxel) 0D vertex

โ„3

representing adjacencies between 3D cells or bodies via their dual vertices (Lee, 2001)

Lee, J., 2001. 3D Data Model for Representing Topological Relations of Urban Features. San Diego, CA, s.n.

26Challenge the future

โ€ข formally an ordered set of Vertices, Edges and Faces or ๐‘€ = (๐‘‰, ๐ธ, ๐น)

โ€ข The ordered set describes a set of vertices and a set of faces describing how the vertices construct convex polygons by the

set of edges connecting them when embedded in โ„3. (In a set there is no duplicate element. Therefore, the vertices,

edges and faces in the above definition are unique in their sets and have no duplicates.)

โ€ข Edges and faces should not intersect or self-intersect.

โ€ข Edges correspond to straight lines, faces are generators of convex and planar polygons. A Mesh represents a polyhedron if

it has planar faces without self-intersection.

โ€ข Mesh has a topological structure, in which edges are tuples of vertex indices and faces are composed of (CW/CCW

ordered) tuples of integers referring to indices of the vertices or edges

โ€ข Ensuring flatness of faces is most convenient with triangular faces. This is one of many reasons that triangular Meshes are

most common and used for rendering engines.

โ€ข Faces or edges should not be degenerate; e.g. an edge that effectively corresponds to a line of length zero, or a face

giving rise to a polygon that has zero surface area. Faces (polygons) should not be self intersecting; edges should not self-

intersect either.

Valid Mesh (often expected to be a 2โ€“Manifold Surface)

27Challenge the future

Quiz:Check Euler-Poincare Characteristic on two spherical meshes

โ€ข Question: we know that the Euler-Poincare Characteristic is independent of

tessellation; check this fact on the two spheres below; explain the discrepancy.

Hints: http://4.rhino3d.com/5/rhinocommon/ look at Mesh[class] members

๐œ’ ๐‘€ = 2๐œ’ ๐‘€ = 66!?

28Challenge the future

Mesh Topological Structure

โ€ข Mesh Topological Data Models:

Face-Vertex: e.g. ๐น0 = {๐‘‰0, ๐‘‰5, ๐‘‰4} & ๐‘‰0 โˆˆ ๐น0, ๐น1, ๐น12, ๐น15, ๐น7

Images courtesy of David Dorfman, from Wikipedia

Face-Vertex (as implemented in Rhinoceros)

29Challenge the future

Vertex-Vertex: e.g. ๐‘‰0~{๐‘‰1, ๐‘‰4, ๐‘‰3}

Face-Vertex: e.g. ๐น0 = ๐‘‰0, ๐‘‰5, ๐‘‰4 , ๐‘‰0 โˆˆ ๐น0, ๐น1, ๐น12, ๐น15, ๐น7

Winged-Edge: e.g. ๐น0 = ๐ธ4, ๐ธ8, ๐ธ9 , ๐ธ0 = ๐‘‰0, ๐‘‰1 , ๐ธ0~ ๐น1, ๐น12 , ๐ธ0~ ๐ธ9, ๐ธ23, ๐ธ10, ๐ธ20

Half-Edge: each half edge has a twin edge in opposite direction, a previous and a next

Mesh Topological Structures

Image courtesy of David Dorfman, from Wikipedia

What is explicitly stored as topology of a Mesh: E.g.

Face-Vertex (as implemented in Rhinoceros)

http://doc.cgal.org/latest/HalfedgeDS/index.html

30Challenge the future

Mesh Topological Structure

โ€ข Mesh Topological Data Models:

Face-Vertex Example:

http://4.rhino3d.com/5/rhinocommon/html/AllMembers_T_Rhino_Geometry_Collections_MeshTopologyVertexList.htm

Face-Vertex (as implemented in Rhinoceros)

Name Description

ConnectedFaces Gets all faces that are connected to a given vertex.

ConnectedTopologyVertices(Int32) Gets all topological vertices that are connected to a given vertex.

ConnectedTopologyVertices(Int32, Boolean) Gets all topological vertices that are connected to a given vertex.

The MeshTopologyVertexList type exposes the following members.

Half-Edge: Half-Edge Mesh Data Structure, example implementation by Daniel Piker: http://www.grasshopper3d.com/group/plankton

31Challenge the future

Mesh Geometry

โ€ข Polygon vs Face

โ€ข Triangulate

โ€ข Quadrangulate

32Challenge the future

Mesh Intersections

โ€ข Boolean operation on Meshes:

1. ๐ด โˆช ๐ต: Boolean Union

2. ๐ด โˆ’ ๐ต: Boolean Difference

3. ๐ด โˆฉ ๐ต: Boolean Intersection

33Challenge the future

Normal Vectors of a Mesh

โ€ข Topological Vertices versus Geometrical Points

โ€ข Joining Mesh objects: What is a Mesh box?

โ€ข Welding Meshes: how does it work?

โ€ข Face Normal versus Vertex Normal

Where do they come from and what do they represent?

34Challenge the future

How to Compute Mesh Normals?

โ€ข

00,

00 ),(vvuuv

p

u

pvun

1

( ) ( )

0

( )( )N

x i next i i next i

i

N y y z z

1

( ) ( )

0

( )( )N

z i next i i next i

i

N x x y y

1

( ) ( )

0

( )( )N

y i next i i next i

i

N z z x x

Martin Newell at Utah (remember the teapot?)

Why?

35Challenge the future

Repairing/Reconstructing Geometry

โ€ข Example: Coonsโ€™ Patch

โ€ข Code it and get bonus points!

Image courtesy of CVG Lab

36Challenge the future

Mesh Smoothing

โ€ข

for (int k = 0; k <= L - 1; k++) {List<Point3d> SmoothV = new List<Point3d>();for (int i = 0; i <= M.Vertices.Count - 1; i++) {

List<Point3d> Neighbours = Neighbors(M, i);Point3d NVertex = new Point3d(0, 0, 0);foreach (point3d neighbor in Neighbours ) {

NVertex = NVertex + neighbor;}NVertex = (1 / Ngh.Count) * NVertex;SmoothV.Add(NVertex);

}M.Vertices.Clear();M.Vertices.AddVertices(SmoothV);A = M;

}

37Challenge the future

Questions? [email protected]