A question about polygons Devising a computational method for determining if a point lies in a plane convex polygon.

Slides:



Advertisements
Similar presentations
Liceo Scientifico Isaac Newton Maths course Polyhedra
Advertisements

Addition of vectors (i) Triangle Rule [For vectors with a common point] C B A.
8.1 Prisms, Area and Volume Prism – 2 congruent polygons lie in parallel planes corresponding sides are parallel. corresponding vertices are connected.
Geometry 5 Level 1. Interior angles in a triangle.
3.5 The Triangle Sum Theorem
Complementary and Supplementary Angles.
11 Chapter Introductory Geometry
THE WORLD OF POLYGONS LESSON 4.
Chapter 12: Surface Area and Volume of Solids
Two- and Three-Dimensional Figures
EXAMPLE 1 Classifying Solids
POLYHEDRON.
Prisms Lesson 9-2.
By: Andrew Shatz & Michael Baker Chapter 15. Chapter 15 section 1 Key Terms: Skew Lines, Oblique Two lines are skew iff they are not parallel and do not.
Regular Polytopes in Four and Higher Dimensions
4.5 More Platonic Solids Wednesday, March 3, 2004.
Chapter 12 Surface Area and Volume. Topics We Will Discuss 3-D Shapes (Solids) Surface Area of solids Volume of Solids.
The Fish-Penguin-Giraffe Algebra A synthesis of zoology and algebra.
Chapter 12 Surface Area and Volume. Topics We Will Discuss 3-D Shapes (Solids) Surface Area of solids Volume of Solids.
Unit 8 Review. Which of the following shapes are CONGRUENT?
 A Polyhedron- (polyhedra or polyhedrons)  Is formed by 4 or more polygons (faces) that intersect only at the edges.  Encloses a region in space. 
Geometry Review. Name that Shape… Rectangle Name that Shape… hexagon.
Geometry Vocabulary Test Ms. Ortiz. 1. If two parallel lines are cut by a transversal, then the corresponding angles are congruent.
Prisms Fun with by D. Fisher
Surface Area and Volume Chapter 12. Exploring Solids 12.1 California State Standards 8, 9: Solve problems involving the surface area and lateral area.
Geometry: Part 2 3-D figures.
Vertex – A point at which two or more edges meet Edge – A line segment at which two faces intersect Face – A flat surface Vertices, Edges, Faces.
POLYGONS. BUILDING POLYGONS We use line segments to build polygons. A polygon is a closed shape with straight sides.
Introduction to Computational Geometry Hackson
1)The locus of points, lying in a plane, that are equidistant from a specific point – the center. 2)A regular polygon with an infinite number of sides.
Chapter 12 Section 1 Exploring Solids Using Properties of Polyhedra Using Euler’s Theorem Richard Resseguie GOAL 1GOAL 2.
12.1– Explore Solids.
POLYGONS & QUADRILATERALS
POLYHEDRON.
12.1 – Explore Solids.
6-3A Geometry Section 6-3B Regular Polyhedrons Page 448 If you have your solids, you might like to use them today. Test Friday – Shapes on Friday On.
Warm Up Week 6. Section 12.1 Day 1 I will use the properties of polyhedra. Cross section The intersection of a plane slicing through a solid.
Plane vs. Solid Geometry Plane GeometrySolid Geometry.
5.1 Polygon Sum Conjecture
12.1 Exploring Solids.
Ch 12 and 13 Definitions. 1. polyhedron A solid with all flat surfaces that enclose a single region of space.
CH. 5-1: POLYGON ANGLES Mr. Schaab’s Geometry Class Our Lady of Providence Jr.-Sr. High School
Algebra 2 9/22/14 Bellwork:. 2.8 – Graph Linear Inequalities in Two Variables A linear inequality in two variables can be written in one of these forms:
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.
Can you figure out what shape will be drawn just by looking at the coordinates of the vertices? (-4, 8) (-9, 3) (1, 3) (-4, -2)
Section 12-1 Exploring Solids. Polyhedron Three dimensional closed figure formed by joining three or more polygons at their side. Plural: polyhedra.
Section 1-1 Points and Lines. Each point in the plane can be associated with an ordered pair of numbers, called the coordinates of the point. Each ordered.
Space Figures and Nets Section 6-1 Notes and vocabulary available on my home page.
Acute angle: An angle with a measure less than 90º.
Warm up: Draw a vector on the Cartesian coordinate plane, and describe this vector in words.
Rectangular Coordinates Objectives: Use the Distance Formula Use the Midpoint Formula.
8 th Grade Math POLYGONS. A polygon is a plane figure with at least three straight sides and angles, and typically five or more. WHAT IS A POLYGON?
Geometry Name: __________________________ Unit 4 WS 2Date: __________________________ Identify the polygon by name, whether it is convex or non convex,
Classifying 3D Figures/Solids  Solid- a 3D figure that encloses a part of space  Polyhedron – a solid that is enclosed by polygons (faces) and has only.
Geometry 3-4 Polygon Angle Sum Theorems. Vocabulary.
Fun with Pyramids By D. Fisher
Polyhedrons and their Nets
Y. Davis Geometry Notes Chapter 1.
All sides have the same length and angles have the same measure.
12.1 Exploring Solids.
Classifying Polygons.
12-1 Properties of Polyhedra
Surface Area and Volume
Vertical Angles Vertical angles are across from each other and are created by intersecting lines.
4.3 Determinants and Cramer’s Rule
Geometry Chapter : Exploring Solids.
Classifying Polygons.
Unit 8 Review.
Presentation transcript:

A question about polygons Devising a computational method for determining if a point lies in a plane convex polygon

Problem background Recall our ‘globe.cpp’ ray-tracing demo It depicted a scene showing two objects One of the objects was a square tabletop Its edges ran parallel to x- and z-axes That fact made it easy to determine if the spot where a ray hit the tabletop fell inside or outside of the square’s boundary edges We were lucky!

Alternative geometry? What if we wanted to depict our globe as resting on a tabletop that wasn’t a nicely aligned square? For example, could we show a tabletop that was a hexagon? The only change is that the edges of this six-sided tabletop can’t all be lined up with the coordinate system axes We need a new approach to determining if a ray hits a spot that’s on our tabletop

A simpler problem How can we tell if a point lies in a triangle? a b c p q Point p lies inside triangle ΔabcPoint q lies outside triangle Δabc

Triangle algorithm Draw vectors from a to b and from a to c We can regard these vectors as the axes for a “skewed” coordinate system Then every point in the triangle’s plane would have a unique pair of coordinates We can compute those coordinates using Cramer’s Rule (from linear algebra)

The algorithm idea a b c p ap = c 1 *ab + c 2 *ac c 1 = det( ap, ac )/det( ab, ac ) c 2 = det( ab, ap )/det( ab, ac )

Cartesian Analogy p = (c 1,c 2 ) x-axis y-axis x + y = 1 p lies outside the triangle if c 1 1

Determinant function: 2x2 typedef float scalar_t; typedef struct { scalar_t x, y; } vector_t; scalar_t det( vector_t a, vector_t b ) { returna.x * b.y – b.x * a.y; }

Constructing a regular hexagon ( cos(0*theta), sin(0*theta) ) ( cos(1*theta), sin(1*theta) )( cos(2*theta), sin(2*theta) ) ( cos(3*theta), sin(3*theta) ) ( cos(4*theta), sin(4*theta) ) ( cos(5*theta), sin(5*theta) ) theta = 2*PI / 6

Subdividing the hexagon A point p lies outside the hexagon -- unless it lies inside one of these four sub-triangles

Same approach for n-gons Demo program ‘hexagon.cpp’ illustrates the use of our just-described algorithm Every convex polygon can be subdivided into triangles, so the same ideas can be applied to any regular n-sided polygon Exercise: modify the demo-program so it draws an octagon, a pentagon, a septagon

Extension to a tetrahedron A tetrahedron is a 3D analog of a triangle It has 4 vertices, located in space (but not all vertices can lie in the same plane) Each face of a tetrahedron is a triangle o a b c

Cramer’s Rule in 3D typedef float scalar_t; typedef struct { scalar_t x, y, z; } vector_t; scalar_t det( vector_t a, vector_t b, vector_t c ) { scalar_tsum = 0.0; sum += a.x * b.y * c.z – a.x * b.z * c.y; sum += a.y * b.z * c.x – a.y * b.x * c.z; sum += a.z * b.x * c.y – a.z * b.y * c.x; returnsum; }

Is point in tetrahedron? Let o, a, b, c be vertices of a tetrahedron Form the three vectors oa, ob, oc and regard them as the coordinate axes in a “skewed” 3D coordinate system Then any point p in space has a unique triple of coordinates: op = c 1 *oa + c 2 *ob + c 3 *oc These three coordinates can be computed using Cramer’s Rule

Details of Cramer Rule c 1 = det( op, ob, oc )/det( oa, ob, oc ) c 2 = det( oa, op, oc )/det( oa, ob, oc ) c 3 = det( oa, ob, op )/det( oa, ob, oc ) Point p lies inside the tetrahedron – unless c 1 < 0 or c 2 < 0 or c 3 < 0 orc 1 + c 2 + c 3 > 1

Convex polyhedron Just as a convex polygon can be divided into subtriangles, any convex polyhedron can be divided into several tetrahedrons We can tell if a point lies in the polyhedron by testing to see it lies in one of the solid’s tetrahedral parts An example: the regular dodecahedron can be raytraced by using these ideas!