18
CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

Embed Size (px)

Citation preview

Page 1: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

1

3-D Object Modeling

Page 2: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

2

There are basically two ways to model objects in 3-D

Space-partitioning (Solid modeling) Describe interior as union of solids Parametric modeling

what parameters would we use?

Boundary representations (B-reps) Describe the set of surfaces

That define the exterior surface of an object That separate object interior from exterior What kinds of surfaces?

Page 3: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

3

Most common is Boundary Representation

Advantage: surface equations are linear

Representing objects: Polyhedrons - no problem General shapes - approximation

Tessellate (subdivide) to polygon mesh

Page 4: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

4

Polygon Meshes can be used to describe a general surface

Replaces it with an approximation

Common sets of polygons Triangles

Advantage: 3 vertices determine plane Quadrilaterals

Page 5: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

5

Polygon Meshes

Page 6: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

6

Polygon Description

Geometric data Description of position and shape

Attribute data Description of surface

Color Transparency Surface reflectivity Texture

Page 7: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

7

Polygon Description

Page 8: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

8

How do you represent a polygon surface approximation?

List of vertices (in 3-D) could work Sufficient description But, polygons are joined

Shared vertices and edges

We need a more general description that Reduces redundancy Represents component polygons

Page 9: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

9

Polygon Tables

Vertex table For all polygons in composite object

Edge table Each edge listed once

Even if part of more than one polygon

Polygon-surface tablePointers or other links between tables for easy access

Page 10: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

10

Polygon Table Example

E1: V1,V3

E2: V1,V2

E3: V2,V3

E4: V1,V4

E5: V3,V4

E6: V4,V5

E7: V2,V5

E8: V1,V5

V1

V2

V3

V4

V5

E1

E2

E3

E4

E5E6

E7

E8

S1: E1, E2, E3

S2: E2, E7, E8

S3: E1, E4, E5

S4: E4, E6, E8

S5: E3, E5, E6 , E7

Page 11: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

11

Polygon surfaces can be represented by Plane Equations

Often need information on Spatial orientation of surfaces

Visible surface identification Surface rendering (e.g. shading)

Processing a 3-D object involves Equations of polygon planes Coordinate transformations (3-D)

Page 12: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

12

The Plane Equation

Must be satisfied for any point (x,y,z) in the plane.

Ax By Cz D 0

We want to solve for coefficients (A, B, C, D).

How many points define a plane?

How many unknowns are there?

Page 13: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

13

Plane Equation Solution (1)Ax By Cz D

A

Dx

B

DyC

Dz

D

D

0

1

1 1 1

2 2 2

3 3 3

1

1

1

x y z A D

x y z B D

x y z C D

Use Cramer’s Rule

Page 14: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

14

Plane Equation Solution (2)

1 2 3 2 3 1 3 1 2

1 2 3 2 3 1 3 1 2

1 2 3 2 3 1 3 1 2

1 2 3 3 2 2 3 1 1 3

3 1 2 2 1

A y z z y z z y z z

B z x x z x x z x x

C x y y x y y x y y

D x y z y z x y z y z

x y z y z

Page 15: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

15

Vector Formulation (1)

For a plane described by Ax By Cz D 0A vector normal to the plane surface is N

Vector N is also the cross product of two successive polygon edges. We go CCW around the polygon to find the “inside-to-outside” normal vector:

2 1 3 2 N V V V V

Page 16: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

16

Vector Formulation (2)

The normal vector:

Ax By Cz D 0Gives us values for A, B, and C in the plane equation:

2 1 3 2 ( , , )A B C N V V V V

NBut what about D?

D specifies which one of the planes normal to N we are talking about.Calculate D by substituting A, B, C, and one polygon vertex into plane equation.

Page 17: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

17

Vector Formulation (3)

Ax By Cz D 0Solving for D in the plane equation:

N

Ax By Cz D

A x

B y D

C z

D

N P

P

Page 18: CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling

CS-321Dr. Mark L. Hornick

18

Testing Points

Ax By Cz D 0If point is “inside” the plane, then:

N

Ax By Cz D 0

Pinside

Poutside

If point is “outside” the plane, then:

This can be used to determine what surfaces are hidden