University of North Carolina at Greensboro

Slides:



Advertisements
Similar presentations
Euclidean m-Space & Linear Equations Euclidean m-space.
Advertisements

Copyright © Cengage Learning. All rights reserved.
Sasha Vasserman.  Two triangles are similar if two pairs of corresponding angles are congruent.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter Vector Tools for Graphics S. M. Lea University of North Carolina.
Computer Graphics - Class 14
17 VECTOR CALCULUS.
Multiple Integrals 12. Surface Area Surface Area In this section we apply double integrals to the problem of computing the area of a surface.
VECTORS AND THE GEOMETRY OF SPACE 12. VECTORS AND THE GEOMETRY OF SPACE A line in the xy-plane is determined when a point on the line and the direction.
Lines and Planes in Space
11 Analytic Geometry in Three Dimensions
Copyright © Cengage Learning. All rights reserved. 10 Analytic Geometry in Three Dimensions.
Vectors and the Geometry of Space
Vector Exercise. Parametric form for a line Passing two points.
1.3 Lines and Planes. To determine a line L, we need a point P(x 1,y 1,z 1 ) on L and a direction vector for the line L. The parametric equations of a.
Copyright © Cengage Learning. All rights reserved. 16 Vector Calculus.
Definitions and Symbols © 2008 Mr. Brewer. A flat surface that never ends.
Coordinate Systems and Coordinate Frames  vector v = (3, 2, 7)  point P = (5, 3, 1)  coordinate frame consists of a specific point, V, called the origin,
Elements of 2D Figures & Classifying Polygons. Point: a position in a plane or in a space that has no dimensions. Example: a point is written point A.
DOT PRODUCT CROSS PRODUCT APPLICATIONS
5.2 – Use Perpendicular Bisectors A segment, ray, line, or plane, that is perpendicular to a segment at its midpoint is called a perpendicular bisector.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Vectors Part III Intersections.
Week 4 Functions and Graphs. Objectives At the end of this session, you will be able to: Define and compute slope of a line. Write the point-slope equation.
VECTORS AND THE GEOMETRY OF SPACE 10. VECTORS AND THE GEOMETRY OF SPACE In this chapter, we introduce vectors and coordinate systems for three-dimensional.
Copyright © Cengage Learning. All rights reserved.
Measures and Relationships.  Ray – part of a line that includes one endpoint and extends infinitely in one direction  Opposite rays – rays that share.
Section 5.2 Perpendicular Bisectors Chapter 5 PropertiesofTriangles.
Segments, Rays, and Distance
University of North Carolina at Greensboro
Copyright © Cengage Learning. All rights reserved.
Chapter 2 Planes and Lines
Introduction to Functions of Several Variables
Vectors and the Geometry
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
SEGMENTS, RAYS, PARALLEL LINES AND PLANES
Don’t change your radius!
In this section, we will learn about: Using integration to find out
Copyright © Cengage Learning. All rights reserved.
Chapter 3 VECTORS.
VECTORS APPLICATIONS NHAA/IMK/UNIMAP.
Transformations and Congruence
11 Vectors and the Geometry of Space
Copyright © Cengage Learning. All rights reserved.
(MTH 250) Calculus Lecture 22.
COORDINATE PLANE FORMULAS:
Copyright © Cengage Learning. All rights reserved.
Section 2.8 Distance and Midpoint Formulas; Circles
Copyright © Cengage Learning. All rights reserved.
Point-a location on a plane.
Copyright © Cengage Learning. All rights reserved.
Vectors and the Geometry
The Coordinate Plane; Graphs of Equations; Circles
Vectors and the Geometry
Vectors and the Geometry
Objectives Identify, name, and draw points, lines, segments, rays, and planes. Apply basic facts about points, lines, and planes.
CHAPTER 7 SIMILAR POLYGONS.
Lesson 83 Equations of Planes.
Geometry vocab. tHESE SHOULD also be DONE ON INDEX CARDS AND YOU SHOULD BE CONSTANTLY REVIEWING THEM AS WE GO!
EXAMPLE 1 Identify special segments and lines
Copyright © Cengage Learning. All rights reserved.
Geometry Equations of Circles.
Measures and Relationships
1.1 Points, Lines, and Planes
11 Vectors and the Geometry of Space
Transformations and Congruence
Copyright © Cengage Learning. All rights reserved.
Day 42 – Square inscribed in a circle
Vectors and the Geometry
Understanding Points, 1-1 Lines, and Planes Warm Up
Presentation transcript:

University of North Carolina at Greensboro Computer Graphics using OpenGL, 3rd Edition F. S. Hill, Jr. and S. Kelley Chapter 4.4-8 Vector Tools for Graphics S. M. Lea University of North Carolina at Greensboro © 2007, Prentice Hall

Representing Lines A line passes through 2 points and is infinitely long. A line segment has 2 endpoints. A ray has a single endpoint.

Representing Lines (2) There are 2 useful line representations: Parametric form: we have 2 points, B and C, on the line. P(x, y) is on the line when P = C + bt, where b = B – C. 0 ≤ t ≤ 1: line segment; -∞≤ t ≤ ∞: line; -∞≤ t ≤ 0 or 0 ≤ t ≤ ∞: ray.

Representing Lines (3) As t varies so does the position of L(t) along the line. (Let t be time.) If t = 0, L(0) = C so at t = 0 we are at point C. At t = 1, L(1) = C + (B - C) = B. If t > 1 this point lies somewhere on the opposite side of B from C, and when t < 0 it lies on the opposite side of C from B.

Representing Lines (4) L(t) lies fraction t of the way between C and B when t lies between 0 and 1. When t = 1/2 the point L(0.5) is the midpoint between C and B, and when t = 0.3 the point L(0.3) is 30% of the way from C to B: |L(t) – C| = |b| |t| and |B - C| = |b|, so the value of |t| is the ratio of the distances |L(t) - C| to |B - C|.

Representing Lines (5) The speed with which the point L(t) moves along line L is given by distance |b| t divided by time t, so it is moving at constant speed |b|. There is a significant difference between a parametric form for a curve (p(t)) and a motion path for the same curve. Given p(t) swept out as t increases gives no information as to how fast the point moves along that path. (The picture for p(t) is the same as that for p(t2) or p(t3).)

Representing Lines (6) Point-normal (implicit) form: (this works in 2D only; the 3D version requires 2 equations.) fx + gy = 1 gives (f, g)∙(x, y) = 1. Given B and C on the line, b = B – C gives b┴ = n, which is perpendicular to R – C. (R is any point (x, y) on the line.) The equation is n ∙ (R – C) = 0.

Changing Representations From f x + g y = 1 to point-normal form: Writing (f, g) · (x, y) = 1, n is (f, g) (or any multiple thereof). From point normal form n · (P - C) = 0 to parametric form: L(t) = C + n┴t

Representing Planes: Point-Normal Form Point-normal form: n∙(P – B) = 0; where B is a given point on the plane, and P = (x, y, z, 1)T.

Exercise Example 4.5.2. A line in 2D. Find a parametric form for the line that passes through C= (3, 5) and B = (2,7). Solution: Build vector b = B - C = (-1, 2) to obtain the parametric form L(t) = (3 - t, 5 + 2 t). Example 4.5.3. A line in 3D. Find a parametric form for the line that passes through C= (3, 5,6) and B = (2,7,3). Solution: Build vector b = B - C = (-1, 2, -3) to obtain the parametric form L(t) = (3 - t, 5+ 2 t, 6 - 3t).

Exercise Example 4.5.4. Find the point normal form. Suppose line L passes through points C = (3, 4) and B = (5, -2). Then b = B - C = (2, - 6) and b ‘s normal = (6, 2) Choosing C as the point on the line, the point normal form is: (6, 2) . ((x, y) - (3, 4)) = 0, or 6x + 2y = 26. Both sides of the equation can be divided by 26 (or any other nonzero number) if desired. f x + g y = 1. Writing this once again as (f, g) .(x, y) = 1 it is clear that the normal n is simply (f, g) (or any multiple thereof). For instance, the line given by 5x - 2y = 7 has normal vector (5, -2), or more generally K(5, -2) for any nonzero K.

Moving from each representation to the others. The three representations and their data are: The two point form: say C and B; data = {C, B} The parametric form: C + bt; data = {C, b}. The point normal (implicit) form (in 2D only): n.(P - C) = 0; data = {C, n}.

Planes: Parametric Form A plane can be infinite in 2 directions, semi-infinite, or finite. Parametric form: requires 3 non- collinear points on the plane, A, B, and C. P(s, t) = C + sa + tb, where a = A – C and b = B – C. -∞≤ s ≤ ∞ and -∞≤ t ≤ ∞: infinite plane. 0 ≤ s ≤ 1 and 0 ≤ t ≤ 1: a finite plane, or patch.

Planes: Parametric Form (2) We can rewrite P(s,t) = C + sa + tb, where a = A – C and b = B – C, as an affine combination of points: P(s, t) = s A + t B + (1 - s - t)C.

Planes: Parametric Form (3) The figure shows the available range of s and t as a square in parameter space, and the patch that results from this restriction in object space.

Exercise Find a parametric form given the equation of the plane. Find a parametric form for the plane 2 x - y + 3 z = 8. Solution: By inspection the normal is (2, - 1, 3). There are many parametrizations; we need only find one. For C, choose any point that satisfies the equation; C = (4, 0, 0) will do. Find two (noncollinear) vectors, each having a dot product of 0 with (2, - 1, 3); some hunting finds that a = (1, 5, 1) and b = (0, 3, 1) will work. Thus the plane has parametric form P(s, t) = (4, 0, 0) + (1, 5, 1) s + (0, 3, 1) t.

Find two noncolinear vectors a = (0, 0, 1) x n b = n x a

Moving from each representation to the others. For a plane, the three representations and their data are: The three point form: say C , B, and A; data = {C, B, A} The parametric form: C + as + bt; data = {C, a, b}. The point normal (implicit) form: n.(P - C) = 0; data = {C, n}.

Patches Mapping textures onto faces involves finding a mapping from a portion of parameter space onto object space, as we shall see later. Each point (s, t) in parameter space corresponds to one 3D point in the patch P(s, t) = C + as + bt. The patch is a parallelogram whose corners correspond to the four corners of parameter space and are situated at P(0, 0) = C; P(1, 0) = C + a; P(0, 1) = C + b; P(1, 1) = C + a + b.

Patches (2) The vectors a and b determine both the size and the orientation of the patch. If a and b are perpendicular, the grid will become rectangular. If in addition a and b have the same length, the grid will become square. Changing C just translates the patch without changing its shape or orientation.

Finding the Intersection of 2 Line Segments They can miss each other (a and b), overlap in one point (c and d), or even overlap over some region (e). They may or may not be parallel.

Intersection of 2 Line Segments (2) Every line segment has a parent line, the infinite line of which it is part. Unless two parent lines are parallel, they will intersect at some point in 2D. We locate this point. Using parametric representations for each of the line segments in question, call AB the segment from A to B. Then AB(t) = A + b t, where for convenience we define b = B - A. As t varies from 0 to 1 each point on the finite line segment is crossed exactly once.

Intersection of 2 Line Segments (3) AB(t) = A + bt, CD(u) = C + du, where b = B – A and d = C – D. At the intersection, A + bt = C + du, or bt = c + du, with c = C – A. Taking dot product with d┴ gives b∙d┴ t = c∙d┴ . Taking dot product with b┴ gives - c∙b┴ = d∙b┴ u.

Intersection of 2 Line Segments (4) Case1: b∙d┴ = 0 means d∙b┴ = 0 and the lines are either the same line or parallel lines. There is no intersection. Case 2: b∙d┴ ≠ 0 gives t = c∙d┴ / b∙d┴ and u = - c∙b┴/ d∙b┴ . In this case, the line segments intersect if and only if 0 ≤ t ≤ 1 and 0 ≤ u ≤ 1, at P = A + b(c∙d┴ / b∙d┴).

Example 4.6.1: Given the endpoints A = (0, 6), B = (6, 1), C = (1, 3), and D = (5, 5), find the intersection if it exists. Solution: d ^ = (-2,4), so t = 7/16 and u = 13/32 which both lie between 0 and 1, and so the segments do intersect. The intersection lies at (x, y) = (21/8, 61/16). This result may be confirmed visually by drawing the segments on graph paper and measuring the observed intersection.

Finding A Circle through 3 Points We want to find the center and the radius of the circle. The 3 points make a triangle, and the center S is where the perpendicular bisectors of two of the sides of the triangle meet. The radius is r = |A – S|.

Circle through 3 Points (2) The perpendicular bisector passes through the midpoint M = ½ (A + B) of the line AB, in the direction (B – A)┴. Let a = B – A, b = C – B, and c = A - C.

Circle through 3 Points (3) Midpoint of AB: A + a / 2; direction perpendicular to AB: a┴. The perpendicular bisector of AB is A + a / 2 + a┴ t, and for AC, A - c / 2 + c┴ u, using parameter u. Point S lies where these meet, at the solution of a┴t = b / 2 + c┴ u (where we have used a + b + c = 0). Radius R = |S – A|, or