Title: Part IV Geometric and Solid Modeling
1Part IV Geometric and Solid Modeling
2Modeling through Polygon Mesh
- Computer graphics modeling rendering
animation - A model is a computer representation of an
object. Models may include molecules, human
fingers, jet fighters, mountains, etc. - Rendering is the process of creating an
image/picture from a model. - The most popular modeling technique in CG is
polygon mesh where a surface is approximated by a
mesh of polygons. - The simplest polygon is a triangle. Then,
triangular mesh.
3Triangular Mesh Representation I
- Each triangle is represented by 3 points.
- Problems
- storage waste
- no information on connectedness among polygons
- etc.
T1 ( (x1, y1, z1) (x2, y2, z2) (x4, y4, z4)
) T2 ( (x2, y2, z2) (x3, y3, z3) (x4, y4,
z4) )
4Triangular Mesh Representation II
- A triangle is represented by 3 vertex indices.
- A vertex is stored only once.
- Vertex coordinates can be easily changed.
V1 (x1, y1, z1) V2 (x2, y2, z2) V3 (x3, y3,
z3) V4 (x4, y4, z4) T1 (V1, V2, V4) T2 (V2,
V3, V4)
5Triangular Mesh Representation II -File Format
? Vertex Vertex
keyword integer coordinates of vertex
(floating point) ? Face Face
keyword integer vertex id of a
triangle ? Starting with are comments.
Vertex 331 0.370581
0.208696 0.190467 Vertex 335 0.36654
0.197382 0.118951 Vertex 338 0.353952
0.220184 0.144893 Vertex 343 0.420128
0.177147 0.132059 Vertex 348 0.382545
0.183089 0.185215
Face 12 335 351 296 Face 17 3824
3864 4009 Face 28 1507 1506 1578 Face 161
296 257 45 Face 171 335 296 246
6Triangular Mesh Representation II -Data Structure
- Extremely simplified versions of vertex/triangle
structures. - Linked list implementation?
- How about large-enough static array?
- How about dynamic array?
- Think about that!!
- struct Vertex
- unsigned short v_no
- double x
- double y
- double z
- / double normal3 /
- Vertex link
- struct Face
- / unsigned short f_no /
- Vertex v1
- Vertex v2
- Vertex v3
- / double normal3 /
- Face link
7Triangular Mesh Representation III
- How to construct a mesh data structure depends on
applications. - For example, for this class, only vertices and
faces would be needed to be explicitly defined.
However, some other applications would need
explicit data structures for edges. - We can represent a triangle by edge indices which
are again represented by vertex indices.
V4
E1 (V1, V4) E2 (V1, V2) E3 (V2, V4) E4
(V2, V3) E5 (V3, V4) T1 (E1, E2, E3) T2
(E3, E4, E5)
E1
E5
V1 (x1, y1, z1) V2 (x2, y2, z2) V3 (x3, y3,
z3) V4 (x4, y4, z4))
E3
V1
T2
V3
T1
E4
E2
V2
8Geometric Transformation of a Mesh
- Mesh transformation
- Apply transformations to every vertex. Then,
geometry is transformed. - However, the topology(connectivities) is not
changed. - In the example,
- Mesh A is displayed by drawing all of its edges
(wireframe display). - As all vertices are rotated, scaled up and
translated to make B, and then
wireframe-displayed.
B
A
9Mesh Generation - Mathematical Procedure
- A lot of ways to generate a polygon mesh
- mathematical procedure
- 3D scanner
- etc.
- Mathematical procedure
- As an example, lets make a sphere of radius 1 by
recursive subdivision. - Consider the following coarse triangular mesh
(diamond) for a sphere where the center is at
origin and all 6 points are of distance 1 from
the center.
10Mesh Generation - Mathematical Procedure (contd)
- Subdivide each triangle into 4 sub-triangles.
- The newly generated points are not of distance 1
from the origin. - So, elevate the points so that they are of
distance 1 from the origin.
y
(0,1,0)
(0,1/ 2,1/ 2)
(1/ 2,1/ 2,0)
(1,0,0)
x
z
(1/ 2,0,1/ 2)
(0,0,1)
11Mesh Generation - Mathematical Procedure (contd)
- When we recursively do the subdivision for all
triangles, we come closer to a sphere. Below is
an example of Level Of Detail (LOD). - Do recursive subdivision to all polygons.
Otherwise, we have cracks. - We can make meshes for other objects in a similar
way. - The algorithm is limited to simple objects such
as quadric surfaces, but the concept has been
extended to subdivision surfaces.
quadrilateral mesh for a donut
12Mesh Generation - 3D Scanner
- Use a laser ranger (or CCD video camera) and a
motorized turntable. - Its output is a set of discrete contours, which
is to be converted into a mesh by a skinning
algorithm. - The skinning algorithm produces a mesh which is
often unnecessarily detailed for many parts of
the surface. So, mesh simplification is usually
needed to reduce the number of polygons. -
- The 3D scanning suffers from concave objects.
13What Else?
- There exist more ways to construct a polygon
mesh. - Interactively construct an object, e.g. using 3D
Studio Max, which is then automatically converted
into a mesh. - There are good algorithms for constructing a mesh
from CT data. - Use digital elevation model (DEM) for terrain.
- etc.
- Polygon meshes are by far the most popular in CG.
However, there are many other modeling techniques
in Computer-Aided Design (CAD) and Computer-Aided
Geometric Design (CAGD). - Boundary Representation, which is a
generalization of meshes - Constructive Solid Geometry (CSG)
- space subdivision such as Octree
- free-form surfaces
- etc.
14CSG Primitives and Boolean Operations
- CSG is built upon primitives such as box and
cylinder. - Primitives are defined by dimensional parameters
with default positions and orientations. - Three Boolean operations union, intersection,
and subtraction
4
3
4
2.5
5
6
box(x4,y3,z5)
cylinder(r1.5,h4)
box(x2.5,y4,z6)
15CSG Tree
16Quadtree
- Divide the 2D region into quadrants, and color
each quadrant. - Gray areas are recursively subdivided.
- Subdivision continues until all quadrants are
homogeneous (either full or white) or until a
pre-determined cutoff depth is reached.
1
2
full - Black partially full - Gray empty -
White
4
3
17Octree
- Octree is a 3D extension of Quadtree.
- The 3D region is divided into octants.
- Quadtree and octree are pretty useful for spatial
directory, etc.
W
B
B
W
G
B
B
W
W
B
B
W
W
B
B
W
18Free-form Surfaces
- Curved quadrilaterals (often called bi-cubic
parametric patches) such as Bézier surfaces,
NURBS, etc. - The shape and curvature of the surface can be
changed by editing its control points. So,
powerful interactivity!! - Hard to directly render the free-form surfaces.
So, usually converted into a mesh and then
rendered.