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

3D Object Representation

1

3D Object Representation

2

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

3

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.

4

Two methods for storing standard
graphics objects

 Method 1: use table (vertex, edge, polygon,
attribute)

5

 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

6

3-D scanner

3D data obtained by triangulation

3D scanner is available in CityU Library:

http://www.cityu.edu.hk/lib/about/facility/3d/index.htm

http://www.cityu.edu.hk/lib/about/facility/3d/index.htm

7

Glut functions

 glutWire as wireframe
 glutSolid as fill area polygon patches

glutSolidCube (edgelength);

 Tetrahedron, Cube, Octahedron,
Dodecahedron, Icosahedron

8

9

Mathematical Concepts for Plane

 Plane

 Only 3 parameters define the plane, the fourth
can be set to 1 or 0

 d = 1 does not pass through (0, 0, 0)
 d = 0 pass through (0, 0, 0)

0=+++ dcZbYaX

10

Normal

 Important concept in lighting and shading

 Normal vector
 vector ┴ to the plane
 “Unit vector” – L2 norm is 1.

 Solving for Normal
 Normal n = (a, b, c)

 Select 3 vertices on the plane V1, V2, V3
)13()12( VVVV −×−=n

11

Distinguishing “Inside” from “Outside”

 Useful for “collision detection”

 Use (a, b, c)
aX+bY+cZ+d > 0 Outside

= 0 On the plane
< 0 Inside  Use V1, V2, V3 V1, V2, V3 selected CCW => Outside

CW => Inside

12

Inside-Outside Test
 To determine whether a pixel p is inside or outside an

object S
 Send a ray p + t v which starts at the pixel, t is a scalar,

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

13

p

Point q is inside as the
number of intersections (= 3)
is odd

q

Point p is outside as the
number of intersections (= 2)
is even

The yellow object is depicted as a 2D object but the
technique can be applied to any n-dimensional object (n > 2)

14

Superquadrics

 2D QUADRICS (conic section)

 3D QUADRICS

0222 =+++++++++ kiZhYgXfYZeXZdXYcZbYaX

022 =+++++ feYdXcXYbYaX

15

In 2D,

 Circle

 Ellipse

 Parabola

 Hyperbola

222 rYX =+

1
22

=



+



b
Y

a
X

222 rYX =−

aXY 42 =

16

In 3D

 Sphere

 Ellipsoid

 Paraboloid ?

 Hyperboloid ?
(ans. to be discussed in tut.)

2222 rZYX =++

1
222

=



+



+



c
Z

b
Y

a
X

17

“Super”-quadrics

 Introduce to additional parameters s1 and s2
 Allow continuous transformation from “circle” to

“square” (Idiom)
 Example (2D) “Super-ellipse”

1
22

=



+



 ss

b
Y

a
X

18

19

Super-ellipsoid

1
1

1
2

22
222

=





+









+




 s

z

s
s

s

y

s

x r
Z

r
Y

r
X

20

21

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

22

Parametric form of the super-ellipsoid

1
1

1
2

22
222

=





+









+




 s

z

s
s

s

y

s

x r
Z

r
Y

r
X

Non-parametric

θφ 21 coscos ssxrX =

θφ 21 sincos ssyrY =

φ1sin szrZ =

Parametric

23

OpenGL functions

 Does not have superquadrics function
 Can display sphere, cone, cylinder
 Quadrilateral mesh

glutWireSphere (r, nLongitudes, nLatitudes)

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

26

β
(f1(α,β), f2(α,β), f3(α,β)) (f4(α), f5(α), f6(α))

axis

cross section

primordial shape

real life example

axis is perpendicular to
cross section

quadrilateral mesh parameterized by α and β

Generalized Reflectional Symmetry

27

a(f1(α), f2(α), f3(α))

b(f4(α), f5(α), f6(α))

axis

Reflect a about b to get a’

a’
primordial shape

real life example

quadrilateral mesh parameterized by α and
β, with β varying linearly from a to a’

28

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

3D Object Representation
Intended Learning Outcomes
Standard Graphics Object
Two methods for storing standard graphics objects
Slide Number 5
3-D scanner
Glut functions
Slide Number 8
Mathematical Concepts for Plane
Normal
Distinguishing “Inside” from “Outside”
Inside-Outside Test
Slide Number 13
Superquadrics
In 2D,
In 3D
“Super”-quadrics
Slide Number 18
Super-ellipsoid
Slide Number 20
Non-parametric and Parametric forms
Parametric form of the super-ellipsoid
OpenGL functions
Slide Number 24
Generation of complicated shapes
Generalized Cylinder
Generalized Reflectional Symmetry
References