This action might not be possible to undo. Are you sure you want to continue?

P. J. Narayanan Spring 2005

CS3500

1

Representations of Primitives

• How do we represent different curves and surfaces for graphics? • An issue for graphics programmers, not for the graphics system. • Considerations: Representational Efﬁciency, Ease of Manipulation, Rendering Speed/Efﬁciency, Ease of Processing

CS3500

March 17, 2005

2

**What can Graphics Ultimately Draw?
**

• 0-D objects: points. • 1-D objects: Fundamentally a line, deﬁned by two end points. • 2-D objects: A planar polygon. Triangle is the simplest. • 3-D objects: Solid rendering! • Everything else is broken up into the above.

CS3500 March 17, 2005

3

Points

• Most fundamental entity. Other primitives ultimately use points and their interconnections. • Represented using point coordinates: 2 numbers for 2D and 3 numbers for 3D. • Ideally real (ﬂoating point) numbers are used. • Give the coordinates in the object or world space and not in window or framebuffer space.

CS3500 March 17, 2005

4

**Curves and Surfaces
**

• Representation could use equations of different kinds. • Ellipse in 2D: ax2 +by 2 = 1; Sphere in 3D: x2 +y 2 +z 2 = r2. • We can draw only lines or polygons. The curve or surface has to be approximated using them before drawing. • A priori approximation: Represent a sphere using 100 triangular patches. • Not good if the curve/surface may be viewed at different resolutions. Approximation to be done while rendering. • Representation is compact; rendering is expensive.

CS3500 March 17, 2005

5

**Piecewise Linear Curves
**

• Example: Lines, Polygons. • Representation using lines is exact. • Line segments are represented using endpoints. • Line, Line Strip, Line Loop, Pencils of lines. • Represented using a sequence of end points. • Each point has 2 or 3 coordinates.

CS3500 March 17, 2005

6

**Vertex List and Vertex Index
**

• Repeating the point coordinates is wasteful if a point is used for multiple lines. • Describe vertices as a Vertex List at start, which is a table of all vertices in the object. • The index of a vertex in the table is used in place of its coordinates when describing lines and line loops. • Reduces the representational complexity or size if vertices are involved in many lines.

CS3500 March 17, 2005

7

1 2 3

x1, y1, z1 x2, y2, z2 x3, y3, z3

L1: 1, 2, 4, 5, 6, 2 L2: 1, 3, 4

n

xn, yn, zn

Lm: 1, 5, 8, 31, 4, 21, 22

• Since the reuse of the points is explicit, points after modelling, viewing, and projection can be remembered. • Disadvantage: One level of table lookup is required.

CS3500

March 17, 2005

8

End of Class 27

CS3500

March 17, 2005

9

**Piecewise Polygonal Surfaces
**

• Polygon representation is exact for polyhedral objects. • A polygon mesh represents them as a collection of independent polygons. • Explicit Representation: list a polygon as a sequence of points. Pi = {(x1, y1, z1), (x2, y2, z2), · · · , (xk, yk, zk)}. • An easy representation. Shared vertices are described multiple times.

CS3500 March 21, 2005

10

Properties of Representations

• What do we want from representations? • Drawing the polygon quickly/easily is most important. • Reduced representational complexity or size. • The following questions should be answered easily: Which vertices deﬁne a given edge? Which edges meet on a vertex? Which edges do 2 polygons share? Etc. • Explicit representation is good for drawing. Not good to answer these questions.

CS3500 March 21, 2005

11

**Vertex List Representation
**

• List vertices as a Vertex List ﬁrst. Use indices into the list to represent vertices. V = {(x1, y1, z1), (x2 , y2, z2), · · · , (xn, yn, zn)} P1 = (1, 3, 5), P2 = (2, 4, 7, 8, 3), . . . • Reduced size as shared vertices are described only once. • Additional look-up time while processing. • Can write a program to determine how many edges are incident on a vertex by comparing indices. • Not easy to ﬁnd edges shared between polygons.

CS3500 March 21, 2005

12

**Edge List Representation
**

• List edges as an Edge List, with explicit polygon incidence, in addition to the vertex list. • Polygons described in terms of indices of edges in order. E1 = (1, 2, P1, P2), E2 = (4, 8, P3, P2), E3 = · · · , . . . P1 = (1, 3, 6, 7), P2 = (4, 6, 8, 12, 1), P3 = · · · , . . . • Easy to ﬁnd edges shared between polygons, polygons that use an edge, etc. • Some are immediately available; some need searching.

CS3500 March 21, 2005

13

Planes of Polygons

• The plane normal of polygons may be needed. • Plane equation: nTp = 0, with homogeneous vectors. • Cross-product of 2 non-parallel sides gives 3 components of n. Fourth obtained by substituting a point. • For an N -sided polygons, the area of projection onto each plane can also give the ﬁrst 3 components. • nTp is a measure of the distance from p to the plane. • An enumeration of N points in 3D may not be planar!

CS3500 March 21, 2005

14

Example

Different representations: size, complexity.

CS3500

March 21, 2005

15

Representation of Curves

• Explicit: y = f (x), z = f (x). Problems: Multiple y-values difﬁcult, rotation changes representation, slope of ∞ hard to represent. • Implicit: f (x, y, z) = 0. How do we represent segments? Tangents? • Parametric: x = x(t), y = y(t), z = z(t). Additional parameter introduced makes everything easy. Tangent: x (t), y (t), z (t)

CS3500 March 21, 2005

16

**Parametric Representation of Lines
**

• P = P1 + t (P2 − P1) = (1 − t) P1 + t P2. • 0 ≤ t ≤ 1 for line segment; any t for the whole line. • Represents 3 equations, one each in x, y, and z. • Get a 1-D structure with a 1-parameter family.

CS3500

March 21, 2005

17

**Degree of the Parametric Curve
**

• Can be linear, quadratic, cubic, or a general polynomial in the parameter t. • Curve gets richer if higher degree polynomial is used. • Linear: Too restrictive; only lines. • Quadratic: Only planar curves even in 3D. • Cubic: Non-planar curves with good control. • Higher: Richer, but too many wiggles. Hard to control.

CS3500

March 21, 2005

18

**Parametric Cubic Curves
**

ax bx 3 2 • Q(t) = [x(t) y(t) z(t)] = [t t t 1] cx dx ay by cy dy az bz =TC cz dz

• Parametric tangent vectors by differentiating: Q (t) = [3t2 2t 1 0] C • Required curves may be split into multiple parametric cubic segments that join together.

CS3500 March 21, 2005

19

**Geometric & Parametric Continuity
**

• What happens at the join of two curve segments? • If the curves meet, they have G0 geometric continuity. If their tangent vectors are parallel G1 continuity. If nth derivatives are parallel, Gn continuity. • If tangent vectors are equal, parametric continuity C 1. If nth derivatives are equal, C n continuity. • G1 is sufﬁcient for the “smooth” or “continuous” look. • Usually, parametric continuity implies geometric continuity.

CS3500 March 21, 2005

20

Example

G2 G1 G0

Curve is pulled more when the tangent magnitude increases.

CS3500

March 21, 2005

21

**Parametric Cubic Curves: Summary
**

ax bx 3 2 • Q(t) = [x(t) y(t) z(t)] = [t t t 1] cx dx ay by cy dy az bz =TC cz dz

• Parametric tangent vectors by differentiating: Q (t) = [3t2 2t 1 0] C • Required curves may be split into multiple parametric cubic segments that join together. • If nth derivatives are parallel, Gn continuity. • If nth derivatives are equal, C n continuity.

CS3500 March 04, 2004

22

Geometry Vector

• Cubic curves have 4 unknowns. Need four constraints from the geometry to solve for them. • Could be 4 points, or 2 points and 2 tangents, etc. • The column vector consisting of these constraints (each is a vector), is called the Geometry Vector G = [G1 G2 G3 G4]T. • We can write C in terms of the Geometry Vector.

CS3500 March 04, 2004

23

Basis Matrix

m11 m21 • Write C = M · G = m31 m41 m12 m22 m32 m42 m13 m23 m33 m43 m14 m24 G m34 m44

**• M is called the Basis Matrix. G1 GT 2 GT 3 GT 4
**

T

• B = T M = [T·m1 T·m2 T·m3

T·m4]

CS3500

March 04, 2004

24

Blending Functions

• Q(t) = T M G = B G. • B gives the blending functions using which the end points are interpolated to get the curve. • (1 − t) and t were the blending functions for parametric lines. • Different families of parametric curves differ in the geometry vector and the basis matrix.

CS3500 March 04, 2004

25

End of Class 28

2

CS3500

March 04, 2004

26

Hermite Curves

• Geometry Vector: 2 end points P1, P4 and 2 end tangents R1, R4, written as GH = [P1 P4 R1 R4]T • Hermite Cubic Curves are characterized by the special type of Geometry Vector. That deﬁnes the Basis Matrix of the special kind also. • Q(t) = T · MH · GH • But, P1 = Q(0), P4 = Q(1), R1 = Q (0), R4 = Q (1).

CS3500 March 04, 2004

27

0 1 • Therefore, GH = 0 3 0 1 • Giving, MH = 0 3 0 1 0 2

0 1 0 2 0 1 1 1

0 1 1 1 1 1 0 0

1 1 MH GH 0 0 −1 2 −2 1 1 −3 3 −2 −1 = 0 1 0 0 1 0 0 0

• Blending functions for P1, P4, R1, R4 respectively are: (2t3 − 3t2 + 1), (−2t3 + 3t2), (t3 − 2t2 + t) and (t3 − t2). • Only one of them is non-zero at both end points.

CS3500 March 04, 2004

28

**Hermite Curve: Properties
**

• Only one of them is non-zero at both end points. • Easy continuity conditions. • C0, G0: P4 is common between 2 segments. • G : = consecutive segments. • k = 1 for C1 continuity.

1

1

P1

P4

i−1 R4

kRi , 1

for

R1 R4 1

CS3500

March 04, 2004

29

´ Bezier Curves

• Geometry Vector has 4 points: GB = [P1 P2 P3 P4]T. • P1 and P4 are the end points. Others give tangents: R1 = Q (0) = 3(P2 − P1), R4 = Q (1) = 3(P4 − P3). 1 0 • GH = −3 0

CS3500

0 0 0 0 3 0 0 −3

0 1 GB = MHB · GB 0 3

March 04, 2004

30

• Thus, MB = MH · MHB

−1 3 −3 1 3 −6 3 0 = 0 0 −3 3 1 0 0 0

´ • Bezier blending functions are: (1 − t)3, 3t(1 − t)2, 3t2(1 − t), t3 • They are called Bernstein Polynomials, add up to 1 at every point, are positive everywhere, are terms of binomial expansion of (t + (1 − t))3

CS3500

March 04, 2004

31

**´ Bezier Curves: Properties
**

• Curve lies inside the convexhull of the control points. • C0, G0 continuity when P4 is the ﬁrst point of the next segment. • G continuity when (P3 − P4) = k(P5 − P4). • C1 continuity when k = 1.

1

1

P1 P2

P4

P3 1

CS3500

March 04, 2004

32

**Drawing Cubic Curves
**

• Draw them as line segments. Start with t = 0, increment t by δ in each step and evaluate the curve point Q(t). • Use Horner’s rule: ((at + b)t + c)t + d. multiplications and additions per point? How many

• 11m + 10a for conventional method and 9m + 10a using Horner’s rule per 3D point. • Draw the line segment between curve points Q(t = iδ) and Q(t = (i + 1)δ) till t = 1. • Step size δ should be a function of the “zoom factor” or how large the curve appears.

CS3500 March 04, 2004

33

**Parametric Bicubic Surfaces
**

• Surfaces are 2D entities. Need 2 parameters s and t, one in each dimension. • Q(s, t) = S · M· [G1(t) G2(t) G3(t) G4(t)]T Gi(t) = T · M · G i, i = 1, 2, 3, 4 Gi is a Geometry Vector of the curve i. • Each value of t deﬁnes a curve; a family of such curves with varying s deﬁnes the surface.

CS3500 March 04, 2004

34

g11 g12 g13 g14 g21 g22 g23 g24 • Combining, we get S · M · · MT · T T g31 g32 g33 g34 g41 g42 g43 g44 where, gij are the boundary points, each with x, y, z coordinates. • x(s, t) = S M Gx MT TT, y(s, t) = S M Gy MT TT, etc. • 16 boundary conditions needed to deﬁne the parametric bicubic surface. • C0, G0, C1, G1 continuities can be deﬁned similarly.

CS3500 March 04, 2004

35

Hermite Surfaces

• Q(s, t) = S · MH · GH(t) = S · MH · GH · MT · TT H • GH(t) = [P1(t) P4(t) R1(t) R4(t)]T • GH in turn consists of points and tangents. x(0, 0) x(0, 1) xt(0, 0) xt(0, 1) x(1, 0) x(1, 1) xt(1, 0) xt(1, 1) G Hx = xs(0, 0) xs(0, 1) xst(0, 0) xst(0, 1) xs(1, 0) xs(1, 1) xst(1, 0) xst(1, 1) where xt =

∂x ∂t ,

xs =

∂x ∂s ,

xst =

∂ 2x ∂s∂t

CS3500

March 04, 2004

36

´ Bezier Surfaces

• Q(s, t) = S · MB · GB(t) = S · MB · GB · MT · TT B • GH(t) = [P1(t) P2(t) P3(t) P4(t)]T. ´ • GB consists of 16 points deﬁning the Bezier surface. • Convex-hull property holds. The surface is bound by the 16 control points.

CS3500

March 04, 2004

37

Surface Normals

• Partial derivatives deﬁne tangents.

∂ Q(s,t) ∂s ∂ Q(s,t) ∂t

= [3s2 2s 1 0] · M · G · MT · TT = S · M · G · MT · [3t2 2t 1 0]T

**• These are 3-vectors, with independent x, y, z components. • Surface normal is given by their cross product. n(s, t) =
**

∂ Q(s,t) ∂s (s,t) × ∂ Q∂t

CS3500

March 04, 2004

38

**Displaying Bicubic Surfaces
**

• Draw them as curves with ﬁxed s, varying t and vice versa. • Draw them as quads looping over s and t. triangles. Or as 2

**• Deﬁne suitable step sizes in s and t based on the display resolution. • Draw quads with vertices Q(s, t), Q(s + δs, t), Q(s + δs, t + δt), Q(s, t + δt)
**

CS3500 March 04, 2004

39

**Cubic Curves: Summary
**

• Q(t) = T · M · G, G consists of 4 boundary conditions. • Hermite curves: 2 end points and 2 end tangents. ´ • Bezier curves: 2 tangents. 2 −2 −3 3 • MH = 0 0 1 0

CS3500

end points and 2 other points for end

1 1 −1 3 −3 1 −2 −1 3 −6 3 0 , MB = 1 0 0 0 −3 3 0 0 1 0 0 0

March 09, 2004

40

**Bicubic Surfaces: Summary
**

• Each value of t deﬁnes a curve; a family of such curves with varying s deﬁnes the surface. And vice versa too. g11 g12 g13 g14 g21 g22 g23 g24 • Q(s, t) = S · M · · MT · T T g31 g32 g33 g34 g41 g42 g43 g44 gij give the 16 necessary boundary conditions, in terms of x, y, z coordinates. • C0, G0, C1, G1 continuities can be deﬁned easily.

CS3500 March 09, 2004

41

End of Class 29

CS3500

March 09, 2004

42

Solid Objects

• Most objects are solid, though we see only their outer surface. • For Graphics, only the appearance is important. Hence, the representation of the surface is sufﬁcient. • We need to know they are solid for many applications. • Solid modelling is an important area in manufacturing, engineering, etc. • A number of ways to model and represent solids exist.

CS3500 March 09, 2004

43

**Modelling and Representing Solids
**

• Parameterized Primitive Instancing: Deﬁne objects of interest as primitives. Instance them with size, shape, material parameter values for different objects. Nut/bolts, Rivets, Wheels, etc. • Sweep Representations: Translational sweep (extrusion), rotational sweep, and arbitrary sweep. • Boundary Representations: Describe objects in terms of its surface boundaries: faces, edges, vertices. Polyhedral and Nonpolyhedral b-reps.

CS3500 March 09, 2004

44

• Spatial Partitioning Reps: Divide space into cells and describe objects in terms of the cells they occupy! • Constructive Solid Geometry: Combine elementary primitives using regularized Boolean operators. Rich algebra for forming objects exist.

CS3500

March 09, 2004

45

Volume Cells

• Rectangular volume cells or voxels are common for representation. • A voxel is either part of the object or not; partial occupancy is difﬁcult. • Voxel size is critical. represenatation. Smaller the voxels, better the

**• An O(n3) structure! Memory/storage requirements are huge. Time complexity even more serious!
**

CS3500 March 09, 2004

46

Octrees

• A top-down, divide-and-conquer representation of solid objects. • Divide the object recursively using 3 orthogonal planes into 8 octants if it is not homogeneous. • Octants named using: Up/Down, Left/Right, Front/Back. • Number of nodes in the octree is proportional to the objects surface area mostly.

CS3500 March 09, 2004

47

**• Algorithms to manipulate and reason about objects using octree representation are available.
**

Y

2 6 6

4 5 6 6 2 7 7

3

3 7 5 3 1

3

1 4 5 5

X

Z

**• Why call it a tree?
**

CS3500 March 09, 2004

48

End of Class 30

CS3500

March 09, 2004

- 2D transforms
- ComputerGraphics_VisibleSurfaceDetermination
- ComputerGraphics_ProjectiveGeometry
- ComputerGraphics_Lighting_N_Shading
- ComputerGraphics_History_N_2D
- ComputerGraphics_Colours
- ComputerGraphics_3D_Part2
- ComputerGraphics_3D_Part1
- ComputerGraphics_2D
- Fundamentals of Image Processing
- An Introduction to Digital Image Processing
- Computer Vision - A Modern Approach by Forsythe Ponce
- Vehicle Detection_General Information
- Vehicle Detection in Monochrome Images
- Vehicle Detection Combining Gradient Analysis and AdaBoost Classification
- Vehicle Detection and Tracking_Rajagopalan
- Robust Real-Time Object Detection
- Road Vehicle Recognition in Monocular Images
- Real-Time Vehicle Detection Using Classified Background Learning
- Real-Time on-Road Vehicle Detection With Optical Flows and Haar-Like Feature Detector
- Real-Time Object Detection for Smart Vehicles
- Real-Time Depth Estimation and Obstacle Detection From Monocular Video
- Rapid Object Detection Using Boosted Cascade of Simple Features
- OpenCV Object Detection HowTo

- 2D transforms
- ComputerGraphics_VisibleSurfaceDetermination
- Computer Vision - A Modern Approach by Forsythe Ponce
- An Introduction to Digital Image Processing
- Estimating Curvature on Triangular Meshes
- Creating Shaded Areas in r
- XOR Realization Using KH-Map
- practice-midterm-sol
- EvoluteToolsForRhino2.1
- 3d Mesh Segmentation Using Local Geometry
- Computer Graphics
- Converting Points to Lines or Polygons
- OpenFOAM Tutorial Free Surface Tutorial Using InterFoam and RasInterFoam Hassan_Hemida_VOF
- Primal/Dual Mesh with Application to Triangular/Simplex Mesh and Delaunay/Voronoi
- 24th Balkan Mathematical Olympiad
- BlenderCourse Basics V2.1 - En
- Cgms Lecture Notes2
- Manual
- Elliot Paquette and Tamas Keleti- On a Generalization of the Koch Curve Built from n-gons
- fitjee test paper of math
- Fundamentals of Transportation
- Apa Vrpspd Paper
- 9-Apt,Sat-II,Iit&Io Maths Paper i
- Mean Value Theorem(ebooksforgate.blogspot.in)
- 19. Comp Sci - IJCSE - Implementation Fo Surface - Shivali Goal
- Chapter 5
- chap06_emd.pdf
- Making Shri Yantra in 14 Steps
- 18961-22700-4-PB
- Differences Between Hardware and Software Rendering

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd