CS计算机代考程序代写 3D Object Representation

3D Object Representation
1

Intended Learning Outcomes
 Understand the concept of standard graphics object
 Able to mathematically manipulate and program in OpenGL two types of planar representation: tables and mesh
 Distinguish the concepts of parametric and non- parametric equations and understand the advantage of using the former in computer graphics
 Able to mathematically manipulate and program in OpenGL quadrics and super-quadrics
2

Standard Graphics Object
 standard graphics object = a set of (planar) polygons
 Complicated objects can be described by using many polygons
 Dedicated hardware are designed to speed up rendering of standard graphics objects.
3

Two methods for storing standard graphics objects
 Method 1: use table (vertex, edge, polygon, attribute)
4

 Method 2: Quadrilateral Mesh
 A n x m array of vertex positions (X, Y, Z)
 Represent a surface of (n-1) x (m-1) quadrilaterals
 Each quadrilateral may be further subdivided into two triangles
 Two ways to obtain data in the mesh  Way 1: By specifying an equation
 Way 2: By 3D digitizer
5

3-D scanner
3D scanner is available in CityU Library:
http://www.cityu.edu.hk/lib/about/facility/3d/index.htm
3D data obtained by triangulation
6

Glut functions
 glutWire as wireframe
 glutSolid as fill area polygon patches
glutSolidCube (edgelength);
 Tetrahedron, Cube, Octahedron, Dodecahedron, Icosahedron
7

8

Mathematical Concepts for Plane
 Plane
aX + bY + cZ + d = 0
 Only 3 parameters define the plane, the fourth can be set to 1 or 0
 d=1 doesnotpassthrough(0,0,0)
 d=0 passthrough(0,0,0)
9

Normal
 Important concept in lighting and shading
 Normal vector
 vector ┴ to the plane
 “Unit vector” – L2 norm is 1.
 Solving for Normal  Normaln=(a,b,c)
 Select 3 vertices on the plane V1, V2, V3 n = (V 2 − V 1) × (V 3 − V 1)
10

Distinguishing “Inside” from “Outside”
 Useful for “collision detection”  Use (a, b, c)
aX+bY+cZ+d > 0 = 0
< 0 Outside On the plane Inside  Use V1, V2, V3 V1, V2, V3 selected CCW => Outside
CW => Inside
11

Inside-Outside Test
 To determine whether a pixel p is inside or outside an object S
 Sendarayp+tv whichstartsatthepixel,tisascalar, v is an arbitrary direction vector
 Find all non-degenerate† intersections between the ray and S
 If the number of intersections is odd (even), p is inside (outside) S
 It is not easy to check non-degenerate intersections. One can solve this problem by sending out 𝑛𝑛 rays in random directions and then use majority voting
† a degenerate intersection is one which the ray grazes the
surface
12

Point q is inside as the number of intersections (= 3)
is odd
Point p is outside as the number of intersections (= 2)
is even
p
q
The yellow object is depicted as a 2D object but the technique can be applied to any n-dimensional object (n > 2)
13

Superquadrics
 2D QUADRICS (conic section)
aX 2 + bY 2 + cXY + dX + eY + f = 0
 3D QUADRICS
aX2 +bY2 +cZ2 +dXY+eXZ+fYZ+gX+hY+iZ+k=0
14

In 2D,
 Circle
 Ellipse
 Parabola  Hyperbola
X2 +Y2 =r2  X 2 Y 2
 a  +  b  = 1
Y2 =4aX X2 −Y2 =r2
15

In 3D
 Sphere
 Ellipsoid
 Paraboloid ?
X2 +Y2 +Z2 =r2  X 2  Y 2  Z 2
a +b +c =1
 Hyperboloid ?
(ans. to be discussed in tut.)
16

“Super”-quadrics
 Introduce to additional parameters s1 and s2
 Allow continuous transformation from “circle” to “square” (Idiom)
 Example (2D) “Super-ellipse”  X 2 Y 2
as +bs =1 
17

18

Super-ellipsoid
2 2s2s 2 X s2 Y s2 1 Z s1
r +r  +r =1 x y z
19

20

Non-parametric and Parametric forms
 Non-parametric form Z=f(X,Y) or f(X,Y,Z)=0  Used in mathematics
 Parametric form
 Introduced two additional parameters u, v  X = f1 (u, v) Y = f2 (u, v) Z = f3 (u, v)  Used in CG
21

Parametric form of the super-ellipsoid
X2s2 Y2s2 s2s1 Z2s1
 r  +r   +r  =1 Non-parametric x y z
X =rx coss1 φcoss2 θ Y =ry coss1 φsins2 θ
Z = rz sins1 φ
Parametric
22

OpenGL functions
 Does not have superquadrics function  Can display sphere, cone, cylinder
 Quadrilateral mesh
glutWireSphere (r, nLongitudes, nLatitudes)
23

24

Generation of complicated shapes
 Complicated shapes can be generated using quadrilateral mesh and parametric form
 Two examples are
 Generalized Cylinder
 Generalized Symmetry
25

Generalized Cylinder
real life example
axis (f4(α), f5(α), f6(α))
cross section
axis is perpendicular to cross section
quadrilateral mesh parameterized by α and β
primordial shape
(f1(α,β), f2(α,β), f3(α,β)) β
26

Generalized Reflectional Symmetry
real life example
axis b(f4(α), f5(α), f6(α))
a’
a(f1(α), f2(α), f3(α)) Reflect a about b to get a’
quadrilateral mesh parameterized by α and β, with β varying linearly from a to a’
27
primordial shape

References
Ex: Practice using the index
For example, text
 OpenGL Line Functions Sec. 4-4  Superquadrics: Sec. 13.4-13.5
 Parametric and non-parametric forms: A-8, A- 9
28