Practical Linear Algebra: A Geometry Toolbox

Similar documents
Practical Linear Algebra: A Geometry Toolbox

1/25 Warm Up Find the value of the indicated measure

Polygon. Note: Each segment is called a side. Each endpoint is called a vertex.

Lesson 7.1. Angles of Polygons

MPM1D Page 1 of 6. length, width, thickness, area, volume, flatness, infinite extent, contains infinite number of points. A part of a with endpoints.

Geometry Unit 6 Properties of Quadrilaterals Classifying Polygons Review

The National Strategies Secondary Mathematics exemplification: Y8, 9

heptagon; not regular; hexagon; not regular; quadrilateral; convex concave regular; convex

Practical Linear Algebra: A Geometry Toolbox

Math Polygons

Boardworks Ltd KS3 Mathematics. S1 Lines and Angles

MAT104: Fundamentals of Mathematics II Introductory Geometry Terminology Summary. Section 11-1: Basic Notions

Geometry Ch 7 Quadrilaterals January 06, 2016

AN INNOVATIVE ANALYSIS TO DEVELOP NEW THEOREMS ON IRREGULAR POLYGON

Term Definition Figure

Contents. Lines, angles and polygons: Parallel lines and angles. Triangles. Quadrilaterals. Angles in polygons. Congruence.

6 Polygons and. Quadrilaterals CHAPTER. Chapter Outline.

Objectives. 6-1 Properties and Attributes of Polygons

1.6 Classifying Polygons

Geometry Reasons for Proofs Chapter 1

Warm-Up Exercises. 1. Draw an acute angle and shade the interior. ANSWER. 2. Find the measure of the supplement of a 130º angle.

Geometry/Trigonometry Unit 5: Polygon Notes Period:

Lesson Polygons

Angles in a polygon Lecture 419

Unit 10 Study Guide: Plane Figures

6-1 Properties and Attributes of Polygons

Tessellations: Wallpapers, Escher & Soccer Balls. Robert Campbell

Math 3315: Geometry Vocabulary Review Human Dictionary: WORD BANK

Main Idea: classify polygons and determine which polygons can form a tessellation.

The radius for a regular polygon is the same as the radius of the circumscribed circle.

U4 Polygon Notes January 11, 2017 Unit 4: Polygons

15. First make a parallelogram by rotating the original triangle. Then tile with the Parallelogram.

Geometry Vocabulary. acute angle-an angle measuring less than 90 degrees

Review Interior Angle Sum New: Exterior Angle Sum

Points, lines, angles

Angle Unit Definitions

Math 366 Lecture Notes Section 11.4 Geometry in Three Dimensions

January Regional Geometry Team: Question #1. January Regional Geometry Team: Question #2

Practical Linear Algebra: A Geometry Toolbox

MATH 113 Section 8.2: Two-Dimensional Figures

Polygons and Convexity

6.7 Regular Polygons

GEOMETRY is the study of points in space

Graphics (Output) Primitives. Chapters 3 & 4

Unit 3 Geometry. Chapter 7 Geometric Relationships Chapter 8 Measurement Relationships Chapter 9 Optimizing Measurements MPM1D

UNIT 6: Connecting Algebra & Geometry through Coordinates

Any questions about the material so far? About the exercises?

Angles of Polygons. Essential Question What is the sum of the measures of the interior angles of a polygon?

Grade 8 Math WORKBOOK UNIT 1 : POLYGONS. Are these polygons? Justify your answer by explaining WHY or WHY NOT???

Yimin Math Centre. 6.1 Properties of geometrical figures Recognising plane shapes... 1

8 Quadrilaterals. Before

If two sides and the included angle of one triangle are congruent to two sides and the included angle of 4 Congruence

Answer Key. 1.1 Basic Geometric Definitions. Chapter 1 Basics of Geometry. CK-12 Geometry Concepts 1

Contents. Lines, angles and polygons: Parallel lines and angles. Triangles. Quadrilaterals. Angles in polygons. Congruence.

Polygons are named by the number of sides they have:

Pick s Theorem and Lattice Point Geometry

Course: Geometry Level: Regular Date: 11/2016. Unit 1: Foundations for Geometry 13 Days 7 Days. Unit 2: Geometric Reasoning 15 Days 8 Days

pine cone Ratio = 13:8 or 8:5

Geometry Chapter 8 Test Review

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

Cambridge Essentials Mathematics Core 9 GM1.1 Answers. 1 a

Lattice Polygon s and Pick s Theorem From Dana Paquin and Tom Davis 1 Warm-Up to Ponder

Computational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm

Index COPYRIGHTED MATERIAL. Symbols & Numerics

Click the mouse button or press the Space Bar to display the answers.

Essential Questions Content Skills Assessments Standards/PIs Resources/Notes. Restates a nonmathematical. using logic notation

CSCI 4620/8626. Coordinate Reference Frames

Understanding Quadrilaterals

Suggested List of Mathematical Language. Geometry

Moore Catholic High School Math Department

SOL Chapter Due Date

Killingly Public Schools. Grades Draft Sept. 2002

For full credit, show all work. Study all geometry vocabulary words from your chapter packet.

Lines Plane A flat surface that has no thickness and extends forever.

GEOMETER SKETCHPAD INTRODUCTION

Thomas Jefferson High School for Science and Technology Program of Studies TJ Math 1

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

1. Revision Description Reflect and Review Teasers Answers Recall of basics of triangles, polygons etc. Review Following are few examples of polygons:

The Essentials of CAGD

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

GEOMETRY. Background Knowledge/Prior Skills. Knows ab = a b. b =

Chapter 3 Final Review

14. How many sides does a regular polygon have, if the measure of an interior angle is 60?

Moore Catholic High School Math Department

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Geometry Foundations Planning Document

Postulates, Theorems, and Corollaries. Chapter 1

Geometry Practice. 1. Angles located next to one another sharing a common side are called angles.

Polygon Angle-Sum Theorem:

Geometry. Geometry is the study of shapes and sizes. The next few pages will review some basic geometry facts. Enjoy the short lesson on geometry.

Basic Euclidean Geometry

Pre-Algebra, Unit 10: Measurement, Area, and Volume Notes

Unit 6: Connecting Algebra and Geometry Through Coordinates

Geometry 10 and 11 Notes

Point A location in geometry. A point has no dimensions without any length, width, or depth. This is represented by a dot and is usually labelled.

Angle Unit Definition Packet

1 Appendix to notes 2, on Hyperbolic geometry:

Computational Geometry

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Chapter 8. Properties of Triangles and Quadrilaterals. 02/2017 LSowatsky

Transcription:

Practical Linear Algebra: A Geometry Toolbox Third edition Chapter 18: Putting Lines Together: Polylines and Polygons Gerald Farin & Dianne Hansford CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/pla c 2013 Farin & Hansford Practical Linear Algebra 1 / 36

Outline 1 Introduction to Putting Lines Together: Polylines and Polygons 2 Polylines 3 Polygons 4 Convexity 5 Types of Polygons 6 Unusual Polygons 7 Turning Angles and Winding Numbers 8 Area 9 Application: Planarity Test 10 Application: Inside or Outside? 11 WYSK Farin & Hansford Practical Linear Algebra 2 / 36

Introduction to Putting Lines Together: Polylines and Polygons Left Figure shows a polygon just about every computer-generated drawing consists of polygons Add an eye and apply a sequence of rotations and translations Right Figure: copies of the bird polygon can cover the whole plane Technique is present in many illustrations by M. C. Escher Farin & Hansford Practical Linear Algebra 3 / 36

Polylines 2D polyline examples Polyline: edges connecting an ordered set of vertices First and last vertices not necessarily connected Vertices are ordered and edges are oriented edge vectors Polyline can be 3D Farin & Hansford Practical Linear Algebra 4 / 36

Polylines Polylines are a primary output primitive in graphics standards Example: GKS (Graphical Kernel System) Postscript (printer language) based on GKS Polylines used to outline a shape 2D or 3D see Figure Surface evaluated in an organized fashion polylines Gives feeling of the flow of the surface Modeling application: polylines approximate a complex curve or data analysis easier and less costly Farin & Hansford Practical Linear Algebra 5 / 36

Polygons Polygon: polyline with first and last vertices connected Here: Polygon encloses an area planar polygons only Polygon with n edges is given by an ordered set of 2D points Edge vectors v i = p i+1 p i p 1,p 2,...,p n i = 1,...,n where p n+1 = p 1 cyclic numbering convention Edge vectors sum to the zero vector Number of vertices equals the number of edges Farin & Hansford Practical Linear Algebra 6 / 36

Polygons Interior and exterior angles Polygon is closed divides the plane into two parts: 1) a finite part: interior 2) an infinite part: exterior Traverse the boundary of a polygon: Move along the edges and at each vertex rotate angle α i turning angle or exterior angle Interior angle: π α i Farin & Hansford Practical Linear Algebra 7 / 36

Polygons A minmax box is a polygon Polygons are used a lot! Fundamental Examples: Extents of geometry: the minmax box Triangles forming a polygonal mesh of a 3D model Farin & Hansford Practical Linear Algebra 8 / 36

Convexity Left Sketch: Polygon classification Left polygon: convex Right polygon: nonconvex Convexity tests: 1) Rubberband test described in right Sketch 2) Line connecting any two points in/on polygon never leaves polygon Farin & Hansford Practical Linear Algebra 9 / 36

Convexity Some algorithms simplified or specifically designed for convex polygons Example: polygon clipping Given: two polygons Find: intersection of polygon areas If both polygons are convex results in one convex polygon Nonconvex polygons need more record keeping Farin & Hansford Practical Linear Algebra 10 / 36

Convexity n-sided convex polygon Sum of interior angles: I = (n 2)π Triangulate n 2 triangles Triangle: sum of interior angles is π Sum of the exterior angles: E = nπ (n 2)π = 2π Each interior and exterior angle sums to π Farin & Hansford Practical Linear Algebra 11 / 36

Convexity More convexity tests for an n-sided polygon The barycenter of the vertices b = 1 n (p 1 +...+p n ) center of gravity Construct the implicit line equation for each edge vector Needs to be done in a consistent manner Polygon convex if b on same side of every line Implicit equation evaluations result in all positive or all negative values Another test for convexity: Check if there is a re-entrant angle: an interior angle > π Farin & Hansford Practical Linear Algebra 12 / 36

Types of Polygons Variety of special polygons equilateral: all sides equal length equiangular: all interior angles at vertices equal regular: equilateral and equiangular Rhombus: equilateral but not equiangular Rectangle: equiangular but not equilateral Square: equilateral and equiangular Farin & Hansford Practical Linear Algebra 13 / 36

Types of Polygons Regular polygon also referred to as an n-gon a 3-gon is an equilateral triangle a 4-gon is a square a 5-gon is a pentagon a 6-gon is a hexagon an 8-gon is an octagon Farin & Hansford Practical Linear Algebra 14 / 36

Types of Polygons Circle approximation: using an n-gon to represent a circle Farin & Hansford Practical Linear Algebra 15 / 36

Unusual Polygons Nonsimple polygon: edges intersecting other than at the vertices Can cause algorithms to fail Traverse along the boundary At the mid-edge intersections polygon s interior switches sides Nonsimple polygons can arise due to an error Example: polygon clipping algorithm involves sorting vertices to form polygon If sorting goes haywire result could be a nonsimple polygon Farin & Hansford Practical Linear Algebra 16 / 36

Unusual Polygons Polygons with holes defined by 1) boundary polygon 2) interior polygons Convention: The visible region or the region that is not cut out is to the left Outer boundary oriented counterclockwise Inner boundaries are oriented clockwise Farin & Hansford Practical Linear Algebra 17 / 36

Unusual Polygons Trimmed surface: an application of polygons with holes Left: trimmed surface Right: rectangular parametric domain with polygonal holes A Computer-Aided Design and Manufacturing (CAD/CAM) application Polygons define parts of the material to be cut or punched out This allows other parts to fit to this one Farin & Hansford Practical Linear Algebra 18 / 36

Turning Angles and Winding Numbers Turning angle: rotation at vertices as boundary traversed For convex polygons: All turning angles have the same orientation Same as exterior angle For nonconvex polygons: Turning angles do not have same orientation Farin & Hansford Practical Linear Algebra 19 / 36

Turning Angles and Winding Numbers Turning angle application Given: 2D polygon living in the [e 1,e 2 ]-plane with vertices p 1,p 2,...p n Find: Is the polygon is convex? Solution: Embed the 2D vectors in 3D p 1,i p i = p 2,i then u i = (p i+1 p i ) (p i+2 p i+1 ) = 0 Or use the scalar triple product: u 3,i = e 3 ((p i+1 p i ) (p i+2 p i+1 )) Polygon is convex if the sign of u 3,i is the same for all angles Consistent orientation of the turning angles 0 0 u 3,i Farin & Hansford Practical Linear Algebra 20 / 36

Turning Angles and Winding Numbers Consistent orientation of the turning angles can be determined from the determinant of the 2D vectors as well 3D approach needed if vertices lie in an arbitrary plane with normal n 3D polygon convexity test: u i = (p i+1 p i ) (p i+2 p i+1 ) (has direction ±n) Extract a signed scalar value n u i Polygon is convex if all scalar values are the same sign Farin & Hansford Practical Linear Algebra 21 / 36

Turning Angles and Winding Numbers Total turning angle: sum of all turning angles Convex polygon: 2π E = Sum of signed turning angles Winding number of the polygon W = E 2π Convex polygon: W = 1 Decremented for each clockwise loop Incremented for each counterclockwise loop Farin & Hansford Practical Linear Algebra 22 / 36

Area Signed area of a 2D polygon Polygon defined by vertices p i Triangulate the polygon (consistent orientation) Sum of the signed triangle areas Form v i = p i p 1 A = 1 2 (det[v 2,v 3 ]+det[v 3,v 4 ] +det[v 4,v 5 ]) Farin & Hansford Practical Linear Algebra 23 / 36

Area Signed area of a nonconvex 2D polygon Use of signed area makes sum of triangle areas method work for non-convex polygons Negative areas cancel duplicate and extraneous areas Farin & Hansford Practical Linear Algebra 24 / 36

Area Determinants representing edges of triangles within the polygon cancel A = 1 2 (det[p 1,p 2 ]+...+det[p n 1,p n ]+det[p n,p 1 ]) Geometric meaning? Yes: consider each point to be p i o Which equation is better? Amount of computation for each is similar Drawback of point-based: If polygon is far from the origin then numerical problems can occur vectors p i and p i+1 will be close to parallel Advantage of vector-based: intermediate computations meaningful Reducing an equation to its simplest form not always optimal! Farin & Hansford Practical Linear Algebra 25 / 36

Area Generalized determinant: A = 1 2 p 1,1 p 1,2 p 1,n p 1,1 p 2,1 p 2,2 p 2,n p 2,1 Compute by adding products of downward diagonals and subtracting products of upward diagonals Example: p 1 = [ ] 0 0 p 2 = [ ] 1 0 p 3 = [ ] 1 1 p 4 = [ ] 0 1 (square) A = 1 2 0 1 1 0 0 0 0 1 1 0 = 1 2 [0+1+1+0 0 0 0 0] = 1 [ ] [ ] [ ] [ ] 0 1 0 1 Example: p 1 = p 0 2 = p 1 3 = p 1 4 = (nonsimple) 0 A = 1 2 0 1 0 1 0 0 1 1 1 0 = 1 2 [0+1+0+0 0 0 1 0] = 0 Farin & Hansford Practical Linear Algebra 26 / 36

Area Area of a planar polygon specified by 3D points p i Recall: cross product parallelogram area Let v i = p i p 1 and u i = v i v i+1 for i = 2,n 1 Unit normal to the polygon is n shares same direction as u i A = 1 2 n (u 2 +...+u n 1 ) (sum of scalar triple products) Farin & Hansford Practical Linear Algebra 27 / 36

Area Example: Four coplanar 3D points 0 2 2 0 p 1 = 2 p 2 = 0 p 3 = 0 p 4 = 2 0 0 3 3 1/ 2 n = 1/ 2 2 0 2 v 2 = 2 v 3 = 2 v 4 = 0 0 0 3 3 6 6 u 2 = v 2 v 3 = 6 and u 3 = v 3 v 4 = 6 0 0 A = 1 2 n (u 2 +u 3 ) = 6 2 Farin & Hansford Practical Linear Algebra 28 / 36

Area Normal estimation method: Good average normal to a non-planar polygon: n = (u 2 +u 3 +...+u n 2 ) u 2 +u 3 +...+u n 2 This method is a weighted average based on the areas of the triangles To eliminate this weighting normalize each u i before summing Example: Estimate a normal to the non-planar polygon p 1 = 0 0 p 2 = 1 0 p 3 = 1 1 p 4 = 0 1 1 0 1 0 u 2 = 1 1 u 3 = 1 1 1 1 n = 0 0 1 Farin & Hansford Practical Linear Algebra 29 / 36

Application: Planarity Test CAD file exchange scenario: Given a polygon oriented arbitrarily in 3D For your application the polygon must be 2D How do you verify that the data points are coplanar? Many ways to solve this problem Considerations in comparing algorithms: numerical stability speed ability to define a meaningful tolerance size of data set maintainability of the algorithm Order of importance? Farin & Hansford Practical Linear Algebra 30 / 36

Application: Planarity Test Three methods to solve this planarity test Volume test: Choose first polygon vertex as a base point Form vectors to next three vertices Calculate volume spanned by three vectors If less than tolerance then four points are coplanar Continue for all other sets Plane test: Construct plane through first three vertices If all vertices lie in this plane (within tolerance) then points coplanar Average normal test: Find centroid c of all points Compute all normals n i = [p i c] [p i+1 c] If all angles formed by two subsequent normals less than tolerance then points coplanar Tolerance types: volume distance angle Farin & Hansford Practical Linear Algebra 31 / 36

Application: Inside or Outside? Inside/outside test or Visibility test Given: a polygon in the [e 1,e 2 ]-plane and a point p Determine if p lies inside the polygon This problem important for Polygon fill CAD trimmed surfaces Polygon can have one or more holes Important element of visibility algorithms: trivial reject test If a point is obviously not in the polygon then output result immediately with minimal calculation Here: trivial reject based on minmax box around the polygon Simple comparison of e 1 - and e 2 -coordinates Farin & Hansford Practical Linear Algebra 32 / 36

Application: Inside or Outside? Even-Odd Rule From point p construct a parametric line in any direction r l(t) = p+tr Count the number of intersections with the polygon edges for t 0 Number of intersections Odd if p is inside Even if p is outside Best to avoid l(t) passing through vertex or coincident with edge Farin & Hansford Practical Linear Algebra 33 / 36

Application: Inside or Outside? Nonzero Winding Number Rule Point p and any direction r l(t) = p+tr Count intersections for t 0 Counting method depends on the orientation of the polygon edges Start with a winding number W = 0 right to left polygon edge W = W +1 left to right polygon edge W = W 1 If final W = 0 then point outside Farin & Hansford Practical Linear Algebra 34 / 36

Application: Inside or Outside? Visibility test applied to polygon fill Even-Odd Rule Nonzero Winding Rule Three examples to highlight differences in the algorithms Convex polygons: allow for a simple visibility test Inside if p is on the same side of all oriented edges Farin & Hansford Practical Linear Algebra 35 / 36

WYSK polygon polyline cyclic numbering turning angle exterior angle interior angle polygonal mesh convex concave polygon clipping sum of interior angles sum of exterior angles re-entrant angle equilateral polygon equiangular polygon regular polygon n-gon rhombus simple polygon trimmed surface visible region total turning angle winding number polygon area planarity test trivial reject inside/outside test scalar triple product Farin & Hansford Practical Linear Algebra 36 / 36